1 |
<?php |
2 |
//$Id$ |
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 |
$this->constructeur($id,$db,$debug); |
10 |
}// fin constructeur |
11 |
|
12 |
function checkAccessibility() { |
13 |
// |
14 |
parent::checkAccessibility(); |
15 |
|
16 |
//Affiche le bouton dans le portail d'action pour rendre un architecte non |
17 |
//fréquent si on est dans le contexte d'un objet architecte_frequent |
18 |
if ( $this->getParameter('aff') == 'architecte' || |
19 |
$this->getVal('frequent') != 't'){ |
20 |
$this->actions_sup['frequent'] = NULL; |
21 |
} |
22 |
} |
23 |
|
24 |
/** |
25 |
* Ajout des blocs pour la gestion des architectes fréquents |
26 |
*/ |
27 |
function setType(&$form,$maj) { |
28 |
parent::setType($form,$maj); |
29 |
if ($maj < 2) { //ajouter et modifier [add and modify] |
30 |
$form->setType('email', 'mail'); |
31 |
} |
32 |
|
33 |
// XXX solution temporaire (pas l'endroit adéquat pour afficher un message) |
34 |
if($this->getVal('frequent') == 't' AND $maj == 1 ) { |
35 |
|
36 |
//Affichage d'un message d'information |
37 |
$this->addToMessage(_("Architecte frequent non modifiable")); |
38 |
|
39 |
$form->setType('nom','static'); |
40 |
$form->setType('prenom','static'); |
41 |
$form->setType('adresse1','static'); |
42 |
$form->setType('adresse2','static'); |
43 |
$form->setType('cp','static'); |
44 |
$form->setType('ville','static'); |
45 |
$form->setType('pays','static'); |
46 |
$form->setType('inscription','static'); |
47 |
$form->setType('conseil_regional','static'); |
48 |
$form->setType('telephone','static'); |
49 |
$form->setType('fax','static'); |
50 |
$form->setType('email','static'); |
51 |
$form->setType('note','static'); |
52 |
$form->setType('frequent','checkboxstatic'); |
53 |
$form->setType('nom_cabinet','static'); |
54 |
} |
55 |
} |
56 |
|
57 |
function setLayout(&$form, $maj){ |
58 |
|
59 |
$form->setBloc('architecte','D',"", "alignForm"); |
60 |
// |
61 |
$form->setBloc('architecte','DF',"", "group"); |
62 |
// |
63 |
$form->setBloc('architecte','F'); |
64 |
|
65 |
if($this->getVal('frequent') != 't' || $maj == 0 ) { |
66 |
$form->setBloc('nom','D',"","group alignForm civilite_architecte ".($maj<2 ? "search_fields ":"")); |
67 |
} else { |
68 |
$form->setBloc('nom','D',"","group alignForm"); |
69 |
} |
70 |
|
71 |
//$form->setBloc('nom','D',"", "group civilite_architecte ".($maj<2 ? "search_fields":"")); |
72 |
$form->setBloc('prenom','F'); |
73 |
|
74 |
$form->setBloc('adresse1','D',"", "adresse_architecte alignForm"); |
75 |
// |
76 |
$form->setBloc('adresse1','DF',"", "group"); |
77 |
$form->setBloc('adresse2','DF',"", "group"); |
78 |
$form->setBloc('cp','DF',"", "group"); |
79 |
$form->setBloc('ville','DF',"", "group"); |
80 |
$form->setBloc('pays','DF',"", "group"); |
81 |
// |
82 |
$form->setBloc('pays','F'); |
83 |
|
84 |
$form->setBloc('inscription','D',"", "complement_architecte alignForm"); |
85 |
// |
86 |
$form->setBloc('inscription','DF',"", "group"); |
87 |
$form->setBloc('conseil_regional','DF',"", "group"); |
88 |
$form->setBloc('nom_cabinet','DF',"", "group"); |
89 |
$form->setBloc('telephone','DF',"", "group"); |
90 |
$form->setBloc('fax','DF',"", "group"); |
91 |
$form->setBloc('email','DF',"", "group"); |
92 |
$form->setBloc('note','DF',"", "group"); |
93 |
// |
94 |
$form->setBloc('note','F'); |
95 |
} |
96 |
|
97 |
function setVal(&$form, $maj, $validation, &$db) { |
98 |
parent::setVal($form, $maj, $validation, $db); |
99 |
$form->setVal("pays","France"); |
100 |
} |
101 |
|
102 |
function setLib(&$form,$maj) { |
103 |
// |
104 |
parent::setLib($form, $maj); |
105 |
$form->setLib('frequent',"<span class=\"om-form-button copy-16\" |
106 |
title=\""._("Sauvegarder cet architecte")."\">"._("Sauvegarder (architecte frequent)")."</span>"); |
107 |
|
108 |
} |
109 |
|
110 |
/** |
111 |
* Ajout d'un champs caché permettant de linker l'id du demandeur |
112 |
* recement ajouté |
113 |
**/ |
114 |
function sousFormSpecificContent($maj) { |
115 |
$id_architecte = $this->getVal("architecte"); |
116 |
if(isset($this->valF["architecte"]) AND !empty($this->valF["architecte"])) { |
117 |
echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"". |
118 |
$this->valF["architecte"]."\" />"; |
119 |
} elseif(isset($id_architecte) AND !empty($id_architecte) AND $maj == 1) { |
120 |
echo "<input id=\"id_retour\" name=\"idRetour\" type=\"hidden\" value=\"". |
121 |
$this->getVal("architecte")."\" />"; |
122 |
} |
123 |
} |
124 |
|
125 |
/** |
126 |
* Synthèse de l'architecte pour le formulaire des données techniques |
127 |
*/ |
128 |
function afficherSynthese() { |
129 |
|
130 |
$nom = $this->getVal('nom'); |
131 |
$prenom = $this->getVal('prenom'); |
132 |
|
133 |
//Affichage du bouton pour ajout si dans un objet qui n'est pas en BDD |
134 |
if ( $nom == "" ){ |
135 |
printf ("<span class=\"om-form-button add-16 add_architecte\" |
136 |
onclick=\"popupIt('architecte', |
137 |
'../scr/sousform.php?obj=architecte&action=0'+ |
138 |
'&retourformulaire=donnees_techniques', 860, 'auto', |
139 |
getObjId, 'architecte');\"". |
140 |
">"); |
141 |
printf(_("Saisir un(e) architecte")); |
142 |
} |
143 |
//Affichage du bouton de suppression sinon |
144 |
else { |
145 |
// |
146 |
printf ("<span class=\"om-form-button delete-16 add_architecte\" |
147 |
onclick=\"setDataFrequent('','architecte');\"". |
148 |
"title=\""); |
149 |
printf(_("Supprimer")); |
150 |
printf("\">"); |
151 |
printf(" "); |
152 |
printf("</span>"); |
153 |
// |
154 |
printf ("<span class=\"om-form-button edit-16 add_architecte\" |
155 |
onclick=\"popupIt('architecte', |
156 |
'../scr/sousform.php?obj=architecte&action=1&idx=".$this->getVal($this->clePrimaire)."'+ |
157 |
'&retourformulaire=donnees_techniques', 860, 'auto', |
158 |
getObjId, '".$this->clePrimaire."');\"". |
159 |
"title=\""); |
160 |
printf(_("editer")); |
161 |
printf("\">"); |
162 |
printf("%s %s",$nom,$prenom); |
163 |
} |
164 |
printf ("</span>"); |
165 |
} |
166 |
|
167 |
/** |
168 |
* Le bouton de modification est masqué si on est en modification d'un architecte fréquent |
169 |
*/ |
170 |
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
171 |
if($this->getVal('frequent') != 't' || $maj == 0 ) { |
172 |
if (!$this->correct) { |
173 |
// |
174 |
switch ($maj) { |
175 |
case 0: |
176 |
$bouton = _("Ajouter"); |
177 |
break; |
178 |
case 1: |
179 |
$bouton = _("Modifier"); |
180 |
break; |
181 |
case 2: |
182 |
$bouton = _("Supprimer"); |
183 |
break; |
184 |
} |
185 |
// |
186 |
echo "<input type=\"button\" value=\"".$bouton."\" "; |
187 |
echo "onclick=\"affichersform('".get_class($this)."', '$datasubmit', this.form);\" "; |
188 |
echo "class=\"om-button\" />"; |
189 |
} |
190 |
} |
191 |
} |
192 |
}// fin classe |
193 |
?> |