Line 7... |
Line 7... |
7 |
require_once GTT_CHEMIN_PEAR.'Calendar/Week.php';
|
7 |
require_once GTT_CHEMIN_PEAR.'Calendar/Week.php';
|
8 |
require_once GTT_CHEMIN_PEAR.'Calendar/Day.php';
|
8 |
require_once GTT_CHEMIN_PEAR.'Calendar/Day.php';
|
Line 9... |
Line 9... |
9 |
|
9 |
|
10 |
require_once GTT_CHEMIN_METIER.'Projet.class.php';
|
10 |
require_once GTT_CHEMIN_METIER.'Projet.class.php';
|
- |
|
11 |
require_once GTT_CHEMIN_METIER.'TravailProjet.class.php';
|
- |
|
12 |
require_once GTT_CHEMIN_METIER.'Absence.class.php';
|
11 |
require_once GTT_CHEMIN_METIER.'TravailProjet.class.php';
|
13 |
require_once GTT_CHEMIN_METIER.'AbsenceMotif.class.php';
|
12 |
require_once GTT_CHEMIN_METIER.'ProjetCategorie.class.php';
|
14 |
require_once GTT_CHEMIN_METIER.'ProjetCategorie.class.php';
|
13 |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
|
15 |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
|
Line 14... |
Line 16... |
14 |
require_once GTT_CHEMIN_METIER.'UtilisateurAProjet.class.php';
|
16 |
require_once GTT_CHEMIN_METIER.'UtilisateurAProjet.class.php';
|
Line 22... |
Line 24... |
22 |
// TODO : gérer les actions chainées provenant d'un autre ControlleurAction
|
24 |
// TODO : gérer les actions chainées provenant d'un autre ControlleurAction
|
23 |
$GttCtrlActionIdentification = new GttCtrlActionIdentification($this->getRegistre());
|
25 |
$GttCtrlActionIdentification = new GttCtrlActionIdentification($this->getRegistre());
|
24 |
$GttCtrlActionIdentification->setSuivant('__defaut__');
|
26 |
$GttCtrlActionIdentification->setSuivant('__defaut__');
|
25 |
$this->setSuivant($GttCtrlActionIdentification);
|
27 |
$this->setSuivant($GttCtrlActionIdentification);
|
26 |
}
|
28 |
}
|
27 |
|
29 |
|
28 |
public function executer()
|
30 |
public function executer()
|
29 |
{
|
31 |
{
|
30 |
$aso_gestion = array();
|
32 |
$aso_gestion = array();
|
31 |
$this->getRegistre()->setTitre('Gérer son temps');
|
33 |
$this->getRegistre()->setTitre('Gérer son temps');
|
Line 52... |
Line 54... |
52 |
|
54 |
|
53 |
// Create an array of days which are "selected"
|
55 |
// Create an array of days which are "selected"
|
54 |
// Used for Week::build() below
|
56 |
// Used for Week::build() below
|
55 |
$CalendrierJourCourrant = new Calendar_Week(date('Y'), date('m'), date('d'));
|
57 |
$CalendrierJourCourrant = new Calendar_Week(date('Y'), date('m'), date('d'));
|
56 |
$aso_gestion['jc']['jour'] = $CalendrierJourCourrant->thisDay();
|
58 |
$aso_gestion['jc']['jour'] = $CalendrierJourCourrant->thisDay();
|
57 |
$aso_gestion['jc']['semaine'] = $CalendrierJourCourrant->thisWeek('n_in_year');
|
59 |
$aso_gestion['jc']['semaine'] = $CalendrierJourCourrant->thisWeek('n_in_year');
|
58 |
$aso_gestion['jc']['mois'] = $CalendrierJourCourrant->thisMonth();
|
60 |
$aso_gestion['jc']['mois'] = $CalendrierJourCourrant->thisMonth();
|
59 |
$aso_gestion['jc']['mois_nom'] = $Calendrier->getNomMois($CalendrierJourCourrant->thisMonth());
|
61 |
$aso_gestion['jc']['mois_nom'] = $Calendrier->getNomMois($CalendrierJourCourrant->thisMonth());
|
60 |
$aso_gestion['jc']['annee'] = $CalendrierJourCourrant->thisYear();
|
62 |
$aso_gestion['jc']['annee'] = $CalendrierJourCourrant->thisYear();
|
61 |
$aso_gestion['jc_url'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$aso_gestion['jc']['annee'].'&mois='.$aso_gestion['jc']['mois'].'&semaine='.$aso_gestion['jc']['semaine'].'&jour='.$aso_gestion['jc']['jour'];
|
63 |
$aso_gestion['jc_url'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$aso_gestion['jc']['annee'].'&mois='.$aso_gestion['jc']['mois'].'&semaine='.$aso_gestion['jc']['semaine'].'&jour='.$aso_gestion['jc']['jour'];
|
62 |
|
64 |
|
63 |
$CalendrierJourCourrant->build();
|
65 |
$CalendrierJourCourrant->build();
|
64 |
$CalendrierSemaineCourrante = $CalendrierJourCourrant->thisWeek('object');
|
66 |
$CalendrierSemaineCourrante = $CalendrierJourCourrant->thisWeek('object');
|
65 |
$CalendrierSemaineCourrante->build();
|
67 |
$CalendrierSemaineCourrante->build();
|
66 |
$tab_jours = $CalendrierSemaineCourrante->fetchAll();
|
68 |
$tab_jours = $CalendrierSemaineCourrante->fetchAll();
|
67 |
$aso_gestion['sjc_1']['jour'] = $tab_jours[1]->thisDay();
|
69 |
$aso_gestion['sjc_1']['jour'] = $tab_jours[1]->thisDay();
|
68 |
$aso_gestion['sjc_1']['mois'] = $Calendrier->getNomMois($tab_jours[1]->thisMonth());
|
70 |
$aso_gestion['sjc_1']['mois'] = $Calendrier->getNomMois($tab_jours[1]->thisMonth());
|
69 |
$aso_gestion['sjc_1']['annee'] = $tab_jours[1]->thisYear();
|
71 |
$aso_gestion['sjc_1']['annee'] = $tab_jours[1]->thisYear();
|
70 |
$aso_gestion['sjc_7']['jour'] = $tab_jours[7]->thisDay();
|
72 |
$aso_gestion['sjc_7']['jour'] = $tab_jours[7]->thisDay();
|
71 |
$aso_gestion['sjc_7']['mois'] = $Calendrier->getNomMois($tab_jours[7]->thisMonth());
|
73 |
$aso_gestion['sjc_7']['mois'] = $Calendrier->getNomMois($tab_jours[7]->thisMonth());
|
72 |
$aso_gestion['sjc_7']['annee'] = $tab_jours[7]->thisYear();
|
74 |
$aso_gestion['sjc_7']['annee'] = $tab_jours[7]->thisYear();
|
73 |
|
75 |
|
74 |
$aso_gestion['selectedDays'] = array ($CalendrierJourCourrant);
|
76 |
$aso_gestion['selectedDays'] = array ($CalendrierJourCourrant);
|
75 |
|
77 |
|
76 |
// Instruct month to build Week objects
|
78 |
// Instruct month to build Week objects
|
77 |
// Construction de l'objet mois
|
79 |
// Construction de l'objet mois
|
78 |
$Month = new Calendar_Month_Weeks($_GET['annee'], $_GET['mois']);
|
80 |
$Month = new Calendar_Month_Weeks($_GET['annee'], $_GET['mois']);
|
79 |
$Month->build();
|
81 |
$Month->build();
|
80 |
|
82 |
|
81 |
while ($Week = $Month->fetch()) {
|
83 |
while ($Week = $Month->fetch()) {
|
82 |
$Week->build($aso_gestion['selectedDays']);
|
84 |
$Week->build($aso_gestion['selectedDays']);
|
83 |
//echo '<pre>'.print_r($Month, true).'</pre>';
|
85 |
//echo '<pre>'.print_r($Month, true).'</pre>';
|
84 |
$tab_semaine_jours = $Week->fetchAll();
|
86 |
$tab_semaine_jours = $Week->fetchAll();
|
Line 103... |
Line 105... |
103 |
}
|
105 |
}
|
104 |
}
|
106 |
}
|
105 |
$aso_gestion['elements'][$Week->thisWeek('n_in_year')][$num] = $element;
|
107 |
$aso_gestion['elements'][$Week->thisWeek('n_in_year')][$num] = $element;
|
106 |
}
|
108 |
}
|
107 |
}
|
109 |
}
|
108 |
|
110 |
|
109 |
// Construction de l'url pour les mois précédent/suivant
|
111 |
// Construction de l'url pour les mois précédent/suivant
|
110 |
$PMonth = $Month->prevMonth('object');
|
112 |
$PMonth = $Month->prevMonth('object');
|
111 |
$aso_gestion['url_mois_precedent'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$PMonth->thisYear().'&mois='.$PMonth->thisMonth().'&jour='.$PMonth->thisDay();
|
113 |
$aso_gestion['url_mois_precedent'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$PMonth->thisYear().'&mois='.$PMonth->thisMonth().'&jour='.$PMonth->thisDay();
|
112 |
$NMonth = $Month->nextMonth('object');
|
114 |
$NMonth = $Month->nextMonth('object');
|
113 |
$aso_gestion['url_mois_suivant'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$NMonth->thisYear().'&mois='.$NMonth->thisMonth().'&jour='.$NMonth->thisDay();
|
115 |
$aso_gestion['url_mois_suivant'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$NMonth->thisYear().'&mois='.$NMonth->thisMonth().'&jour='.$NMonth->thisDay();
|
114 |
$aso_gestion['mois']['mois'] = $Calendrier->getNomMois($Month->thisMonth());
|
116 |
$aso_gestion['mois']['mois'] = $Calendrier->getNomMois($Month->thisMonth());
|
115 |
$aso_gestion['mois']['annee'] = $Month->thisYear();
|
117 |
$aso_gestion['mois']['annee'] = $Month->thisYear();
|
116 |
|
118 |
|
117 |
// Construction de l'url pour les semaines précédente/suivante
|
119 |
// Construction de l'url pour les semaines précédente/suivante
|
118 |
$Week = new Calendar_Week($_GET['annee'], $_GET['mois'], $_GET['jour']);
|
120 |
$Week = new Calendar_Week($_GET['annee'], $_GET['mois'], $_GET['jour']);
|
119 |
$aso_gestion['s'] = $Week->thisWeek('n_in_year');
|
121 |
$aso_gestion['s'] = $Week->thisWeek('n_in_year');
|
120 |
|
122 |
|
121 |
$PWeek = $Week->prevWeek('object');
|
123 |
$PWeek = $Week->prevWeek('object');
|
122 |
$aso_gestion['url_semaine_precedente'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$PWeek->thisYear().'&mois='.$PWeek->thisMonth().'&jour='.$PWeek->thisDay();
|
124 |
$aso_gestion['url_semaine_precedente'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$PWeek->thisYear().'&mois='.$PWeek->thisMonth().'&jour='.$PWeek->thisDay();
|
123 |
|
125 |
|
124 |
$url_sc_param_date = '&annee='.$Week->thisYear().'&mois='.$Week->thisMonth().'&jour='.$Week->thisDay();
|
126 |
$url_sc_param_date = '&annee='.$Week->thisYear().'&mois='.$Week->thisMonth().'&jour='.$Week->thisDay();
|
125 |
$aso_gestion['url_semaine_courante'] = 'index.php?action='.GTT_ACTION_GESTION.$url_sc_param_date;
|
127 |
$aso_gestion['url_semaine_courante'] = 'index.php?action='.GTT_ACTION_GESTION.$url_sc_param_date;
|
126 |
|
128 |
|
127 |
$NWeek = $Week->nextWeek('object');
|
129 |
$NWeek = $Week->nextWeek('object');
|
128 |
$aso_gestion['url_semaine_suivante'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$NWeek->thisYear().'&mois='.$NWeek->thisMonth().'&jour='.$NWeek->thisDay();
|
130 |
$aso_gestion['url_semaine_suivante'] = 'index.php?action='.GTT_ACTION_GESTION.'&annee='.$NWeek->thisYear().'&mois='.$NWeek->thisMonth().'&jour='.$NWeek->thisDay();
|
129 |
|
131 |
|
130 |
$Week->build();
|
132 |
$Week->build();
|
131 |
$aso_jours = array();
|
133 |
$aso_jours = array();
|
132 |
foreach($Week->fetchAll() as $num => $j) {
|
134 |
foreach($Week->fetchAll() as $num => $j) {
|
133 |
$aso_gestion['sj_'.$num]['jour'] = $j->thisDay();
|
135 |
$aso_gestion['sj_'.$num]['jour'] = $j->thisDay();
|
134 |
$aso_gestion['sj_'.$num]['mois'] = $Calendrier->getNomMois($j->thisMonth());
|
136 |
$aso_gestion['sj_'.$num]['mois'] = $Calendrier->getNomMois($j->thisMonth());
|
135 |
$aso_gestion['sj_'.$num]['annee'] = $j->thisYear();
|
137 |
$aso_gestion['sj_'.$num]['annee'] = $j->thisYear();
|
136 |
$aso_gestion['sj_'.$num]['mysql'] = $aso_gestion['sj_'.$num]['annee'].'-'.sprintf("%02s", $j->thisMonth()).'-'.$aso_gestion['sj_'.$num]['jour'];
|
138 |
$aso_gestion['sj_'.$num]['mysql'] = $aso_gestion['sj_'.$num]['annee'].'-'.sprintf("%02s", $j->thisMonth()).'-'.$aso_gestion['sj_'.$num]['jour'];
|
137 |
$aso_jours[$aso_gestion['sj_'.$num]['mysql']] = $num;
|
139 |
$aso_jours[$aso_gestion['sj_'.$num]['mysql']] = $num;
|
138 |
$aso_tps_w_vide[$num] = '';
|
140 |
$aso_tps_w_vide[$num] = '';
|
139 |
}
|
141 |
}
|
140 |
|
142 |
|
141 |
//+-------------------------------------------------------------------------------------------------+
|
143 |
//+-------------------------------------------------------------------------------------------------+
|
142 |
// GESTION DES PROJETS
|
144 |
// GESTION DES PROJETS
|
143 |
//+-------------------------------------------------------------------------------------------------+
|
145 |
//+-------------------------------------------------------------------------------------------------+
|
144 |
// Récupération des infos sur l'utilisateur
|
146 |
// Récupération des infos sur l'utilisateur
|
145 |
$aso_gestion['conges_payes'] = $GLOBALS['_GTT_']['Utilisateur']->getCongesPayes();
|
147 |
$aso_gestion['conges_payes'] = $GLOBALS['_GTT_']['Utilisateur']->getCongesPayes();
|
146 |
$aso_gestion['rtt'] = $GLOBALS['_GTT_']['Utilisateur']->getQuotaHeuresSupp();
|
148 |
$aso_gestion['rtt'] = $GLOBALS['_GTT_']['Utilisateur']->getQuotaHeuresSupp();
|
147 |
$aso_gestion['tps_w'] = $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravail();
|
149 |
$aso_gestion['tps_w'] = $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravail();
|
148 |
|
150 |
|
149 |
// Récupération des projets sur lesquels l'utilisateur travaille
|
151 |
// Récupération des projets sur lesquels l'utilisateur travaille
|
150 |
$UtilsateurAProjet = new UtilisateurAProjet();
|
152 |
$UtilsateurAProjet = new UtilisateurAProjet();
|
151 |
$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
|
153 |
$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
|
152 |
$tab_projet_id = array();
|
154 |
$tab_projet_id = array();
|
153 |
foreach ($tab_uap as $uap) {
|
155 |
foreach ($tab_uap as $uap) {
|
Line 161... |
Line 163... |
161 |
$tab_tp = $TravailProjet->consulter($cmd, $param);
|
163 |
$tab_tp = $TravailProjet->consulter($cmd, $param);
|
162 |
if ($tab_tp && count($tab_tp) == 1) {
|
164 |
if ($tab_tp && count($tab_tp) == 1) {
|
163 |
$tab_tp = array($tab_tp);
|
165 |
$tab_tp = array($tab_tp);
|
164 |
}
|
166 |
}
|
Line 165... |
Line 167... |
165 |
|
167 |
|
- |
|
168 |
// Récupération des infos sur les projets de l'utilisateur
|
166 |
// Récupération des infos sur les projets de l'utilisateur
|
169 |
$aso_gestion['totaux'] = $aso_tps_w_vide;
|
167 |
$Projet = new Projet();
|
170 |
$Projet = new Projet();
|
168 |
$tab_p = $Projet->consulter(Projet::GP_ID_LIST, array(implode(',', $tab_projet_id)));
|
171 |
$tab_p = $Projet->consulter(Projet::GP_ID_LIST, array(implode(',', $tab_projet_id)));
|
Line 169... |
Line 172... |
169 |
foreach ($tab_p as $Projet) {
|
172 |
foreach ($tab_p as $Projet) {
|
170 |
|
173 |
|
171 |
// Récupération de la catégorie du projet
|
174 |
// Récupération de la catégorie du projet
|
172 |
$ProjetCategorie = new ProjetCategorie();
|
175 |
$ProjetCategorie = new ProjetCategorie();
|
173 |
$cmd = ProjetCategorie::GPC_ID;
|
176 |
$cmd = ProjetCategorie::GPC_ID;
|
174 |
$param = $Projet->getCeCategorie();
|
177 |
$param = $Projet->getCeCategorie();
|
175 |
$Categorie = $ProjetCategorie->consulter($cmd, $param);
|
178 |
$Categorie = $ProjetCategorie->consulter($cmd, $param);
|
176 |
|
179 |
|
- |
|
180 |
// Nous vérifions le temps de travail pour ce projet pour la semaine courrante
|
- |
|
181 |
$aso_tps_w = $aso_tps_w_vide;
|
- |
|
182 |
if (!isset($aso_gestion['categorie_totaux'][$Categorie->getLibelle()])) {
|
177 |
// Nous vérifions le temps de travail pour ce projet pour la semaine courrante
|
183 |
$aso_gestion['categorie_totaux'][$Categorie->getLibelle()] = $aso_tps_w_vide;
|
178 |
$aso_tps_w = $aso_tps_w_vide;
|
184 |
}
|
179 |
if ($tab_tp) {
|
185 |
if ($tab_tp) {
|
180 |
foreach ($tab_tp as $TP) {
|
186 |
foreach ($tab_tp as $TP) {
|
- |
|
187 |
if ($TP->getIdProjet() == $Projet->getIdProjet()) {
|
- |
|
188 |
$num = $aso_jours[$TP->getIdDateTravail()];
|
- |
|
189 |
$aso_tps_w[$num] = $TP->getDuree();
|
181 |
if ($TP->getIdProjet() == $Projet->getIdProjet()) {
|
190 |
$aso_gestion['categorie_totaux'][$Categorie->getLibelle()][$num] += $TP->getDuree();
|
182 |
$aso_tps_w[$aso_jours[$TP->getIdDateTravail()]] = $TP->getDuree();
|
191 |
$aso_gestion['totaux'][$num] += $TP->getDuree();
|
183 |
}
|
192 |
}
|
184 |
}
|
193 |
}
|
185 |
}
|
194 |
}
|
186 |
|
195 |
|
187 |
// Stockage des infos nécessaire pour l'affichage
|
196 |
// Stockage des infos nécessaire pour l'affichage
|
188 |
$aso_gestion['preferences'][$Categorie->getLibelle()][] = array(
|
197 |
$aso_gestion['preferences'][$Categorie->getLibelle()][] = array(
|
189 |
'id' => $Projet->getIdProjet(),
|
198 |
'id' => $Projet->getIdProjet(),
|
190 |
'valeur' => $Projet->getIdProjet(),
|
199 |
'valeur' => $Projet->getIdProjet(),
|
- |
|
200 |
'nom' => $Projet->getNomProjet(),
|
191 |
'nom' => $Projet->getNomProjet(),
|
201 |
'date' => $aso_tps_w);
|
192 |
'date' => $aso_tps_w);
|
202 |
|
- |
|
203 |
|
- |
|
204 |
}
|
- |
|
205 |
//+-------------------------------------------------------------------------------------------------+
|
- |
|
206 |
// GESTION DES ABSENCES
|
- |
|
207 |
//+-------------------------------------------------------------------------------------------------+
|
- |
|
208 |
// Récupération des absences pour un utilisateur à une date donnée
|
- |
|
209 |
$Absence = new Absence();
|
- |
|
210 |
$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN;
|
- |
|
211 |
$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_gestion['sj_1']['mysql'], $aso_gestion['sj_7']['mysql']);
|
- |
|
212 |
$tab_a = $Absence->consulter($cmd, $param);
|
- |
|
213 |
if ($tab_a && count($tab_a) == 1) {
|
- |
|
214 |
$tab_a = array($tab_a);
|
- |
|
215 |
}
|
- |
|
216 |
$aso_gestion['cp'] = $aso_tps_w_vide;
|
- |
|
217 |
$aso_gestion['rtt'] = $aso_tps_w_vide;
|
- |
|
218 |
if ($tab_a) {
|
- |
|
219 |
foreach ($tab_a as $A) {
|
- |
|
220 |
$num = $aso_jours[$A->getIdDateAbsence()];
|
- |
|
221 |
switch ($A->getIdAbsenceMotif()) {
|
- |
|
222 |
case GTT_ABSCENCE_ID_CP :
|
- |
|
223 |
$aso_gestion['cp'][$num] = $A->getDuree();
|
- |
|
224 |
break;
|
- |
|
225 |
case GTT_ABSCENCE_ID_RTT :
|
- |
|
226 |
$aso_gestion['rtt'][$num] = $A->getDuree();
|
- |
|
227 |
break;
|
- |
|
228 |
}
|
- |
|
229 |
}
|
193 |
|
230 |
}
|
194 |
}
|
231 |
|
195 |
// Création de l'url de réponse du formulaire
|
232 |
// Création de l'url de réponse du formulaire
|
196 |
$aso_gestion['url_gestion_valider'] = 'index.php?action='.GTT_ACTION_GESTION_VALIDER.$url_sc_param_date;
|
233 |
$aso_gestion['url_gestion_valider'] = 'index.php?action='.GTT_ACTION_GESTION_VALIDER.$url_sc_param_date;
|
197 |
|
234 |
|
198 |
//echo '<pre>'.print_r($aso_gestion, true).'</pre>';
|
235 |
//echo '<pre>'.print_r($aso_gestion, true).'</pre>';
|
199 |
$this->getRegistre()->ajouterDonnee('gestion', $aso_gestion);
|
236 |
$this->getRegistre()->ajouterDonnee('gestion', $aso_gestion);
|
- |
|
237 |
}
|
- |
|
238 |
|
- |
|
239 |
public function verifierValider()
|
- |
|
240 |
{
|
- |
|
241 |
|
200 |
}
|
242 |
}
|
201 |
|
243 |
|
202 |
public function executerValider()
|
244 |
public function executerValider()
|
- |
|
245 |
{
|
- |
|
246 |
//echo '<pre>'.print_r($_POST, true).'</pre>';
|
- |
|
247 |
|
- |
|
248 |
// Récupération des info sur la semaine courrante
|
- |
|
249 |
$Week = new Calendar_Week($_GET['annee'], $_GET['mois'], $_GET['jour']);
|
- |
|
250 |
$Week->build();
|
- |
|
251 |
$aso_jours = array();
|
- |
|
252 |
$aso_semaine = array();
|
- |
|
253 |
foreach($Week->fetchAll() as $num => $j) {
|
- |
|
254 |
$aso_semaine[$num]['mysql'] = $j->thisYear().'-'.sprintf("%02s", $j->thisMonth()).'-'.$j->thisDay();
|
- |
|
255 |
$aso_jours[$aso_semaine[$num]['mysql']] = $num;
|
- |
|
256 |
}
|
- |
|
257 |
|
- |
|
258 |
// Récupération du temps de travail pour un utilisateur à une date donnée
|
- |
|
259 |
$TravailProjet = new TravailProjet();
|
- |
|
260 |
$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN;
|
- |
|
261 |
$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_semaine[1]['mysql'], $aso_semaine[7]['mysql']);
|
- |
|
262 |
$tab_tp = $TravailProjet->consulter($cmd, $param);
|
- |
|
263 |
if ($tab_tp && count($tab_tp) == 1) {
|
- |
|
264 |
$tab_tp = array($tab_tp);
|
- |
|
265 |
}
|
- |
|
266 |
|
- |
|
267 |
foreach($_POST['pr'] as $projet_id => $jours) {
|
- |
|
268 |
//echo '<pre>'.print_r($jours, true).'</pre>';
|
- |
|
269 |
foreach($jours as $jour_num => $nbr_heure) {
|
- |
|
270 |
$bool_ajouter = true;
|
- |
|
271 |
foreach ($tab_tp as $TP) {
|
- |
|
272 |
if ($TP->getIdDateTravail() == $aso_semaine[$jour_num]['mysql']) {
|
- |
|
273 |
if ($TP->getIdProjet() == $projet_id) {
|
- |
|
274 |
$bool_ajouter = false;
|
- |
|
275 |
if ($TP->getDuree() != $nbr_heure && $TP->getIdProjet() == $projet_id) {
|
- |
|
276 |
if (empty($nbr_heure)) {
|
- |
|
277 |
$TP->supprimer();
|
- |
|
278 |
} else {
|
- |
|
279 |
$TP->setDuree($nbr_heure);
|
- |
|
280 |
$TP->modifier();
|
- |
|
281 |
}
|
- |
|
282 |
}
|
- |
|
283 |
}
|
- |
|
284 |
}
|
- |
|
285 |
}
|
- |
|
286 |
if ($bool_ajouter && !empty($nbr_heure)) {
|
- |
|
287 |
$TP = new TravailProjet();
|
- |
|
288 |
$TP->setDuree((float)$nbr_heure);
|
- |
|
289 |
$TP->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
|
- |
|
290 |
$TP->setIdProjet($projet_id);
|
- |
|
291 |
$TP->setIdDateTravail((string)$aso_semaine[$jour_num]['mysql']);
|
- |
|
292 |
$TP->ajouter();
|
- |
|
293 |
}
|
203 |
{
|
294 |
}
|
204 |
//echo '<pre>'.print_r($_POST, true).'</pre>';
|
295 |
}
|
205 |
|
296 |
|
206 |
// Action suivante
|
297 |
// Action suivante
|
207 |
$this->setSuivant('__defaut__');
|
298 |
$this->setSuivant('__defaut__');
|
208 |
}
|
299 |
}
|
209 |
}
|
300 |
}
|