/
projets.php
264 lines (219 loc) · 8.62 KB
/
projets.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<?php
session_start();
/*==========================================================================
« projets.php »
Application : permet la gestion des projets
Programme fait par Pierre Lavigne dernière mise à jour : 2014-06-09
Tables utilisées : pjs
Fichiers texte utilisés : aucun
============================================================================
*/
error_reporting(0);
require_once("../../utilitaires/defini.php");
require_once("../../utilitaires/BD.class.php");
require_once("../../utilitaires/Table.php");
require_once("../../utilitaires/Formulaire.class.php");
require_once("../pvi_fonctions.php");
require_once("projet.class.php");
require_once("budget_fonctions.php");
require_once("../../utilitaires/session.php");
require_once("../pvi_param.php");
$css = "../css/formulaire.css";
$bd = NEW BD(USAGER, PASSE, BASE, SERVEUR);
$appli = "gfin";
$session = ControleAcces (SITE . "projets.php", $_REQUEST, session_id(), $bd, $appli, $operation, $css);
if(!$session) exit();
AutosProjets($bd);
//******************** principal ********************************
foreach($_REQUEST as $key=>$value) {
$$key = stripslashes($value);
}
if (!isset($operation)) $operation = "";
$listeProjets = ComboProjets($bd);
$listeUsagers = ComboUsagers($bd);
$listeUsagersEmail = ComboUsagersEmail($bd);
$gesAcces = array(1, 33); // 1=Pierre Lavigne 33= Charles Cormier
if(!in_array($_SESSION['usager_id'], $gesAcces)) {
$operation = "Vous n'avez pas l'autorisation de modifier les projets et les comptes";
$url="Location: budgets.php?action=xxx&operation=$operation";
header($url);
exit();
}
/*
if($_SESSION['motDePasse'] != "bcpmaj24") {
if(trim($mdp) != "") {
if($mdp == "bcpmaj24") $_SESSION['motDePasse'] = "bcpmaj24";
$url = "Location:projets.php";
header($url);
exit();
} else {
if($_SESSION['motDePasse'] != "bcpmaj24") Verif_mdp("projets");
}
}
*/
//$_SESSION['dateRapport'] = $dateRapport;
switch ($action) {
/*
case "maj_passe" :
if($mdp == "bcpmaj24") {
$_SESSION['TRUE'];
}
$url = "Location:budgets.php";
header($url);
exit();
break;
*/
/*
case "" :
case "xxx" :
print(Html3("haut", "Gestion des projets", $css));
Print(Menu_budget("cp"));
if(strstr($operation, "!")) print(Imprime_operation3($operation));
print('<table align="center" bgcolor="#EBEBEB"><tr><td>' . "\n");
print("<br />");
print(Imprime_titreListe("<b>Gestion des projets</b>", "titre"));
print("<br />");
$f = new Formulaire ("POST", "projets.php");
$f->debutTable(HORIZONTAL);
$f->champListe("chosir un projet de la liste", pj_id, $pj_id, 1, $listeProjets);
$f->champValider ("modifier", "action");
$f->champValider ("detruire", "action");
$f->champCache("pj_id", $pj_id);
$f->finTable();
$f->fin();
print('</td></tr></table>');
print("<br />");
print('<table align="center" bgcolor="#EBEBEB"><tr><td>' . "\n");
$f = new Formulaire ("POST", "projets.php");
$f->debutTable(HORIZONTAL);
$f->champValider ("ajouter-un-nouveau-projet", "action");
$f->finTable();
$f->fin();
print("<br />");
print('</td></tr></table>');
//if($_SESSION['usager_id'] == 1) Print_rhtml($_SESSION);
print(Html3("bas"));
break;
*/
case "" :
case "xxx" :
$w1 = "7%";
$w2 = "40%";
$w3 = "28%";
$w4 = "10%";
$w5 = "15%";
$listeAcces[0] = "non";
$listeAcces[1] = '<span class="fsXL fwB">oui</span>';
print(Html3("haut", "Gestion des projets", $css));
Print(Menu_budget("cp"));
if(strstr($operation, "!")) print(Imprime_operation3($operation));
print('<div align="center" class="projets">' . "\n");
print('<table width="800" border="1" cellspacing="0" cellpadding="5">' . "\n");
print('<caption class="fwB ls2 fs16">Gestion des projets</caption>');
$requete = "SELECT * FROM pjs"
. " WHERE 1 "
. "ORDER BY pj_no ";
$resultat = $bd->execRequete($requete);
$nb = 0;
print(' <tr bgcolor="#ebebeb">'. "\n");
print(' <th width="' . $w1 . '">no</th>' . "\n");
print(' <th width="' . $w2 . '">nom du projet (<a href="projets.php?action=ajouter-un-nouveau-projet">ajouter-projet</a>)</th>' . "\n");
print(' <th width="' . $w3 . '">responsable du projet</th>' . "\n");
print(' <th width="' . $w4 . '">peut<br />éditer ?</th>' . "\n");
print(' <th width="' . $w5 . '">action</th>' . "\n");
print(' </tr>' . "\n");
while($unProjet = $bd->objetSuivant($resultat)) {
//$nb++;
$usager_id = $unProjet->usager_id;
$acces = $unProjet->pj_acces;
//$couleur = ($nb % 2 == 0) ? "#ebebeb" : "ffffff";
$couleur = "";
$nomProjet = trim($unProjet->pj_nom);
$noProjet = trim($unProjet->pj_no);
//print("---$noProjet---<br />");
if(substr($noProjet, 1, 2) == "00") {
$nomProjet = $nomProjet;
$classe = "projetDomaine";
} else {
if(substr($noProjet, 2, 1) == "0") {
$nomProjet = ' ' . $nomProjet;
$classe = "projetSection";
} else {
$nomProjet = " " . $nomProjet;
$classe = "";
}
}
if(substr($noProjet, 1, 2) == "00") $nomProjet = '<span class="fem11">' . $nomProjet . '</span>';
if(substr($noProjet, 2, 1) == "0") $nomProjet = '<span class="fem08">' . $nomProjet . '</span>';
print(' <tr bgcolor="' . $couleur . '">'. "\n");
print(' <td width="' . $w1 . '" class="' . $classe . " taC" . '">' . $noProjet . '</td>' . "\n");
print(' <td width="' . $w2 . '" class="' . $classe . '">' . $nomProjet . '</td>' . "\n");
print(' <td width="' . $w3 . '" class="' . $classe . '"><a href="mailto:' . $listeUsagersEmail[$unProjet->usager_id] . '" style="color:blue;">' . $listeUsagers[$unProjet->usager_id]. '</a></td>' . "\n");
if($classe != "projetDomaine" AND $classe != "projetSection") {
print(' <td width="' . $w4 . '" class="' . $classe . " taC" . '">' . $listeAcces[$acces] . '</td>' . "\n");
print(' <td width="' . $w5 . '" class="' . $classe . " taC" . '"><a href="projets.php?action=modifier&pj_id=' . $unProjet->pj_id . '" style="color:blue;">modifier</a> <a href="projets.php?action=detruire&pj_id=' . $unProjet->pj_id . '" style="color:blue;">ôter</a>' . '</td>' . "\n");
} else {
print(' <td width="' . $w4 . '" class="' . $classe . '"> </td>' . "\n");
print(' <td width="' . $w5 . '" class="' . $classe . " taC" . '"><span class="fs10 ls0 fwN"><a href="projets.php?action=modifier&pj_id=' . $unProjet->pj_id . '" style="color:blue;">modifier</a> <a href="projets.php?action=detruire&pj_id=' . $unProjet->pj_id . '" style="color:blue;">ôter</a>' . '</span></td>' . "\n");
}
print(' </tr>' . "\n");
}
print('</table>'. "\n");
print('</div>' . "\n");
break;
case "ajouter-un-nouveau-projet" :
$projet = NEW PJ("pjs");
print(Html3("haut", "Ajouter projet", $css));
print("<br />");
$projet->Imprimer_form("projets", $css, $listeUsagers);
print(Html3("bas"));
break;
case "modifier" :
$projet = NEW PJ("pjs");
print(Html3("haut", "Modif projet", $css));
print("<br />");
$projet->Get_pj($bd, $pj_id);
$projet->Imprimer_form("projets", $css, $listeUsagers);
print(Html3("bas"));
break;
case "sauver" :
$projet = NEW PJ ("pjs");
$projet->Affectation($_POST, $pj_id);
$projet->Sauver($bd);
$operation = $projet->Get_operation();
$url="Location: projets.php?action=xxx&operation=$operation";
unset($projet);
header($url);
exit();
break;
case "detruire" :
$projet = NEW PJ ("pjs");
$projet->Get_pj ($bd, $pj_id);
print(Html3("haut", "Destruction projet", $css));
print('<br /><table align="center" bgcolor="#EBEBEB"><tr><td>' . "\n");
print("<br />");
print(Imprime_titreListe("Voulez-vous réellement détruire ce projet ?", "ffA fs20 bcRouge cBlanc"));
$f = new Formulaire ("post", "projets.php", FALSE, "Form");
$f->debutTable(HORIZONTAL);
$f->champTexte("projet" , "projet_nom" , $projet->pj_nom, 40, 40);
$f->champCache(pj_id, $pj_id);
$f->finTable();
$f->debutTable(HORIZONTAL);
$f->champValider ("OUI-destruction-projet", "action");
$f->fin();
print(Imprime_titreListe("<b>S I N O N</b> => <a href=\"projets.php?action=xxx\" style=\"color:blue;\">retour à la gestion des projets</a>", "ffA fs12 fwN"));
print("</td></tr></table>\n");
print("<br />");
print(Html3("bas"));
break;
case "OUI-destruction-projet" :
$projet = NEW PJ ("pjs");
$projet->Get_pj ($bd, $pj_id);
$projet->Detruire($bd);
$operation = $projet->Get_operation();
$url="Location: projets.php?action=xxx&operation=$operation";
header($url);
exit();
break;
}
?>