Subversion Repositories Applications.gtt

Rev

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

Rev 48 Rev 67
Line 113... Line 113...
113
		$aso_jours = array();
113
		$aso_jours = array();
114
		foreach($Week->fetchAll() as $num => $j) {
114
		foreach($Week->fetchAll() as $num => $j) {
115
			$aso_gestion['sj_'.$num]['jour'] = $j->thisDay();
115
			$aso_gestion['sj_'.$num]['jour'] = $j->thisDay();
116
			$aso_gestion['sj_'.$num]['mois'] = $Calendrier->getNomMois($j->thisMonth());
116
			$aso_gestion['sj_'.$num]['mois'] = $Calendrier->getNomMois($j->thisMonth());
117
			$aso_gestion['sj_'.$num]['annee'] = $j->thisYear();
117
			$aso_gestion['sj_'.$num]['annee'] = $j->thisYear();
118
			$aso_gestion['sj_'.$num]['mysql'] = $aso_gestion['sj_'.$num]['annee'].'-'.sprintf("%02s", $j->thisMonth()).'-'.$aso_gestion['sj_'.$num]['jour'];
118
			$aso_gestion['sj_'.$num]['mysql'] = $aso_gestion['sj_'.$num]['annee'].'-'.sprintf("%02s", $j->thisMonth()).'-'.sprintf("%02s", $aso_gestion['sj_'.$num]['jour']);
119
			$aso_jours[$aso_gestion['sj_'.$num]['mysql']] = $num;
119
			$aso_jours[$aso_gestion['sj_'.$num]['mysql']] = $num;
120
			$aso_tps_w_vide[$num] = '';
120
			$aso_tps_w_vide[$num] = '';
121
		}
121
		}
Line 122... Line 122...
122
 
122
 
123
		//+-------------------------------------------------------------------------------------------------+
123
		//+-------------------------------------------------------------------------------------------------+
124
		// GESTION DES PROJETS
124
		// GESTION DES PROJETS
125
		//+-------------------------------------------------------------------------------------------------+
125
		//+-------------------------------------------------------------------------------------------------+
126
    	// Récupération des infos sur l'utilisateur
126
    	// Récupération des infos sur l'utilisateur
127
 		$aso_gestion['conges_payes'] = $GLOBALS['_GTT_']['Utilisateur']->getCongesPayes();
127
 		$aso_gestion['conges_payes'] = $GLOBALS['_GTT_']['Utilisateur']->getCongesPayes();
128
 		$aso_gestion['rtt'] = $GLOBALS['_GTT_']['Utilisateur']->getQuotaHeuresSupp();
128
 		$aso_gestion['rtt'] = $GLOBALS['_GTT_']['Utilisateur']->getQuotaHeuresSupp();
Line 129... Line 129...
129
 		$aso_gestion['tps_w'] = $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravail();
129
 		$aso_gestion['tps_w'] = $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravailJour();
130
 
130
 
131
    	// Récupération des projets sur lesquels l'utilisateur travaille
131
    	// Récupération des projets sur lesquels l'utilisateur travaille
-
 
132
		$UtilsateurAProjet = new UtilisateurAProjet();
-
 
133
    	$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
-
 
134
		// Si nous avons des données...
-
 
135
		$aso_gestion['bool_projets'] = false;
132
		$UtilsateurAProjet = new UtilisateurAProjet();
136
    	if ($tab_uap && count($tab_uap) >= 1) {
133
    	$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
137
	    	$aso_gestion['bool_projets'] = true;
134
    	$tab_projet_id = array();
138
	    	$tab_projet_id = array();
135
    	foreach ($tab_uap as $uap) {
139
	    	foreach ($tab_uap as $uap) {
136
    		$tab_projet_id[] = $uap->getIdProjet();
140
	    		$tab_projet_id[] = $uap->getIdProjet();
137
    	}
141
	    	}
138
 
142
 
139
    	// Récupération du temps de travail pour un utilisateur à une date donnée
143
	    	// Récupération du temps de travail pour un utilisateur à une date donnée
140
    	$TravailProjet = new TravailProjet();
144
	    	$TravailProjet = new TravailProjet();
141
		$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN;
145
			$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN;
142
		$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_gestion['sj_1']['mysql'], $aso_gestion['sj_7']['mysql']);
146
			$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_gestion['sj_1']['mysql'], $aso_gestion['sj_7']['mysql']);
143
		$tab_tp = $TravailProjet->consulter($cmd, $param);
147
			$tab_tp = $TravailProjet->consulter($cmd, $param);
144
		if ($tab_tp && count($tab_tp) == 1) {
-
 
145
			$tab_tp = array($tab_tp);
-
 
146
		}
-
 
147
 
-
 
148
		// Récupération des infos sur les projets de l'utilisateur
-
 
149
    	$aso_gestion['totaux'] = $aso_tps_w_vide;
-
 
150
    	$Projet = new Projet();
-
 
151
    	$tab_p = $Projet->consulter(Projet::GP_ID_LIST, array(implode(',', $tab_projet_id)));
-
 
152
		foreach ($tab_p as $Projet) {
-
 
153
 
-
 
154
			// Récupération de la catégorie du projet
-
 
155
			$ProjetCategorie = new ProjetCategorie();
-
 
156
			$cmd = ProjetCategorie::GPC_ID;
-
 
157
			$param = $Projet->getCeCategorie();
-
 
158
			$Categorie = $ProjetCategorie->consulter($cmd, $param);
-
 
159
 
-
 
160
			// Nous vérifions le temps de travail pour ce projet pour la semaine courrante
-
 
161
			$aso_tps_w = $aso_tps_w_vide;
-
 
162
			if (!isset($aso_gestion['categorie_totaux'][$Categorie->getLibelle()])) {
148
			if ($tab_tp && count($tab_tp) == 1) {
-
 
149
				$tab_tp = array($tab_tp);
-
 
150
			}
-
 
151
 
-
 
152
			// Récupération des infos sur les projets de l'utilisateur
-
 
153
	    	$aso_gestion['totaux'] = $aso_tps_w_vide;
-
 
154
	    	$Projet = new Projet();
-
 
155
	    	$tab_p = $Projet->consulter(Projet::GP_ID_LIST, array(implode(',', $tab_projet_id)));
-
 
156
			foreach ($tab_p as $Projet) {
-
 
157
	
-
 
158
				// Récupération de la catégorie du projet
-
 
159
				$ProjetCategorie = new ProjetCategorie();
-
 
160
				$cmd = ProjetCategorie::GPC_ID;
-
 
161
				$param = $Projet->getCeCategorie();
-
 
162
				$Categorie = $ProjetCategorie->consulter($cmd, $param);
-
 
163
	
-
 
164
				// Nous vérifions le temps de travail pour ce projet pour la semaine courrante
-
 
165
				$aso_tps_w = $aso_tps_w_vide;
-
 
166
				if (!isset($aso_gestion['categorie_totaux'][$Categorie->getLibelle()])) {
163
				$aso_gestion['categorie_totaux'][$Categorie->getLibelle()] = $aso_tps_w_vide;
167
					$aso_gestion['categorie_totaux'][$Categorie->getLibelle()] = $aso_tps_w_vide;
164
			}
168
				}
165
			if ($tab_tp) {
169
				if ($tab_tp) {
166
				foreach ($tab_tp as $TP) {
170
					foreach ($tab_tp as $TP) {
167
					if ($TP->getIdProjet() == $Projet->getIdProjet()) {
171
						if ($TP->getIdProjet() == $Projet->getIdProjet()) {
168
						$num = $aso_jours[$TP->getIdDateTravail()];
172
							$num = $aso_jours[$TP->getIdDateTravail()];
169
						$aso_tps_w[$num] = $TP->getDuree();
173
							$aso_tps_w[$num] = $TP->getDuree();
-
 
174
							$aso_gestion['categorie_totaux'][$Categorie->getLibelle()][$num] += $TP->getDuree();
170
						$aso_gestion['categorie_totaux'][$Categorie->getLibelle()][$num] += $TP->getDuree();
175
							$aso_gestion['totaux'][$num] += $TP->getDuree();
171
						$aso_gestion['totaux'][$num] += $TP->getDuree();
176
						}
-
 
177
					}
-
 
178
				}
-
 
179
	
-
 
180
				// Stockage des infos nécessaire pour l'affichage
-
 
181
				$aso_gestion['preferences'][$Categorie->getLibelle()][] = array(
-
 
182
					'id' => $Projet->getIdProjet(),
-
 
183
					'valeur' => $Projet->getIdProjet(),
-
 
184
					'nom' => $Projet->getNomProjet(),
-
 
185
					'date' => $aso_tps_w);
172
					}
186
	
173
				}
-
 
174
			}
-
 
175
 
-
 
176
			// Stockage des infos nécessaire pour l'affichage
-
 
177
			$aso_gestion['preferences'][$Categorie->getLibelle()][] = array(
-
 
178
				'id' => $Projet->getIdProjet(),
-
 
179
				'valeur' => $Projet->getIdProjet(),
-
 
180
				'nom' => $Projet->getNomProjet(),
-
 
181
				'date' => $aso_tps_w);
-
 
182
 
187
	
183
 
188
			}
184
		}
189
		}
185
		//+-------------------------------------------------------------------------------------------------+
190
		//+-------------------------------------------------------------------------------------------------+
186
		// GESTION DES ABSENCES
191
		// GESTION DES ABSENCES
Line 196... Line 201...
196
		// Récupération des absences pour un utilisateur à une date donnée
201
		// Récupération des absences pour un utilisateur à une date donnée
197
    	$Absence = new Absence();
202
    	$Absence = new Absence();
198
		$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN;
203
		$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN;
199
		$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_gestion['sj_1']['mysql'], $aso_gestion['sj_7']['mysql']);
204
		$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_gestion['sj_1']['mysql'], $aso_gestion['sj_7']['mysql']);
200
		$tab_a = $Absence->consulter($cmd, $param);
205
		$tab_a = $Absence->consulter($cmd, $param);
-
 
206
		// Si nous avons des absences...
201
		if ($tab_a && count($tab_a) == 1) {
207
		if ($tab_a && count($tab_a) == 1) {
202
			$tab_a = array($tab_a);
208
			$tab_a = array($tab_a);
203
		}
209
		}
204
 
-
 
205
		$aso_gestion['ab_total'] = $aso_tps_w_vide;
210
		$aso_gestion['ab_total'] = $aso_tps_w_vide;
206
		if ($tab_am) {
211
		if ($tab_am) {
207
			foreach ($tab_am as $AM) {
212
			foreach ($tab_am as $AM) {
208
				$aso_gestion['ab_libelle'][$AM->getIdAbsenceMotif()] = $AM->getLibelle();
213
				$aso_gestion['ab_libelle'][$AM->getIdAbsenceMotif()] = $AM->getLibelle();
209
				$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = $aso_tps_w_vide;
214
				$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = $aso_tps_w_vide;
Line 217... Line 222...
217
						}
222
						}
218
					}
223
					}
219
				}
224
				}
220
			}
225
			}
221
		}
226
		}
222
 
227
		
223
		// Création de l'url de réponse du formulaire
228
		// Création de l'url de réponse du formulaire
224
		$aso_gestion['url_gestion_valider'] = 'index.php?action='.GTT_ACTION_GESTION_VALIDER.$url_sc_param_date;
229
		$aso_gestion['url_gestion_valider'] = 'index.php?action='.GTT_ACTION_GESTION_VALIDER.$url_sc_param_date;
Line 225... Line 230...
225
 
230
 
226
    	//echo '<pre>ici '.print_r($aso_gestion['ab'], true).'la</pre>';
231
    	//echo '<pre>ici '.print_r($aso_gestion['ab'], true).'la</pre>';
Line 240... Line 245...
240
		$Week = new Calendar_Week($_GET['annee'], $_GET['mois'], $_GET['jour']);
245
		$Week = new Calendar_Week($_GET['annee'], $_GET['mois'], $_GET['jour']);
241
		$Week->build();
246
		$Week->build();
242
		$aso_jours = array();
247
		$aso_jours = array();
243
		$aso_semaine = array();
248
		$aso_semaine = array();
244
		foreach($Week->fetchAll() as $num => $j) {
249
		foreach($Week->fetchAll() as $num => $j) {
245
			$aso_semaine[$num]['mysql'] = $j->thisYear().'-'.sprintf("%02s", $j->thisMonth()).'-'.$j->thisDay();
250
			$aso_semaine[$num]['mysql'] = $j->thisYear().'-'.sprintf("%02s", $j->thisMonth()).'-'.sprintf("%02s", $j->thisDay());
246
			$aso_jours[$aso_semaine[$num]['mysql']] = $num;
251
			$aso_jours[$aso_semaine[$num]['mysql']] = $num;
247
		}
252
		}
Line 248... Line 253...
248
 
253
 
249
		// Récupération du temps de travail pour un utilisateur à une date donnée
254
		// Récupération du temps de travail pour un utilisateur à une date donnée