Subversion Repositories Applications.gtt

Rev

Rev 89 | Rev 101 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89 Rev 95
Line 37... Line 37...
37
		$aso_stat['url_mois_suivant'] = 'index.php?action='.GTT_ACTION_STAT_TAB_GLOB.'&annee='.$NMonth->thisYear().'&mois='.$NMonth->thisMonth();
37
		$aso_stat['url_mois_suivant'] = 'index.php?action='.GTT_ACTION_STAT_TAB_GLOB.'&annee='.$NMonth->thisYear().'&mois='.$NMonth->thisMonth();
38
		$aso_stat['mois']['mois'] = $Calendrier->getNomMois($Month->thisMonth());
38
		$aso_stat['mois']['mois'] = $Calendrier->getNomMois($Month->thisMonth());
39
		$aso_stat['mois']['annee'] = $Month->thisYear();
39
		$aso_stat['mois']['annee'] = $Month->thisYear();
40
		$mois_courant_j1 = $Month->thisYear().'-'.sprintf("%02s", $Month->thisMonth()).'-'.sprintf("%02s", $Month->thisDay()).' 00:00:00';
40
		$mois_courant_j1 = $Month->thisYear().'-'.sprintf("%02s", $Month->thisMonth()).'-'.sprintf("%02s", $Month->thisDay()).' 00:00:00';
41
		$mois_courant_j36 = date('Y-m-d H:i:s', mktime(0, 0, 0, $NMonth->thisMonth(), 0, $NMonth->thisYear()));
41
		$mois_courant_j36 = date('Y-m-d H:i:s', mktime(0, 0, 0, $NMonth->thisMonth(), 0, $NMonth->thisYear()));
42
		
42
 
-
 
43
    	//+-------------------------------------------------------------------------------------------------+
-
 
44
		// GESTION D'INFO GLOBALES
-
 
45
		//+-------------------------------------------------------------------------------------------------+
-
 
46
		// Récupération des infos sur les utilisateurs
43
		$DaoUtilsateur = new Utilisateur();
47
		$DaoUtilsateur = new Utilisateur();
44
    	$utilisateurs = $DaoUtilsateur->consulter(Utilisateur::GU_TOUS_AFFICHABLE);
48
    	$utilisateurs = $DaoUtilsateur->consulter(Utilisateur::GU_TOUS_AFFICHABLE);
-
 
49
    	
-
 
50
		// Récupération des motifs d'absence
-
 
51
		$AbsenceMotif = new AbsenceMotif();
-
 
52
		$cmd = AbsenceMotif::GAM_TOUS;
-
 
53
		$tab_am = $AbsenceMotif->consulter($cmd);
45
    	if (is_object($utilisateurs)) {
54
    	if (false == $tab_am) {
46
    		$utilisateurs[0] = $utilisateurs;
55
    		$aso_stat['absences'] = false;
-
 
56
			$aso_stat['messages'][] = "Aucun motif d'absence de renseigné";
-
 
57
    		
47
    	}
58
    	}
Line -... Line 59...
-
 
59
    	
48
    	
60
    	// Pour chaque utilisateur nous récupérons les infos
49
		foreach ($utilisateurs as $Utilisateur) {
61
		foreach ($utilisateurs as $Utilisateur) {
50
			$aso_gestion = array();
62
			$aso_gestion = array();
51
			//+-------------------------------------------------------------------------------------------------+
63
			//+-------------------------------------------------------------------------------------------------+
52
			// GESTION DES PROJETS
64
			// GESTION DES PROJETS
Line 59... Line 71...
59
	
71
	
60
	    	// Récupération des projets sur lesquels l'utilisateur travaille
72
	    	// Récupération des projets sur lesquels l'utilisateur travaille
61
			$UtilsateurAProjet = new UtilisateurAProjet();
73
			$UtilsateurAProjet = new UtilisateurAProjet();
Line 62... Line 74...
62
	    	$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $Utilisateur->getIdUtilisateur());
74
	    	$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $Utilisateur->getIdUtilisateur());
-
 
75
	    	
-
 
76
	    	if (false == $tab_uap) {
-
 
77
	    		$aso_stat['projets'] = false;
63
	    	
78
	    		$aso_stat['messages'][] = "Aucune information sur le travail de ${aso_gestion['prenom_nom']}";
64
	    	if (is_array($tab_uap) && count($tab_uap) > 0) {
79
	    	} else {
65
		    	//echo '<pre>la'.print_r($tab_uap, true).'</pre>';
80
		    	//echo '<pre>la'.print_r($tab_uap, true).'</pre>';
66
		    	$tab_projet_id = array();
81
		    	$tab_projet_id = array();
67
		    	foreach ($tab_uap as $uap) {
82
		    	foreach ($tab_uap as $uap) {
Line 71... Line 86...
71
		    	// Récupération du temps de travail pour un utilisateur à une date donnée
86
		    	// Récupération du temps de travail pour un utilisateur à une date donnée
72
		    	$TravailProjet = new TravailProjet();
87
		    	$TravailProjet = new TravailProjet();
73
				$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN;
88
				$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN;
74
				$param = array($Utilisateur->getIdUtilisateur(), $mois_courant_j1, $mois_courant_j36);
89
				$param = array($Utilisateur->getIdUtilisateur(), $mois_courant_j1, $mois_courant_j36);
75
				$tab_tp = $TravailProjet->consulter($cmd, $param);
90
				$tab_tp = $TravailProjet->consulter($cmd, $param);
76
				if ($tab_tp && count($tab_tp) == 1) {
-
 
77
					$tab_tp = array($tab_tp);
-
 
78
				}
-
 
Line 79... Line 91...
79
		
91
		
80
				// Récupération des infos sur les projets de l'utilisateur
92
				// Récupération des infos sur les projets de l'utilisateur
81
		    	$aso_gestion['totaux'] = 0;
93
		    	$aso_gestion['totaux'] = 0;
82
		    	$Projet = new Projet();
94
		    	$Projet = new Projet();
Line 112... Line 124...
112
						}
124
						}
113
					}
125
					}
114
					$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()] = $Projet->getNom();
126
					$aso_stat['projets'][$Categorie->getLibelle()][$Projet->getIdProjet()] = $Projet->getNom();
115
				}
127
				}
116
	    	}
128
	    	}
-
 
129
 
117
			//+-------------------------------------------------------------------------------------------------+
130
			//+-------------------------------------------------------------------------------------------------+
118
			// GESTION DES ABSENCES
131
			// GESTION DES ABSENCES
119
			//+-------------------------------------------------------------------------------------------------+
132
			//+-------------------------------------------------------------------------------------------------+
120
			// Récupération des motifs d'absence
-
 
121
			$AbsenceMotif = new AbsenceMotif();
-
 
122
			$cmd = AbsenceMotif::GAM_TOUS;
-
 
123
			$tab_am = $AbsenceMotif->consulter($cmd);
-
 
124
			if ($tab_am && count($tab_am) == 1) {
-
 
125
				$tab_am = array($tab_am);
-
 
126
			}
-
 
127
	
-
 
128
			// Récupération des absences pour un utilisateur à une date donnée
133
			// Récupération des absences pour un utilisateur à une date donnée
129
	    	$Absence = new Absence();
134
	    	$Absence = new Absence();
130
			$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN;
135
			$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN;
131
			$param = array($Utilisateur->getIdUtilisateur(), $mois_courant_j1, $mois_courant_j36);
136
			$param = array($Utilisateur->getIdUtilisateur(), $mois_courant_j1, $mois_courant_j36);
132
			$tab_a = $Absence->consulter($cmd, $param);
137
			$tab_a = $Absence->consulter($cmd, $param);
133
			if ($tab_a && count($tab_a) == 1) {
-
 
134
				$tab_a = array($tab_a);
-
 
135
			}
-
 
136
	
-
 
137
			$aso_gestion['ab_total'] = '';
138
			$aso_gestion['ab_total'] = '';
-
 
139
			if (false == $tab_a) {
-
 
140
				$aso_stat['absences'] = false;
-
 
141
				$aso_stat['messages'][] = "Aucune information sur les absences de ${aso_gestion['prenom_nom']}";
-
 
142
			} else {
138
			if ($tab_am) {
143
				if (false != $tab_am) {
139
				foreach ($tab_am as $AM) {
144
					foreach ($tab_am as $AM) {
140
					$aso_stat['absences'][$AM->getIdAbsenceMotif()] = $AM->getLibelle();
145
						$aso_stat['absences'][$AM->getIdAbsenceMotif()] = $AM->getLibelle();
141
					//$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = 0;
146
						//$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = 0;
142
					if ($tab_a) {
-
 
143
						foreach ($tab_a as $A) {
147
						foreach ($tab_a as $A) {
144
							if ($A->getIdAbsenceMotif() == $AM->getIdAbsenceMotif() && $A->getDuree() != 0) {
148
							if ($A->getIdAbsenceMotif() == $AM->getIdAbsenceMotif() && $A->getDuree() != 0) {
145
								$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = $A->getDuree();
149
								$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = $A->getDuree();
146
								$aso_gestion['ab_total'] += $A->getDuree();
150
								$aso_gestion['ab_total'] += $A->getDuree();
147
								$aso_gestion['totaux'] += $A->getDuree();
151
								$aso_gestion['totaux'] += $A->getDuree();
Line 150... Line 154...
150
					}
154
					}
151
				}
155
				}
152
			}
156
			}
153
			$aso_stat['utilisateurs'][] = $aso_gestion;
157
			$aso_stat['utilisateurs'][] = $aso_gestion;
154
    	}
158
    	}
155
 
159
		
156
		//trigger_error('<pre>'.print_r($aso_stat, true).'</pre>', E_USER_NOTICE);
160
		//trigger_error('<pre>'.print_r($aso_stat, true).'</pre>', E_USER_NOTICE);
157
		$this->getRegistre()->ajouterDonnee('stat_tableau_global', $aso_stat);
161
		$this->getRegistre()->ajouterDonnee('stat_tableau_global', $aso_stat);
158
    }
162
    }
159
}
163
}
160
?>
164
?>
161
165