1 |
mbroquet |
3730 |
<?php |
2 |
nhaye |
5254 |
/** |
3 |
|
|
* DBFORM - 'architecte' - Surcharge gen. |
4 |
|
|
* |
5 |
|
|
* Ce script permet de définir la classe 'architecte'. |
6 |
|
|
* |
7 |
|
|
* @package openads |
8 |
|
|
* @version SVN : $Id$ |
9 |
|
|
*/ |
10 |
mbroquet |
3730 |
|
11 |
nhaye |
5254 |
require_once "../gen/obj/architecte.class.php"; |
12 |
|
|
|
13 |
mbroquet |
3730 |
class architecte extends architecte_gen { |
14 |
|
|
|
15 |
nhaye |
5254 |
/** |
16 |
|
|
* Constructeur. |
17 |
|
|
*/ |
18 |
|
|
function __construct($id, &$dnu1 = null, $dnu2 = null) { |
19 |
|
|
$this->constructeur($id); |
20 |
|
|
} |
21 |
mbroquet |
3730 |
|
22 |
|
|
// {{{ Gestion de la confidentialité des données spécifiques |
23 |
|
|
|
24 |
|
|
/** |
25 |
|
|
* Définition des actions disponibles sur la classe. |
26 |
|
|
* |
27 |
|
|
* @return void |
28 |
|
|
*/ |
29 |
|
|
function init_class_actions() { |
30 |
|
|
|
31 |
|
|
parent::init_class_actions(); |
32 |
|
|
|
33 |
|
|
// ACTION - 001 - modifier |
34 |
|
|
// Modifie la condition et le libellé du bouton modifier |
35 |
|
|
$this->class_actions[1]["condition"] = array("is_not_frequent"); |
36 |
|
|
|
37 |
|
|
// ACTION - 100 - non_frequent |
38 |
|
|
// Finalise l'enregistrement |
39 |
|
|
$this->class_actions[100] = array( |
40 |
|
|
"identifier" => "non_frequent", |
41 |
|
|
"portlet" => array( |
42 |
|
|
"type" => "action-direct", |
43 |
|
|
"libelle" => _("Marquer non frequent"), |
44 |
|
|
"order" => 100, |
45 |
|
|
"class" => "radiation-16", |
46 |
|
|
), |
47 |
|
|
"view" => "formulaire", |
48 |
|
|
"method" => "set_non_frequent", |
49 |
|
|
"permission_suffix" => "modifier_frequent", |
50 |
|
|
"condition" => array("is_frequent"), |
51 |
|
|
); |
52 |
|
|
|
53 |
|
|
// ACTION - 110 - recuperer_frequent |
54 |
|
|
// Finalise l'enregistrement |
55 |
|
|
$this->class_actions[110] = array( |
56 |
|
|
"identifier" => "recuperer_frequent", |
57 |
|
|
"view" => "formulaire", |
58 |
|
|
"method" => "modifier", |
59 |
|
|
"button" => "valider", |
60 |
|
|
"permission_suffix" => "modifier", |
61 |
|
|
); |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
//}}} |
65 |
|
|
|
66 |
|
|
/** |
67 |
|
|
* Retourne true si pétitionnaire frequent false sinon. |
68 |
|
|
* |
69 |
|
|
* @return boolean retourne true si frequent false sinon. |
70 |
|
|
*/ |
71 |
|
|
function is_frequent() { |
72 |
|
|
if($this->getVal("frequent") == 't') { |
73 |
|
|
return true; |
74 |
|
|
} |
75 |
|
|
return false; |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
/** |
79 |
|
|
* Retourne false si pétitionnaire frequent true sinon. |
80 |
|
|
* |
81 |
|
|
* @return boolean retourne false si frequent true sinon. |
82 |
|
|
*/ |
83 |
|
|
function is_not_frequent() { |
84 |
|
|
return !$this->is_frequent(); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
/** |
88 |
|
|
* TREATMENT - set_non_frequent. |
89 |
|
|
* |
90 |
|
|
* Cette methode permet de passer le pétitionnaire en non fréquent. |
91 |
|
|
* |
92 |
|
|
* @return boolean true si maj effectué false sinon |
93 |
|
|
*/ |
94 |
|
|
function set_non_frequent($val) { |
95 |
|
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
96 |
|
|
// dites de TREATMENT. |
97 |
|
|
$this->begin_treatment(__METHOD__); |
98 |
|
|
|
99 |
|
|
if($this->getVal("frequent") == 't') { |
100 |
|
|
$this->correct = true; |
101 |
|
|
$this->valF["frequent"] = false; |
102 |
|
|
|
103 |
|
|
$res = $this->f->db->autoExecute( |
104 |
|
|
DB_PREFIXE.$this->table, |
105 |
|
|
$this->valF, |
106 |
|
|
DB_AUTOQUERY_UPDATE, |
107 |
|
|
$this->clePrimaire."=".$this->getVal($this->clePrimaire) |
108 |
|
|
); |
109 |
|
|
if ($this->f->isDatabaseError($res, true)) { |
110 |
|
|
// Appel de la methode de recuperation des erreurs |
111 |
|
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
112 |
|
|
$this->correct = false; |
113 |
|
|
// Termine le traitement |
114 |
|
|
return $this->end_treatment(__METHOD__, false); |
115 |
|
|
} else { |
116 |
|
|
$this->addToMessage(_("Mise a jour effectuee avec succes")); |
117 |
|
|
return $this->end_treatment(__METHOD__, true); |
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
} else { |
121 |
|
|
$this->addToMessage(_("Element deja frequent")); |
122 |
|
|
} |
123 |
|
|
|
124 |
|
|
// Termine le traitement |
125 |
|
|
return $this->end_treatment(__METHOD__, false); |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
/** |
129 |
|
|
* Ajout des blocs pour la gestion des architectes fréquents |
130 |
|
|
*/ |
131 |
|
|
function setType(&$form, $maj) { |
132 |
|
|
parent::setType($form, $maj); |
133 |
|
|
if ($maj < 2) { //ajouter et modifier [add and modify] |
134 |
|
|
$form->setType('email', 'mail'); |
135 |
|
|
} |
136 |
|
|
// MODE recup_frequent |
137 |
|
|
if ($maj == 110) { |
138 |
|
|
//Affichage d'un message d'information |
139 |
|
|
$this->addToMessage(_("Architecte frequent non modifiable")); |
140 |
|
|
$form->setType("architecte", "hiddenstatic"); |
141 |
|
|
$form->setType("nom", "static"); |
142 |
|
|
$form->setType("prenom", "static"); |
143 |
|
|
$form->setType("adresse1", "static"); |
144 |
|
|
$form->setType("adresse2", "static"); |
145 |
|
|
$form->setType("cp", "static"); |
146 |
|
|
$form->setType("ville", "static"); |
147 |
|
|
$form->setType("pays", "static"); |
148 |
|
|
$form->setType("inscription", "static"); |
149 |
|
|
$form->setType("telephone", "static"); |
150 |
|
|
$form->setType("fax", "static"); |
151 |
|
|
$form->setType("email", "static"); |
152 |
|
|
$form->setType("note", "static"); |
153 |
|
|
$form->setType("frequent", "checkboxstatic"); |
154 |
|
|
$form->setType("nom_cabinet", "static"); |
155 |
|
|
$form->setType("conseil_regional", "static"); |
156 |
|
|
} |
157 |
|
|
} |
158 |
|
|
|
159 |
|
|
function setLayout(&$form, $maj){ |
160 |
|
|
|
161 |
|
|
$form->setBloc('architecte','D',"", "alignForm"); |
162 |
|
|
// |
163 |
|
|
$form->setBloc('architecte','DF',"", "group"); |
164 |
|
|
// |
165 |
|
|
$form->setBloc('architecte','F'); |
166 |
|
|
|
167 |
|
|
if($this->getVal('frequent') != 't' || $maj == 0 ) { |
168 |
|
|
$form->setBloc('nom','D',"","group alignForm civilite_architecte ".($maj<2 ? "search_fields ":"")); |
169 |
|
|
} else { |
170 |
|
|
$form->setBloc('nom','D',"","group alignForm"); |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
//$form->setBloc('nom','D',"", "group civilite_architecte ".($maj<2 ? "search_fields":"")); |
174 |
|
|
$form->setBloc('prenom','F'); |
175 |
|
|
|
176 |
|
|
$form->setBloc('adresse1','D',"", "adresse_architecte alignForm"); |
177 |
|
|
// |
178 |
|
|
$form->setBloc('adresse1','DF',"", "group"); |
179 |
|
|
$form->setBloc('adresse2','DF',"", "group"); |
180 |
|
|
$form->setBloc('cp','DF',"", "group"); |
181 |
|
|
$form->setBloc('ville','DF',"", "group"); |
182 |
|
|
$form->setBloc('pays','DF',"", "group"); |
183 |
|
|
// |
184 |
|
|
$form->setBloc('pays','F'); |
185 |
|
|
|
186 |
|
|
$form->setBloc('inscription','D',"", "complement_architecte alignForm"); |
187 |
|
|
// |
188 |
|
|
$form->setBloc('inscription','DF',"", "group"); |
189 |
|
|
$form->setBloc('conseil_regional','DF',"", "group"); |
190 |
|
|
$form->setBloc('nom_cabinet','DF',"", "group"); |
191 |
|
|
$form->setBloc('telephone','DF',"", "group"); |
192 |
|
|
$form->setBloc('fax','DF',"", "group"); |
193 |
|
|
$form->setBloc('email','DF',"", "group"); |
194 |
|
|
$form->setBloc('note','DF',"", "group"); |
195 |
|
|
// |
196 |
|
|
$form->setBloc('note','F'); |
197 |
|
|
} |
198 |
|
|
|
199 |
softime |
6929 |
function setVal(&$form, $maj, $validation, &$db = null, $DEBUG = null) { |
200 |
|
|
parent::setVal($form, $maj, $validation, $db, $DEBUG); |
201 |
mbroquet |
3730 |
$form->setVal("pays","France"); |
202 |
|
|
} |
203 |
|
|
|
204 |
|
|
function setLib(&$form,$maj) { |
205 |
|
|
// |
206 |
|
|
parent::setLib($form, $maj); |
207 |
|
|
$form->setLib('frequent',"<span class=\"om-form-button copy-16\" |
208 |
|
|
title=\""._("Sauvegarder cet architecte")."\">"._("Sauvegarder (architecte frequent)")."</span>"); |
209 |
|
|
|
210 |
|
|
} |
211 |
|
|
|
212 |
|
|
/** |
213 |
|
|
* Ajout d'un champs caché permettant de linker l'id du demandeur |
214 |
|
|
* recement ajouté |
215 |
|
|
**/ |
216 |
|
|
function sousFormSpecificContent($maj) { |
217 |
|
|
|
218 |
|
|
$id_architecte = $this->getVal("architecte"); |
219 |
|
|
if(isset($this->valF["architecte"]) AND !empty($this->valF["architecte"])) { |
220 |
|
|
echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"". |
221 |
|
|
$this->valF["architecte"]."\" />"; |
222 |
|
|
} elseif(isset($id_architecte) AND !empty($id_architecte) AND $maj == 110) { |
223 |
|
|
echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"". |
224 |
|
|
$this->getVal("architecte")."\" />"; |
225 |
|
|
} |
226 |
|
|
} |
227 |
|
|
|
228 |
|
|
/** |
229 |
|
|
* Synthèse de l'architecte pour le formulaire des données techniques |
230 |
|
|
*/ |
231 |
|
|
function afficherSynthese() { |
232 |
|
|
|
233 |
|
|
$nom = $this->getVal('nom'); |
234 |
|
|
$prenom = $this->getVal('prenom'); |
235 |
|
|
|
236 |
|
|
//Affichage du bouton pour ajout si dans un objet qui n'est pas en BDD |
237 |
|
|
if ( $this->getParameter("maj") === 0 ){ |
238 |
|
|
printf ("<span class=\"om-form-button add-16 add_architecte\" |
239 |
|
|
onclick=\"popupIt('architecte', |
240 |
|
|
'../scr/sousform.php?obj=architecte&action=0'+ |
241 |
|
|
'&retourformulaire=donnees_techniques', 860, 'auto', |
242 |
|
|
getObjId, 'architecte');\"". |
243 |
|
|
">"); |
244 |
|
|
printf(_("Saisir un(e) architecte")); |
245 |
|
|
} |
246 |
|
|
//Affichage du bouton de suppression sinon |
247 |
|
|
else { |
248 |
|
|
// |
249 |
|
|
printf ("<span class=\"om-form-button delete-16 add_architecte\" |
250 |
|
|
onclick=\"setDataFrequent('','architecte');\"". |
251 |
|
|
"title=\""); |
252 |
|
|
printf(_("Supprimer")); |
253 |
|
|
printf("\">"); |
254 |
|
|
printf(" "); |
255 |
|
|
printf("</span>"); |
256 |
|
|
// |
257 |
|
|
printf ("<span class=\"om-form-button edit-16 add_architecte\" |
258 |
|
|
onclick=\"popupIt('architecte', |
259 |
|
|
'../scr/sousform.php?obj=architecte&action=1&idx=".$this->getVal($this->clePrimaire)."'+ |
260 |
|
|
'&retourformulaire=donnees_techniques', 860, 'auto', |
261 |
|
|
getObjId, '".$this->clePrimaire."');\"". |
262 |
|
|
"title=\""); |
263 |
|
|
printf(_("editer")); |
264 |
|
|
printf("\">"); |
265 |
|
|
printf("%s %s",$nom,$prenom); |
266 |
|
|
} |
267 |
|
|
printf ("</span>"); |
268 |
|
|
} |
269 |
|
|
|
270 |
nhaye |
5254 |
/** |
271 |
mbroquet |
3730 |
* Le bouton de modification est masqué si on est en modification d'un architecte fréquent |
272 |
|
|
*/ |
273 |
|
|
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
274 |
|
|
if($this->getVal('frequent') != 't' || $maj == 0 ) { |
275 |
|
|
if (!$this->correct) { |
276 |
|
|
// |
277 |
|
|
switch ($maj) { |
278 |
|
|
case 0: |
279 |
|
|
$bouton = _("Ajouter"); |
280 |
|
|
break; |
281 |
|
|
case 1: |
282 |
|
|
$bouton = _("Modifier"); |
283 |
|
|
break; |
284 |
|
|
case 2: |
285 |
|
|
$bouton = _("Supprimer"); |
286 |
|
|
break; |
287 |
|
|
} |
288 |
|
|
// |
289 |
|
|
echo "<input type=\"button\" value=\"".$bouton."\" "; |
290 |
|
|
echo "onclick=\"affichersform('".get_class($this)."', '$datasubmit', this.form);\" "; |
291 |
|
|
echo "class=\"om-button\" />"; |
292 |
|
|
} |
293 |
|
|
} |
294 |
|
|
} |
295 |
nhaye |
5254 |
|
296 |
softime |
6565 |
}// fin classe |
297 |
|
|
?> |
298 |
nhaye |
5254 |
|