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