1 |
<?php |
<?php |
2 |
|
/** |
3 |
|
* Script personnalisé pour les consultations multiples. |
4 |
|
* |
5 |
|
* @package openfoncier |
6 |
|
* @version SVN : $Id$ |
7 |
|
*/ |
8 |
|
|
9 |
require_once "../obj/utils.class.php"; |
require_once "../obj/utils.class.php"; |
10 |
|
|
11 |
// Identifiant de l'objet metier a copier |
// Identifiant de l'objet metier a copier |
12 |
(isset($_GET['idx']) ? $idx = $_GET['idx'] : $idx = ""); |
(isset($_GET['idx']) ? $idx = $_GET['idx'] : $idx = ""); |
13 |
// Nom de l'objet metier |
// Nom de l'objet metier |
14 |
(isset($_GET['obj']) ? $obj = $_GET['obj'] : $obj = ""); |
(isset($_GET['obj']) ? $obj = $_GET['obj'] : $obj = ""); |
15 |
|
(isset($_GET['date_envoi']) ? $date_envoi = $_GET['date_envoi'] : $date_envoi = ""); |
16 |
|
|
17 |
$f = new utils("nohtml"); |
$f = new utils("nohtml"); |
|
//$f->setFlag("htmlonly"); |
|
|
$f->disableLog(); |
|
18 |
|
|
19 |
$liste_gauche = ""; |
$liste_gauche = ""; |
20 |
|
|
21 |
/*Requête qui récupère les services qui sont dans des thématiques*/ |
if ( isset($_GET) && isset($_GET['data']) && !empty($_GET['data']) ){ |
22 |
$sql = |
$f->disableLog(); |
23 |
"SELECT |
/*Récupération des données et formatage.*/ |
24 |
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
$donnees_temp = explode(';', $_GET['data']); |
25 |
ser.service, ser.libelle AS ser_lib |
for ( $i = 1 ; $i < count($donnees_temp) ; $i++ ) |
26 |
FROM |
$donnees[] = explode('_', $donnees_temp[$i]); |
|
public.lien_service_service_categorie lie, |
|
|
public.service_categorie ser_cat, |
|
|
public.service ser |
|
|
WHERE |
|
|
ser_cat.service_categorie = lie.service_categorie AND |
|
|
ser.service = lie.service AND |
|
|
( |
|
|
ser.om_validite_fin <= CURRENT_DATE OR |
|
|
ser.om_validite_fin IS NULL |
|
|
) |
|
|
"; |
|
|
|
|
|
$res = $f->db->query($sql); |
|
|
$f->isDatabaseError($res); |
|
|
|
|
|
$temp_ser_cat = 0; |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
27 |
|
|
28 |
/*On change de thématique, donc rajoute le nom de la thématique*/ |
/* Nombre de consultations papier à générer */ |
29 |
if ( $temp_ser_cat != $row['service_categorie'] ){ |
$nbConsPap = 0; |
30 |
|
|
31 |
|
/* Ajout des données en base de données |
32 |
|
* 0 : l'ID du service |
33 |
|
* 1 : consultation papier {0,1} |
34 |
|
* */ |
35 |
|
if ( isset($donnees) && count($donnees) > 0 ){ |
36 |
|
|
37 |
|
require_once "../core/om_dbform.class.php"; |
38 |
|
$om_dbform = new dbForm(); |
39 |
|
require_once "../obj/consultation.class.php"; |
40 |
|
$consultation = new consultation("]",$f->db,DEBUG); |
41 |
|
|
42 |
$temp_ser_cat = $row['service_categorie']; |
foreach ($donnees as $value) { |
43 |
$liste_gauche .= ' |
|
44 |
<div id="them_'.$row['service_categorie'].'" class="liste_gauche_them" onclick="changeCSS();">'. |
$sql = "SELECT delai FROM service WHERE service = $value[0]"; |
45 |
$row['them_lib']. |
$res = $f->db->query($sql); |
46 |
'</div> |
$f->isDatabaseError($res); |
47 |
<div |
$row=& $res->fetchRow(); |
48 |
class="liste_gauche_service" |
$delai = $row[0]; |
49 |
id="'.$row['service_categorie'].'_'.$row['service'].'" onclick="changeCSS();"> |
|
50 |
'.$row['ser_lib'].' |
/*Calcul du delai de retour*/ |
51 |
</div> |
$date_envoi_temp = $om_dbform->datePHP($date_envoi); |
52 |
'; |
$delai = $om_dbform->dateDB($consultation->moisdate($date_envoi_temp, $delai)); |
53 |
|
|
54 |
|
/*Les données à ajouter*/ |
55 |
|
$arrayVal = array( |
56 |
|
'consultation' => "]", |
57 |
|
'dossier' => $idx, |
58 |
|
'date_envoi' => $date_envoi, |
59 |
|
'date_retour' => NULL, |
60 |
|
'date_limite' => $delai, |
61 |
|
'service' => $value[0], |
62 |
|
'avis_consultation' => NULL, |
63 |
|
'date_reception' => NULL, |
64 |
|
'motivation' => "", |
65 |
|
'fichier' => NULL, |
66 |
|
'lu' => TRUE |
67 |
|
); |
68 |
|
|
69 |
|
$consultation->ajouter($arrayVal, $f->db, DEBUG); |
70 |
|
|
71 |
|
/*Comptage du nombre de consultations papier demandées et récupération des ids des PDFs à éditer*/ |
72 |
|
if ($value[1]==1){ |
73 |
|
$idxConsultations[] = $consultation->valF['consultation']; |
74 |
|
$nbConsPap++; |
75 |
|
} |
76 |
|
} |
77 |
|
|
78 |
|
/*Génération du PDF*/ |
79 |
|
if ( isset($idxConsultations) && count($idxConsultations) > 0 ){ |
80 |
|
|
81 |
|
$textIdsConsultations = ""; |
82 |
|
foreach ($idxConsultations as $value) |
83 |
|
$textIdsConsultations .= "&idxConsultations[]=$value"; |
84 |
|
|
85 |
|
echo " |
86 |
|
<script> |
87 |
|
$.download('../app/pdfetat.php','obj=$obj$textIdsConsultations', 'POST', $obj); |
88 |
|
</script> |
89 |
|
"; |
90 |
|
} |
91 |
|
/*Affichage du message d'information*/ |
92 |
|
$f->displayMessage("valid", count($donnees)._(' service(s) sélectionné(s) dont ').$nbConsPap._(' consultation(s) papier.')); |
93 |
} |
} |
94 |
|
|
95 |
/*On est dans la même thématique*/ |
} |
96 |
else { |
else { |
97 |
|
/*Requête qui récupère les services qui sont dans des thématiques*/ |
98 |
|
$sql = |
99 |
|
"SELECT |
100 |
|
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
101 |
|
ser.service, ser.libelle AS ser_lib, ser.consultation_papier |
102 |
|
FROM |
103 |
|
public.lien_service_service_categorie lie, |
104 |
|
public.service_categorie ser_cat, |
105 |
|
public.service ser |
106 |
|
WHERE |
107 |
|
ser_cat.service_categorie = lie.service_categorie AND |
108 |
|
ser.service = lie.service AND |
109 |
|
( |
110 |
|
ser.om_validite_fin <= CURRENT_DATE OR |
111 |
|
ser.om_validite_fin IS NULL |
112 |
|
) |
113 |
|
"; |
114 |
|
|
115 |
|
$res = $f->db->query($sql); |
116 |
|
$f->isDatabaseError($res); |
117 |
|
|
118 |
|
$temp_ser_cat = 0; |
119 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
120 |
|
$name = $row['service_categorie'].'_'. |
121 |
|
$row['service'].'_'. |
122 |
|
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
123 |
|
/*On change de thématique, donc rajoute le nom de la thématique*/ |
124 |
|
if ( $temp_ser_cat != $row['service_categorie'] ){ |
125 |
|
|
126 |
|
$temp_ser_cat = $row['service_categorie']; |
127 |
|
$liste_gauche .= ' |
128 |
|
<div id="them_'.$row['service_categorie'].'" class="liste_gauche_them" >'. |
129 |
|
$row['them_lib']. |
130 |
|
'</div> |
131 |
|
<div |
132 |
|
class="liste_gauche_service '.$name.'" |
133 |
|
id="'.$name.'" > |
134 |
|
'.$row['ser_lib'].' |
135 |
|
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
136 |
|
</div> |
137 |
|
'; |
138 |
|
} |
139 |
|
|
140 |
|
/*On est dans la même thématique*/ |
141 |
|
else { |
142 |
|
|
143 |
|
$liste_gauche .= ' |
144 |
|
<div |
145 |
|
class="liste_gauche_service '.$name.'" |
146 |
|
id="'.$name.'" > |
147 |
|
'.$row['ser_lib'].' |
148 |
|
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
149 |
|
</div> |
150 |
|
'; |
151 |
|
} |
152 |
|
|
153 |
|
} |
154 |
|
|
155 |
|
/*Requête qui récupère les services qui ne sont pas dans une thématique*/ |
156 |
|
$sql = |
157 |
|
"SELECT service, libelle, consultation_papier |
158 |
|
FROM public.service |
159 |
|
WHERE service NOT IN |
160 |
|
( |
161 |
|
SELECT service |
162 |
|
FROM lien_service_service_categorie |
163 |
|
) |
164 |
|
AND |
165 |
|
( |
166 |
|
om_validite_fin <= CURRENT_DATE OR |
167 |
|
om_validite_fin IS NULL |
168 |
|
) |
169 |
|
"; |
170 |
|
|
171 |
|
$res = $f->db->query($sql); |
172 |
|
$f->isDatabaseError($res); |
173 |
|
|
174 |
|
if ( $res->numrows() > 0 ) |
175 |
|
$liste_gauche .= ' |
176 |
|
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
177 |
|
|
178 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
179 |
|
/*Ajout de tous les services qui n'ont pas de thématique*/ |
180 |
|
$name = '0_'. |
181 |
|
$row['service'].'_'. |
182 |
|
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
183 |
$liste_gauche .= ' |
$liste_gauche .= ' |
184 |
<div |
<div |
185 |
class="liste_gauche_service" |
class="liste_gauche_service '.$name.'" |
186 |
id="'.$row['service_categorie'].'_'.$row['service'].'" onclick="changeCSS();"> |
id="'.$name.'" > |
187 |
'.$row['ser_lib'].' |
'.$row['libelle'].' |
188 |
|
<input id="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
189 |
</div> |
</div> |
190 |
'; |
'; |
191 |
} |
} |
192 |
|
|
193 |
} |
/*Affichage du formulaire*/ |
194 |
|
echo '<div class="subtitle">'; |
195 |
/*Requête qui récupère les services qui ne sont pas dans une thématique*/ |
echo '<h3>'; |
196 |
$sql = |
echo _("Application"); |
197 |
"SELECT service, libelle |
echo '<span class="om-icon om-icon-16 om-icon-fix arrow-right-16"></span>'; |
198 |
FROM public.service |
echo _("consultation"); |
199 |
WHERE service NOT IN |
echo '</h3>'; |
200 |
( |
echo '</div>'; |
201 |
SELECT service |
echo '<div class="sformulaire">'; |
202 |
FROM lien_service_service_categorie |
echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;" |
203 |
) |
method="get" action="" name="f2" id="form_val">'; |
204 |
AND |
echo '<div class="formEntete ui-corner-all">'; |
205 |
( |
echo "<div id='form-content'>"; |
206 |
om_validite_fin <= CURRENT_DATE OR |
echo '<div class="bloc">'; |
207 |
om_validite_fin IS NULL |
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
208 |
) |
echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>". |
209 |
"; |
_("Consultation par thématique ")."</legend>"; |
210 |
|
echo "<div class='fieldsetContent' style='width:100%'>"; |
211 |
$res = $f->db->query($sql); |
echo '<div class="field-ser-them field-type-hiddenstatic">'; |
212 |
$f->isDatabaseError($res); |
echo '<div class="form-libelle">'; |
213 |
|
echo '<label class="libelle-dossier" for="dossier">'; |
214 |
if ( $res->numrows() > 0 ) |
echo _('dossier'); |
|
$liste_gauche .= ' |
|
|
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
|
|
|
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
|
/*Ajout de tous les services qui n'ont pas de thématique*/ |
|
|
$liste_gauche .= ' |
|
|
<div |
|
|
class="liste_gauche_service" |
|
|
id="0_'.$row['service'].'" onclick="changeCSS();"> |
|
|
'.$row['libelle'].' |
|
|
</div> |
|
|
'; |
|
|
} |
|
|
|
|
|
/*Affichage du formulaire*/ |
|
|
echo '<div class="subtitle">'; |
|
|
echo '<h3>'; |
|
|
echo _("Application"); |
|
|
echo '<span class="om-icon om-icon-16 om-icon-fix arrow-right-16">></span>'; |
|
|
echo _("consultation"); |
|
|
echo '</h3>'; |
|
|
echo '</div>'; |
|
|
echo '<div class="sformulaire">'; |
|
|
echo '<form onsubmit="affichersform(\'consultation\', |
|
|
\'../scr/sousform.php?obj=consultation&premiersf=0&retourformulaire=PC& |
|
|
idxformulaire=PC12R0001&trisf=&validation=1&retour=tab\', this);return false;" |
|
|
method="post" action="" name="f2">'; |
|
|
echo '<div class="formEntete ui-corner-all">'; |
|
|
echo "<div id='form-content'>"; |
|
|
echo '<div class="bloc">'; |
|
|
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
|
|
echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>". |
|
|
_("Consultation par thématique ")."</legend>"; |
|
|
echo "<div class='fieldsetContent' style='width:100%'>"; |
|
|
echo '<div class="field-ser-them field-type-hiddenstatic">'; |
|
|
echo '<div class="form-libelle">'; |
|
|
echo '<label class="libelle-dossier" for="dossier">'; |
|
|
echo _('dossier'); |
|
|
echo '<span class="not-null-tag">*</span>'; |
|
|
echo '</label>'; |
|
|
echo '</div>'; |
|
|
echo '<div class="form-content">'; |
|
|
echo '<input id="dossier" class="champFormulaire" type="hidden" value="PC12R0001" name="dossier">'; |
|
|
echo $idx; |
|
|
echo '</div>'; |
|
|
echo '</div>'; |
|
|
/*Code du nouveau champ*/ |
|
|
echo '<div class="field-ser-them ser-them">'; |
|
|
echo '<div class="list-ser-them">'; |
|
|
echo $liste_gauche; |
|
|
echo '</div>'; |
|
|
echo '<div class="button-ser-them">'; |
|
|
echo '<ul>'; |
|
|
echo '<li>'; |
|
|
echo '<input type="button" value="'._("Ajouter").' >>" id="add-ser-them"/>'; |
|
|
echo '</li>'; |
|
|
echo '<li>'; |
|
|
echo '<input type="button" value="<< '._("Supprimer").'" id="del-ser-them"/>'; |
|
|
echo '</li>'; |
|
|
echo '</ul>'; |
|
|
echo '</div>'; |
|
|
echo '<div class="list-sel-ser-them">'; |
|
|
echo '</div>'; |
|
|
echo '</div>'; |
|
|
/* -- FIN --*/ |
|
|
echo '<div class="field-ser-them field-type-date2">'; |
|
|
echo '<div class="form-libelle">'; |
|
|
echo '<label class="libelle-date_envoi" for="date_envoi">'; |
|
|
echo _('date_envoi'); |
|
215 |
echo '<span class="not-null-tag">*</span>'; |
echo '<span class="not-null-tag">*</span>'; |
216 |
echo '</label>'; |
echo '</label>'; |
217 |
|
echo '</div>'; |
218 |
|
echo '<div class="form-content">'; |
219 |
|
echo '<input id="dossier" class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier">'; |
220 |
|
echo $idx; |
221 |
|
echo '</div>'; |
222 |
|
echo '</div>'; |
223 |
|
/*Code du nouveau champ*/ |
224 |
|
echo '<div class="field-ser-them ser-them">'; |
225 |
|
echo '<div class="list-ser-them">'; |
226 |
|
echo $liste_gauche; |
227 |
|
echo '</div>'; |
228 |
|
echo '<div class="button-ser-them">'; |
229 |
|
echo '<ul>'; |
230 |
|
echo '<li>'; |
231 |
|
echo '<input type="button" value="'._("Ajouter").' >>" id="add-ser-them"/>'; |
232 |
|
echo '</li>'; |
233 |
|
echo '<li>'; |
234 |
|
echo '<input type="button" value="<< '._("Supprimer").'" id="del-ser-them"/>'; |
235 |
|
echo '</li>'; |
236 |
|
echo '</ul>'; |
237 |
|
echo '</div>'; |
238 |
|
echo '<div class="list-sel-ser-them">'; |
239 |
|
echo '</div>'; |
240 |
echo '</div>'; |
echo '</div>'; |
241 |
echo '<div class="form-content">'; |
/* -- FIN --*/ |
242 |
echo '<input id="date_envoi" class="champFormulaire datepicker" |
echo '<div class="field-ser-them field-type-date2">'; |
243 |
type="text" onclick="" onkeyup="" onchange="fdate(this)" |
echo '<div class="form-libelle">'; |
244 |
maxlength="10" size="12" value="'.date("d/m/Y").'" |
echo '<label class="libelle-date_envoi" for="date_envoi">'; |
245 |
name="date_envoi">'; |
echo _('date_envoi'); |
246 |
|
echo '<span class="not-null-tag">*</span>'; |
247 |
|
echo '</label>'; |
248 |
|
echo '</div>'; |
249 |
|
echo '<div class="form-content">'; |
250 |
|
echo '<input id="date_envoi" class="champFormulaire datepicker" |
251 |
|
type="text" onkeyup="" onchange="fdate(this)" |
252 |
|
maxlength="10" size="12" value="'.date("d/m/Y").'" |
253 |
|
name="date_envoi">'; |
254 |
|
echo '</div>'; |
255 |
echo '</div>'; |
echo '</div>'; |
256 |
echo '</div>'; |
echo "</div>"; |
257 |
echo "</div>"; |
echo "</fieldset>"; |
258 |
echo "</fieldset>"; |
echo '</div>'; |
259 |
echo '</div>'; |
echo '</div>'; |
260 |
echo '</div>'; |
echo '</div>'; |
|
echo '</div>'; |
|
|
echo '<div class="formControls">'; |
|
|
echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all" |
|
|
type="button" onclick="affichersform(\'consultation\', |
|
|
\'../scr/sousform.php?obj=consultation&premiersf=0&retourformulaire=PC& |
|
|
idxformulaire=PC12R0001&trisf=&validation=1&retour=tab\', |
|
|
this.form);" |
|
|
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
|
|
role="button" aria-disabled="false">'; |
|
|
echo '<a class="retour" onclick="ajaxIt(\'consultation\', |
|
|
\'../scr/soustab.php?obj=consultation&retourformulaire=PC& |
|
|
idxformulaire=PC12R0001&premier=0&tricol=\');" |
|
|
href="#">'; |
|
|
echo 'Retour'; |
|
|
echo '</a>'; |
|
|
echo '</div>'; |
|
|
echo '</form>'; |
|
|
echo '</div>'; |
|
|
?> |
|
261 |
|
echo '<div class="formControls">'; |
262 |
|
echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all" |
263 |
|
type="button" onclick="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');" |
264 |
|
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
265 |
|
role="button" aria-disabled="false" id="button_val">'; |
266 |
|
echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\');" |
267 |
|
href="#">'; |
268 |
|
echo 'Retour'; |
269 |
|
echo '</a>'; |
270 |
|
echo '</div>'; |
271 |
|
echo '</form>'; |
272 |
|
echo '</div>'; |
273 |
|
|
274 |
|
echo " |
275 |
|
<script> |
276 |
|
$(function(){ |
277 |
|
/* |
278 |
|
Sélectionne tous les services d'un thème au clique sur celui ci. |
279 |
|
*/ |
280 |
|
$('.liste_gauche_them').click( |
281 |
|
function(){ |
282 |
|
|
283 |
|
var id = $(this).attr('id').split('_')[1]; |
284 |
|
$('.list-ser-them div').each( |
285 |
|
function() { |
286 |
|
|
287 |
|
if ( $(this).attr('id').indexOf('them') == -1 && |
288 |
|
$(this).attr('id').indexOf(id) == 0 ){ |
289 |
|
$(this).toggleClass('liste_gauche_service_selected'); |
290 |
|
} |
291 |
|
} |
292 |
|
); |
293 |
|
} |
294 |
|
); |
295 |
|
|
296 |
|
/* |
297 |
|
Change la class CSS d'un service sur lequel on clique dans la liste de gauche. |
298 |
|
*/ |
299 |
|
$('.liste_gauche_service').click( |
300 |
|
function(){ |
301 |
|
$(this).toggleClass('liste_gauche_service_selected'); |
302 |
|
} |
303 |
|
); |
304 |
|
|
305 |
|
/* |
306 |
|
Change la class CSS d'un service sur lequel on clique dans la liste de droite. |
307 |
|
*/ |
308 |
|
$('.field-ser-them').on( |
309 |
|
'click', |
310 |
|
'.liste_droite_service', |
311 |
|
function(){ |
312 |
|
$(this).toggleClass('liste_droite_service_selected'); |
313 |
|
} |
314 |
|
); |
315 |
|
|
316 |
|
$('.liste_droite_service input[type=checkbox]').live( |
317 |
|
'click', |
318 |
|
'input[type=checkbox]', |
319 |
|
function(){ |
320 |
|
|
321 |
|
old_id = $(this).attr('id'); |
322 |
|
|
323 |
|
tab_don = old_id.split('_'); |
324 |
|
|
325 |
|
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_'; |
326 |
|
|
327 |
|
changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) ); |
328 |
|
$('div[name=\"' + $(this).attr('class') + '\"]').attr('id', new_id); |
329 |
|
$(this).attr('id', new_id); |
330 |
|
|
331 |
|
} |
332 |
|
); |
333 |
|
|
334 |
|
$('#date_envoi').change( |
335 |
|
function (){ |
336 |
|
|
337 |
|
var listServ = new Array(); |
338 |
|
var data = ''; |
339 |
|
|
340 |
|
$('.liste_gauche_service_selected').each( |
341 |
|
function(i) { |
342 |
|
|
343 |
|
var id = $(this).attr('id'); |
344 |
|
|
345 |
|
|
346 |
|
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
347 |
|
return; |
348 |
|
listServ[i] = id.split('_')[1]; |
349 |
|
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
350 |
|
|
351 |
|
} |
352 |
|
); |
353 |
|
|
354 |
|
changeActionVal(data); |
355 |
|
} |
356 |
|
); |
357 |
|
|
358 |
|
/* |
359 |
|
Passe les services sélectionnés dans la liste de gauche dans celle de droite. |
360 |
|
*/ |
361 |
|
$('#add-ser-them').click( |
362 |
|
function() { |
363 |
|
|
364 |
|
changeDataLeftColumn(); |
365 |
|
} |
366 |
|
); |
367 |
|
|
368 |
|
/* |
369 |
|
Passe les services sélectionnés dans la liste de droite dans celle de gauche. |
370 |
|
*/ |
371 |
|
$('#del-ser-them').click( |
372 |
|
function() { |
373 |
|
|
374 |
|
var data = ''; |
375 |
|
|
376 |
|
$('.liste_droite_service_selected').each( |
377 |
|
function() { |
378 |
|
|
379 |
|
var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id'); |
380 |
|
|
381 |
|
manageListServ('.list-ser-them div', id, 1); |
382 |
|
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
383 |
|
|
384 |
|
$(this).remove(); |
385 |
|
} |
386 |
|
); |
387 |
|
|
388 |
|
changeActionVal(data); |
389 |
|
} |
390 |
|
); |
391 |
|
}); |
392 |
|
|
393 |
|
/* |
394 |
|
Vérifie que l'objet n'est pas une thématique et que son identifiant correspond. |
395 |
|
*/ |
396 |
|
function isNotthemIsOneServ( objet, id ){ |
397 |
|
return ( $(objet).attr('id').indexOf('them') == -1 && |
398 |
|
$(objet).attr('id').indexOf('_' + id.split('_')[1] + '_') != -1 ); |
399 |
|
} |
400 |
|
|
401 |
|
/* |
402 |
|
Affiche ou cache un élément qui n'est pas une thématique et dont son identifiant correspond. |
403 |
|
*/ |
404 |
|
function manageListServ( objet ,id, type){ |
405 |
|
|
406 |
|
$(objet).each( |
407 |
|
function() { |
408 |
|
|
409 |
|
if ( isNotthemIsOneServ(this, id) ){ |
410 |
|
if ( type == 0 ) |
411 |
|
|
412 |
|
$(this).hide() ; |
413 |
|
|
414 |
|
else { |
415 |
|
|
416 |
|
if ( $(this).hasClass('liste_gauche_service_selected') ) |
417 |
|
|
418 |
|
$(this).toggleClass('liste_gauche_service_selected'); |
419 |
|
|
420 |
|
$(this).show() ; |
421 |
|
|
422 |
|
} |
423 |
|
} |
424 |
|
} |
425 |
|
); |
426 |
|
} |
427 |
|
|
428 |
|
function changeActionVal(data){ |
429 |
|
date = $('#date_envoi').val(); |
430 |
|
|
431 |
|
$('#form_val').attr( |
432 |
|
'onsubmit', |
433 |
|
'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);return false;' + |
434 |
|
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');' |
435 |
|
|
436 |
|
); |
437 |
|
$('#button_val').attr( |
438 |
|
'onclick', |
439 |
|
'if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?obj=$obj&data='+data+'&idx=$idx&date_envoi='+date+'\',true);' + |
440 |
|
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');' |
441 |
|
|
442 |
|
); |
443 |
|
} |
444 |
|
|
445 |
|
function changeOneData( oldData, newData) { |
446 |
|
|
447 |
|
date = $('#date_envoi').val(); |
448 |
|
|
449 |
|
$('#form_val').attr( |
450 |
|
'onsubmit', |
451 |
|
$('#form_val').attr('onsubmit').replace(oldData,newData) |
452 |
|
); |
453 |
|
$('#button_val').attr( |
454 |
|
'onclick', |
455 |
|
$('#button_val').attr('onclick').replace(oldData,newData) |
456 |
|
); |
457 |
|
} |
458 |
|
|
459 |
|
function changeDataLeftColumn(){ |
460 |
|
|
461 |
|
var listServ = new Array(); |
462 |
|
var data = ''; |
463 |
|
|
464 |
|
if ( $('.liste_droite_service').length == 0 ){ |
465 |
|
$('.list-sel-ser-them').empty(); |
466 |
|
$('.list-sel-ser-them').append(''+ |
467 |
|
'<div class=\'row\'>'+ |
468 |
|
'<div class=\'cell1\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+ |
469 |
|
'<div class=\'cell2\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+ |
470 |
|
'</div>') ; |
471 |
|
} |
472 |
|
|
473 |
|
$('.liste_gauche_service_selected').each( |
474 |
|
function(i) { |
475 |
|
|
476 |
|
if ( !$(this).is(':visible') ) |
477 |
|
return; |
478 |
|
|
479 |
|
var id = $(this).attr('id'); |
480 |
|
|
481 |
|
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
482 |
|
return; |
483 |
|
listServ[i] = id.split('_')[1]; |
484 |
|
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
485 |
|
|
486 |
|
$('.list-sel-ser-them').append( |
487 |
|
'<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+ |
488 |
|
'<div class=\'cell1\'>'+ |
489 |
|
'<div name=\'' + $(this).attr('id') + '\' id=\'' + $(this).attr('id') + '\'>'+ |
490 |
|
$(this).html().split('<')[0]+ |
491 |
|
'</div>'+ |
492 |
|
'</div>' + |
493 |
|
'<div class=\'cell2\'>'+ |
494 |
|
'<div>'+ |
495 |
|
'<input class=\'' + $(this).attr('id') + '\''+$(this).html().split('<input')[1]+ |
496 |
|
'</div>'+ |
497 |
|
'</div>'+ |
498 |
|
'</div>' |
499 |
|
); |
500 |
|
|
501 |
|
$(this).hide(); |
502 |
|
|
503 |
|
manageListServ('.list-ser-them div', id, 0); |
504 |
|
|
505 |
|
} |
506 |
|
); |
507 |
|
|
508 |
|
changeActionVal(data); |
509 |
|
} |
510 |
|
</script>"; |
511 |
|
} |
512 |
|
?> |