1 |
<?php |
2 |
/** |
3 |
* DBFORM - 'service' - Surcharge gen. |
4 |
* |
5 |
* Ce script permet de définir la classe 'service'. |
6 |
* |
7 |
* @package openads |
8 |
* @version SVN : $Id$ |
9 |
*/ |
10 |
|
11 |
require_once "../gen/obj/service.class.php"; |
12 |
|
13 |
class service extends service_gen { |
14 |
|
15 |
/** |
16 |
* Clause select pour la requête de sélection des données de l'enregistrement. |
17 |
* |
18 |
* @return array |
19 |
*/ |
20 |
function get_var_sql_forminc__champs() { |
21 |
return array( |
22 |
"service", |
23 |
"abrege", |
24 |
"libelle", |
25 |
"adresse", |
26 |
"adresse2", |
27 |
"cp", |
28 |
"ville", |
29 |
"email", |
30 |
"notification_email", |
31 |
"delai_type", |
32 |
"delai", |
33 |
"consultation_papier", |
34 |
"om_validite_debut", |
35 |
"om_validite_fin", |
36 |
"om_collectivite", |
37 |
"type_consultation", |
38 |
"edition", |
39 |
"service_type", |
40 |
"generate_edition", |
41 |
"uid_platau_acteur", |
42 |
"accepte_notification_email", |
43 |
); |
44 |
} |
45 |
|
46 |
/** |
47 |
* |
48 |
* @return string |
49 |
*/ |
50 |
function get_var_sql_forminc__sql_edition() { |
51 |
return "SELECT om_etat.om_etat, om_etat.libelle FROM ".DB_PREFIXE."om_etat WHERE id LIKE 'consultation_%' ORDER BY om_etat.libelle ASC"; |
52 |
} |
53 |
|
54 |
function setType(&$form,$maj) { |
55 |
parent::setType($form,$maj); |
56 |
if ($maj < 2) { |
57 |
$form->setType('type_consultation', 'select'); |
58 |
$form->setType('edition', 'select'); |
59 |
$form->setType('delai_type', 'select'); |
60 |
$form->setType('service_type', 'select'); |
61 |
} |
62 |
if ($maj == 2 || $maj == 3) { |
63 |
$form->setType('service_type', 'selectstatic'); |
64 |
} |
65 |
} |
66 |
|
67 |
/** |
68 |
* SETTER_FORM - setSelect. |
69 |
* |
70 |
* @return void |
71 |
*/ |
72 |
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
73 |
parent::setSelect($form, $maj); |
74 |
|
75 |
$contenu=array(); |
76 |
|
77 |
$contenu[0]=array( |
78 |
'avec_avis_attendu', |
79 |
'pour_conformite', |
80 |
'pour_information', |
81 |
); |
82 |
|
83 |
$contenu[1]=array( |
84 |
__('Avec avis attendu'), |
85 |
__('Pour conformite'), |
86 |
__('Pour information'), |
87 |
|
88 |
); |
89 |
$form->setSelect("type_consultation",$contenu); |
90 |
|
91 |
// |
92 |
$contenu = array(); |
93 |
$contenu[0] = array('mois','jour'); |
94 |
$contenu[1] = array(__('mois'), __('jour')); |
95 |
$form->setSelect("delai_type", $contenu); |
96 |
|
97 |
// service_type |
98 |
$contenu = array(); |
99 |
$contenu[0] = array(PLATAU, 'openads', ); |
100 |
$contenu[1] = array(__("Plat'AU"), __('openADS'), ); |
101 |
$form->setSelect("service_type", $contenu); |
102 |
} |
103 |
|
104 |
/** |
105 |
* SETTER_FORM - setVal (setVal). |
106 |
* |
107 |
* @return void |
108 |
*/ |
109 |
function setVal(&$form, $maj, $validation, &$dnu1 = null, $dnu2 = null) { |
110 |
parent::setVal($form, $maj, $validation); |
111 |
// |
112 |
if ($maj > 1) { |
113 |
//Traitement des données pour l'affichage du select |
114 |
$temp = $this->val[array_search('type_consultation', array_keys($form->val))]; |
115 |
if (strcmp($temp, 'pour_information') == 0) { |
116 |
$temp = __('Pour information'); |
117 |
} elseif (strcmp($temp, 'avec_avis_attendu') == 0) { |
118 |
$temp = __('Avec avis attendu'); |
119 |
} elseif (strcmp($temp, 'pour_conformite') == 0) { |
120 |
$temp = __('Pour conformite'); |
121 |
} |
122 |
$form->setVal('type_consultation', $temp); |
123 |
} |
124 |
} |
125 |
|
126 |
function setLib(&$form,$maj) { |
127 |
// |
128 |
parent::setLib($form, $maj); |
129 |
$form->setLib("edition", __("type d'edition de la consultation")); |
130 |
$form->setLib("email", __("liste de diffusion")); |
131 |
$form->setLib("accepte_notification_email", __("peut recevoir une notification d'instruction")); |
132 |
} |
133 |
|
134 |
/** |
135 |
* SURCHARGE |
136 |
* |
137 |
* Configuration du formulaire (VIEW formulaire et VIEW sousformulaire). |
138 |
* |
139 |
* @param formulaire $form Instance formulaire. |
140 |
* @param integer $maj Identifant numérique de l'action. |
141 |
* |
142 |
* @return void |
143 |
*/ |
144 |
function setTaille(&$form, $maj) { |
145 |
parent::setTaille($form, $maj); |
146 |
|
147 |
$form->setTaille("uid_platau_acteur", 11); |
148 |
} |
149 |
|
150 |
/** |
151 |
* SURCHARGE |
152 |
* |
153 |
* Configuration du formulaire (VIEW formulaire et VIEW sousformulaire). |
154 |
* |
155 |
* @param formulaire $form Instance formulaire. |
156 |
* @param integer $maj Identifant numérique de l'action. |
157 |
* |
158 |
* @return void |
159 |
*/ |
160 |
function setMax(&$form, $maj) { |
161 |
parent::setMax($form, $maj); |
162 |
|
163 |
$form->setMax("uid_platau_acteur", 11); |
164 |
} |
165 |
|
166 |
// XXX WIP |
167 |
public function get_json_data() { |
168 |
$val = array_combine($this->champs, $this->val); |
169 |
foreach ($val as $key => $value) { |
170 |
$val[$key] = strip_tags($value); |
171 |
} |
172 |
return $val; |
173 |
} |
174 |
|
175 |
} |
176 |
|
177 |
|