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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26