/[openfoncier]/trunk/obj/architecte.class.php
ViewVC logotype

Contents of /trunk/obj/architecte.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 18435 - (show annotations)
Tue Aug 13 14:43:51 2024 UTC (5 months, 3 weeks ago) by softime
File size: 13534 byte(s)
chore(branch): retour révision 18406 sur le trunk

1 <?php
2 /**
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
11 require_once "../gen/obj/architecte.class.php";
12
13 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 * Clause select pour la requête de sélection des données de l'enregistrement.
61 *
62 * @return array
63 */
64 function get_var_sql_forminc__champs() {
65 return array(
66 "architecte",
67 "nom",
68 "prenom",
69 "adresse1",
70 "adresse2",
71 "lieu_dit",
72 "boite_postale",
73 "cp",
74 "cedex",
75 "ville",
76 "pays",
77 "inscription",
78 "conseil_regional",
79 "nom_cabinet",
80 "telephone",
81 "fax",
82 "email",
83 "note",
84 "titre_obt_diplo_spec",
85 "date_obt_diplo_spec",
86 "lieu_obt_diplo_spec",
87 "frequent",
88 );
89 }
90
91 /**
92 * Retourne true si pétitionnaire frequent false sinon.
93 *
94 * @return boolean retourne true si frequent false sinon.
95 */
96 function is_frequent() {
97 if($this->getVal("frequent") == 't') {
98 return true;
99 }
100 return false;
101 }
102
103 /**
104 * Retourne false si pétitionnaire frequent true sinon.
105 *
106 * @return boolean retourne false si frequent true sinon.
107 */
108 function is_not_frequent() {
109 return !$this->is_frequent();
110 }
111
112 /**
113 * TREATMENT - set_non_frequent.
114 *
115 * Cette methode permet de passer le pétitionnaire en non fréquent.
116 *
117 * @return boolean true si maj effectué false sinon
118 */
119 function set_non_frequent($val) {
120 // Cette méthode permet d'exécuter une routine en début des méthodes
121 // dites de TREATMENT.
122 $this->begin_treatment(__METHOD__);
123
124 if($this->getVal("frequent") == 't') {
125 $this->correct = true;
126 $valF = array();
127 $valF["frequent"] = false;
128
129 $res = $this->f->db->autoExecute(
130 DB_PREFIXE.$this->table,
131 $valF,
132 DB_AUTOQUERY_UPDATE,
133 $this->clePrimaire."=".$this->getVal($this->clePrimaire)
134 );
135 if ($this->f->isDatabaseError($res, true)) {
136 // Appel de la methode de recuperation des erreurs
137 $this->erreur_db($res->getDebugInfo(), $res->getMessage(), '');
138 $this->correct = false;
139 // Termine le traitement
140 return $this->end_treatment(__METHOD__, false);
141 } else {
142 $this->addToMessage(_("Mise a jour effectuee avec succes"));
143 return $this->end_treatment(__METHOD__, true);
144 }
145
146 } else {
147 $this->addToMessage(_("Element deja frequent"));
148 }
149
150 // Termine le traitement
151 return $this->end_treatment(__METHOD__, false);
152 }
153
154 /**
155 * Ajout des blocs pour la gestion des architectes fréquents
156 */
157 function setType(&$form, $maj) {
158 parent::setType($form, $maj);
159 if ($maj < 2) { //ajouter et modifier [add and modify]
160 $form->setType('email', 'mail');
161 }
162 // MODE recup_frequent
163 if ($maj == 110) {
164 //Affichage d'un message d'information
165 $this->addToMessage(_("Architecte frequent non modifiable"));
166 $form->setType("architecte", "hiddenstatic");
167 $form->setType("nom", "static");
168 $form->setType("prenom", "static");
169 $form->setType("adresse1", "static");
170 $form->setType("adresse2", "static");
171 $form->setType("lieu_dit", "static");
172 $form->setType("boite_postale", "static");
173 $form->setType("cp", "static");
174 $form->setType("cedex", "static");
175 $form->setType("ville", "static");
176 $form->setType("pays", "static");
177 $form->setType("inscription", "static");
178 $form->setType("telephone", "static");
179 $form->setType("fax", "static");
180 $form->setType("email", "static");
181 $form->setType("note", "static");
182 $form->setType("frequent", "checkboxstatic");
183 $form->setType("nom_cabinet", "static");
184 $form->setType("conseil_regional", "static");
185 }
186 // Pour les actions appelée en POST en Ajax, il est nécessaire de
187 // qualifier le type de chaque champs (Si le champ n'est pas défini un
188 // PHP Notice: Undefined index dans core/om_formulaire.class.php est
189 // levé). On sélectionne donc les actions de portlet de type
190 // action-direct ou assimilé et les actions spécifiques avec le même
191 // comportement.
192 if ($this->get_action_param($maj, "portlet_type") == "action-direct"
193 || $this->get_action_param($maj, "portlet_type") == "action-direct-with-confirmation") {
194 //
195 foreach ($this->champs as $key => $value) {
196 $form->setType($value, 'hidden');
197 }
198 $form->setType($this->clePrimaire, "hiddenstatic");
199 }
200 }
201
202 function setLayout(&$form, $maj){
203
204 $form->setBloc('architecte','D',"", "alignForm");
205 //
206 $form->setBloc('architecte','DF',"", "group");
207 //
208 $form->setBloc('architecte','F');
209
210 if($this->getVal('frequent') != 't' || $maj == 0 ) {
211 $form->setBloc('nom','D',"","group alignForm civilite_architecte ".($maj<2 ? "search_fields ":""));
212 } else {
213 $form->setBloc('nom','D',"","group alignForm");
214 }
215
216 //$form->setBloc('nom','D',"", "group civilite_architecte ".($maj<2 ? "search_fields":""));
217 $form->setBloc('prenom','F');
218
219 $form->setBloc('adresse1','D',"", "adresse_architecte alignForm");
220 //
221 $form->setBloc('adresse1','DF',"", "group");
222 $form->setBloc('adresse2','DF',"", "group");
223 $form->setBloc('lieu_dit','DF',"", "group");
224 $form->setBloc('boite_postale','DF',"", "group");
225 $form->setBloc('cp','DF',"", "group");
226 $form->setBloc('cedex','DF',"", "group");
227 $form->setBloc('ville','DF',"", "group");
228 $form->setBloc('pays','DF',"", "group");
229 //
230 $form->setBloc('pays','F');
231
232 $form->setBloc('inscription','D',"", "complement_architecte alignForm");
233 //
234 $form->setBloc('inscription','DF',"", "group");
235 $form->setBloc('conseil_regional','DF',"", "group");
236 $form->setBloc('nom_cabinet','DF',"", "group");
237 $form->setBloc('telephone','DF',"", "group");
238 $form->setBloc('fax','DF',"", "group");
239 $form->setBloc('email','DF',"", "group");
240 $form->setBloc('note','DF',"", "group");
241 //
242 $form->setBloc('note','F');
243
244 $form->setBloc('titre_obt_diplo_spec', 'D', __("Obtention du diplôme de spécialisation et d’approfondissement en architecture mention architecture et patrimoine ou équivalent"), "alignForm");
245 $form->setBloc('lieu_obt_diplo_spec', 'F');
246 }
247
248 /**
249 * SETTER_FORM - setVal (setVal).
250 *
251 * @return void
252 */
253 function setVal(&$form, $maj, $validation, &$dnu1 = null, $dnu2 = null) {
254 parent::setVal($form, $maj, $validation);
255 //
256 $form->setVal("pays", "France");
257 }
258
259 function setLib(&$form,$maj) {
260 //
261 parent::setLib($form, $maj);
262 $form->setLib('frequent',"<span class=\"om-form-button copy-16\"
263 title=\""._("Sauvegarder cet architecte")."\">"._("Sauvegarder (architecte frequent)")."</span>");
264
265 // Dans le cas d’une intervention sur un immeuble classé au titre des monuments historiques
266 $form->setLib('titre_obt_diplo_spec', __("Titre"));
267 $form->setLib('date_obt_diplo_spec', __("Date"));
268 $form->setLib('lieu_obt_diplo_spec', __("Établissement / ville / pays"));
269
270 //
271 $form->setLib('inscription', __("Numéro de récépissé de déclaration à l'ordre des architectes"));
272 $form->setLib('conseil_regional', __("Conseil régional de l'ordre de"));
273 }
274
275 /**
276 * Ajout d'un champs caché permettant de linker l'id du demandeur
277 * recement ajouté
278 **/
279 function sousFormSpecificContent($maj) {
280
281 $id_architecte = $this->getVal("architecte");
282 if(isset($this->valF["architecte"]) AND !empty($this->valF["architecte"])) {
283 echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"".
284 $this->valF["architecte"]."\" />";
285 } elseif(isset($id_architecte) AND !empty($id_architecte) AND $maj == 110) {
286 echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"".
287 $this->getVal("architecte")."\" />";
288 }
289 }
290
291 /**
292 * Synthèse de l'architecte pour le formulaire des données techniques
293 */
294 function afficherSynthese() {
295
296 $nom = $this->getVal('nom');
297 $prenom = $this->getVal('prenom');
298
299 //Affichage du bouton pour ajout si dans un objet qui n'est pas en BDD
300 if ( $this->getParameter("maj") === 0 ){
301 printf ("<span class=\"om-form-button add-16 add_architecte\"
302 onclick=\"popupIt('architecte',
303 '".OM_ROUTE_SOUSFORM."&obj=architecte&action=0'+
304 '&retourformulaire=donnees_techniques', 860, 'auto',
305 getObjId, 'architecte');\"".
306 ">");
307 printf(_("Saisir un(e) architecte"));
308 }
309 //Affichage du bouton de suppression sinon
310 else {
311 //
312 printf ("<span class=\"om-form-button delete-16 add_architecte\"
313 onclick=\"setDataFrequent('','architecte');\"".
314 "title=\"");
315 printf(_("Supprimer"));
316 printf("\">");
317 printf("&nbsp;");
318 printf("</span>");
319 //
320 printf ("<span class=\"om-form-button edit-16 add_architecte\"
321 onclick=\"popupIt('architecte',
322 '".OM_ROUTE_SOUSFORM."&obj=architecte&action=1&idx=".$this->getVal($this->clePrimaire)."'+
323 '&retourformulaire=donnees_techniques', 860, 'auto',
324 getObjId, '".$this->clePrimaire."');\"".
325 "title=\"");
326 printf(_("editer"));
327 printf("\">");
328 printf("%s %s",$nom,$prenom);
329 }
330 printf ("</span>");
331 }
332
333 /**
334 * Indique si la redirection vers le lien de retour est activée ou non.
335 *
336 * L'objectif de cette méthode est de permettre d'activer ou de désactiver
337 * la redirection dans certains contextes.
338 *
339 * @return boolean
340 */
341 function is_back_link_redirect_activated() {
342 //
343 if ($this->getParameter("retourformulaire") === 'donnees_techniques') {
344 //
345 return false;
346 }
347
348 //
349 return true;
350 }
351
352 /**
353 * Permet de modifier le fil d'Ariane depuis l'objet pour un formulaire
354 * @param string $ent Fil d'Ariane récupéréré
355 * @return Fil d'Ariane
356 */
357 function getFormTitle($ent) {
358 //
359 $out = $ent;
360 if ($this->getVal($this->clePrimaire) != "") {
361 $out .= "<span class=\"libelle\">&nbsp;->&nbsp;".$this->getVal($this->clePrimaire)."&nbsp;".$this->getVal('prenom')."&nbsp;".$this->getVal('nom')."</span>";
362 }
363 return $out;
364 }
365
366 public function view_json_data() {
367 $this->checkAccessibility();
368 $this->f->disableLog();
369 $view = $this->get_json_data();
370 printf(json_encode($view));
371 }
372
373 public function get_json_data() {
374 $val = array_combine($this->champs, $this->val);
375 foreach ($val as $key => $value) {
376 $val[$key] = strip_tags($value);
377 }
378 return $val;
379 }
380
381 }// fin classe
382
383

Properties

Name Value
svn:keywords "Id"

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26