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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9245 - (hide annotations)
Fri Apr 3 09:21:03 2020 UTC (4 years, 10 months ago) by softime
File size: 12006 byte(s)
* Merge de la branche d'intégration 4.13.0-develop dans le trunk

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

Properties

Name Value
svn:keywords "Id"

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26