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