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 |
|
//formulaire retour |
16 |
|
(isset($_GET['ret']) ? $retourformulaire = $_GET['ret'] : $retourformulaire = ""); |
17 |
(isset($_GET['date_envoi']) ? $date_envoi = $_GET['date_envoi'] : $date_envoi = ""); |
(isset($_GET['date_envoi']) ? $date_envoi = $_GET['date_envoi'] : $date_envoi = ""); |
18 |
|
|
19 |
$f = new utils("nohtml"); |
$f = new utils("nohtml"); |
24 |
$f->disableLog(); |
$f->disableLog(); |
25 |
/*Récupération des données et formatage.*/ |
/*Récupération des données et formatage.*/ |
26 |
$donnees_temp = explode(';', $_GET['data']); |
$donnees_temp = explode(';', $_GET['data']); |
27 |
for ( $i = 0 ; $i < count($donnees_temp) - 1 ; $i++ ) |
for ( $i = 1 ; $i < count($donnees_temp) ; $i++ ) |
28 |
$donnees[] = explode('_', $donnees_temp[$i]); |
$donnees[] = explode('_', $donnees_temp[$i]); |
29 |
|
|
30 |
/*Nombre de consultations papier à générer */ |
/* Nombre de consultations papier à générer */ |
31 |
$nbConsPap = 0; |
$nbConsPap = 0; |
32 |
|
|
33 |
/* Ajout des données en base de données |
/* Ajout des données en base de données |
35 |
* 1 : consultation papier {0,1} |
* 1 : consultation papier {0,1} |
36 |
* */ |
* */ |
37 |
if ( isset($donnees) && count($donnees) > 0 ){ |
if ( isset($donnees) && count($donnees) > 0 ){ |
38 |
|
|
39 |
|
require_once "../core/om_dbform.class.php"; |
40 |
|
$om_dbform = new dbForm(); |
41 |
require_once "../obj/consultation.class.php"; |
require_once "../obj/consultation.class.php"; |
42 |
$consultation = new consultation("]",$f->db,DEBUG); |
$consultation = new consultation("]",$f->db,DEBUG); |
43 |
|
|
44 |
foreach ($donnees as $value) { |
foreach ($donnees as $value) { |
45 |
|
|
46 |
$sql = "SELECT delai FROM service WHERE service = $value[0]"; |
$sql = "SELECT delai, type_consultation FROM ".DB_PREFIXE."service WHERE service = $value[0]"; |
47 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
48 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
49 |
$row=& $res->fetchRow(); |
$row=& $res->fetchRow(); |
50 |
$delai = $row[0]; |
$delai = $row[0]; |
51 |
|
$type_consultation = $row[1]; |
52 |
|
|
53 |
/*Calcul du delai de retour*/ |
/*Calcul du delai de retour*/ |
54 |
$date_envoi_temp = explode("/", $date_envoi); |
$date_envoi_temp = $om_dbform->datePHP($date_envoi); |
55 |
$date_envoi_temp = $date_envoi_temp[2]."-".$date_envoi_temp[1]."-".$date_envoi_temp[0]; |
$delai = $om_dbform->dateDB($consultation->moisdate($date_envoi_temp, $delai)); |
|
$delai_temp = explode('-',$consultation->moisdate($date_envoi_temp, $delai)); |
|
|
$delai = $delai_temp[2]."/".$delai_temp[1]."/".$delai_temp[0]; |
|
56 |
|
|
57 |
/*Les données à ajouter*/ |
/*Les données à ajouter*/ |
58 |
$arrayVal = array( |
$arrayVal = array( |
70 |
); |
); |
71 |
|
|
72 |
$consultation->ajouter($arrayVal, $f->db, DEBUG); |
$consultation->ajouter($arrayVal, $f->db, DEBUG); |
73 |
|
|
74 |
/*Génération des PDF + comptage du nombre de consultations papier demandées*/ |
/*Comptage du nombre de consultations papier demandées et récupération des ids des PDFs à éditer*/ |
75 |
if ($value[1]==1){ |
if ($value[1]==1){ |
76 |
|
$idxConsultations[] = $consultation->valF['consultation']; |
77 |
|
$objConsultations[] = $type_consultation; |
78 |
$nbConsPap++; |
$nbConsPap++; |
79 |
} |
} |
80 |
} |
} |
81 |
|
|
82 |
|
/*Génération du PDF*/ |
83 |
|
if ( isset($idxConsultations) && count($idxConsultations) > 0 ){ |
84 |
|
|
85 |
|
$textIdsConsultations = "idx="; |
86 |
|
foreach ($idxConsultations as $value) { |
87 |
|
$textIdsConsultations .= $value.";"; |
88 |
|
} |
89 |
|
$textObjConsultations = "obj="; |
90 |
|
foreach ($objConsultations as $value) { |
91 |
|
$textObjConsultations .= "consultation_".$value.";"; |
92 |
|
} |
93 |
|
echo " |
94 |
|
<script language='javascript' type='text/javascript'> |
95 |
|
$.download('../pdf/pdfetat.php?output=download','".$textObjConsultations."&".$textIdsConsultations."', 'POST', 'consultation_avec_avis_attendu'); |
96 |
|
</script> |
97 |
|
"; |
98 |
|
} |
99 |
/*Affichage du message d'information*/ |
/*Affichage du message d'information*/ |
100 |
echo '<div class="subtitle">'; |
$f->displayMessage("valid", count($donnees)._(' service(s) selectionne(s) dont ').$nbConsPap._(' consultation(s) papier.')); |
|
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'<div class="message ui-widget ui-corner-all ui-state-highlight ui-state-valid"> |
|
|
<p> |
|
|
<span class="ui-icon ui-icon-info"></span> |
|
|
<span class="text"> |
|
|
'.count($donnees).' service(s) sélectionné(s) dont '.$nbConsPap.' consultation(s) papier. |
|
|
</span> |
|
|
</p> |
|
|
</div>'; |
|
|
echo '</div>'; |
|
101 |
} |
} |
102 |
|
|
103 |
} |
} |
108 |
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
109 |
ser.service, ser.libelle AS ser_lib, ser.consultation_papier |
ser.service, ser.libelle AS ser_lib, ser.consultation_papier |
110 |
FROM |
FROM |
111 |
public.lien_service_service_categorie lie, |
".DB_PREFIXE."lien_service_service_categorie lie, |
112 |
public.service_categorie ser_cat, |
".DB_PREFIXE."service_categorie ser_cat, |
113 |
public.service ser |
".DB_PREFIXE."service ser |
114 |
WHERE |
WHERE |
115 |
ser_cat.service_categorie = lie.service_categorie AND |
ser_cat.service_categorie = lie.service_categorie AND |
116 |
ser.service = lie.service AND |
ser.service = lie.service AND |
117 |
( |
( |
118 |
ser.om_validite_fin <= CURRENT_DATE OR |
(ser.om_validite_debut IS NULL |
119 |
ser.om_validite_fin IS NULL |
AND (ser.om_validite_fin IS NULL |
120 |
|
OR ser.om_validite_fin > CURRENT_DATE)) |
121 |
|
OR |
122 |
|
(ser.om_validite_debut <= CURRENT_DATE |
123 |
|
AND (ser.om_validite_fin IS NULL |
124 |
|
OR ser.om_validite_fin > CURRENT_DATE)) |
125 |
) |
) |
126 |
|
ORDER BY them_lib, ser_lib |
127 |
"; |
"; |
128 |
|
|
129 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
130 |
|
$f->addToLog("app/consultation_multiple.php: db->query(\"".$sql."\")", VERBOSE_MODE); |
131 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
132 |
|
|
133 |
$temp_ser_cat = 0; |
$temp_ser_cat = 0; |
134 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
135 |
$name = $row['service_categorie'].'_'. |
$name = $row['service_categorie'].'_'. |
136 |
$row['service'].'_'. |
$row['service'].'_'. |
137 |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '0' : '1' ).'_'; |
138 |
/*On change de thématique, donc rajoute le nom de la thématique*/ |
/*On change de thématique, donc rajoute le nom de la thématique*/ |
139 |
if ( $temp_ser_cat != $row['service_categorie'] ){ |
if ( $temp_ser_cat != $row['service_categorie'] ){ |
140 |
|
|
144 |
$row['them_lib']. |
$row['them_lib']. |
145 |
'</div> |
'</div> |
146 |
<div |
<div |
147 |
class="liste_gauche_service" |
class="liste_gauche_service t'.$name.'" |
148 |
id="'.$name.'" > |
id="t'.$name.'" > |
149 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
150 |
<input name="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '' : 'checked="checked"' ).'/> |
151 |
</div> |
</div> |
152 |
'; |
'; |
153 |
} |
} |
157 |
|
|
158 |
$liste_gauche .= ' |
$liste_gauche .= ' |
159 |
<div |
<div |
160 |
class="liste_gauche_service" |
class="liste_gauche_service t'.$name.'" |
161 |
id=id="'.$name.'" > |
id="t'.$name.'" > |
162 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
163 |
<input name="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '' : 'checked="checked"' ).'/> |
164 |
</div> |
</div> |
165 |
'; |
'; |
166 |
} |
} |
170 |
/*Requête qui récupère les services qui ne sont pas dans une thématique*/ |
/*Requête qui récupère les services qui ne sont pas dans une thématique*/ |
171 |
$sql = |
$sql = |
172 |
"SELECT service, libelle, consultation_papier |
"SELECT service, libelle, consultation_papier |
173 |
FROM public.service |
FROM ".DB_PREFIXE."service |
174 |
WHERE service NOT IN |
WHERE service NOT IN |
175 |
( |
( |
176 |
SELECT service |
SELECT service |
177 |
FROM lien_service_service_categorie |
FROM ".DB_PREFIXE."lien_service_service_categorie |
178 |
) |
) |
179 |
AND |
AND |
180 |
( |
( |
185 |
|
|
186 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
187 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
188 |
|
|
189 |
if ( $res->numrows() > 0 ) |
if ( $res->numrows() > 0 ) |
190 |
$liste_gauche .= ' |
$liste_gauche .= ' |
191 |
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
192 |
|
|
193 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
194 |
|
|
195 |
/*Ajout de tous les services qui n'ont pas de thématique*/ |
/*Ajout de tous les services qui n'ont pas de thématique*/ |
196 |
$name = '0_'. |
$name = '0_'. |
197 |
$row['service'].'_'. |
$row['service'].'_'. |
198 |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '0' : '1' ).'_'; |
199 |
$liste_gauche .= ' |
$liste_gauche .= ' |
200 |
<div |
<div |
201 |
class="liste_gauche_service" |
class="liste_gauche_service t'.$name.'" |
202 |
id="'.$name.'" > |
id="t'.$name.'" > |
203 |
'.$row['libelle'].' |
'.$row['libelle'].' |
204 |
<input name="'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '' : 'checked' ).'/> |
<input class="t'.$name.'" type="checkbox" '.(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '' : 'checked="checked"' ).'/> |
205 |
</div> |
</div> |
206 |
'; |
'; |
207 |
} |
} |
218 |
echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;" |
echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;" |
219 |
method="get" action="" name="f2" id="form_val">'; |
method="get" action="" name="f2" id="form_val">'; |
220 |
echo '<div class="formEntete ui-corner-all">'; |
echo '<div class="formEntete ui-corner-all">'; |
221 |
echo "<div id='form-content'>"; |
echo "<div>"; |
222 |
echo '<div class="bloc">'; |
echo '<div class="bloc">'; |
223 |
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
224 |
echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>". |
echo "\t<legend class='ui-corner-all ui-widget-content ui-state-active'>". |
225 |
_("Consultation par thématique ")."</legend>"; |
_("Consultation par thematique ")."</legend>"; |
226 |
echo "<div class='fieldsetContent' style='width:100%'>"; |
echo "<div class='fieldsetContent' style='width:100%'>"; |
227 |
echo '<div class="field-ser-them field-type-hiddenstatic">'; |
echo '<div class="field-ser-them field-type-hiddenstatic">'; |
228 |
echo '<div class="form-libelle">'; |
echo '<div class="form-libelle">'; |
232 |
echo '</label>'; |
echo '</label>'; |
233 |
echo '</div>'; |
echo '</div>'; |
234 |
echo '<div class="form-content">'; |
echo '<div class="form-content">'; |
235 |
echo '<input id="dossier" class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier">'; |
echo '<input class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier"/>'; |
236 |
echo $idx; |
echo $idx; |
237 |
echo '</div>'; |
echo '</div>'; |
238 |
echo '</div>'; |
echo '</div>'; |
252 |
echo '</ul>'; |
echo '</ul>'; |
253 |
echo '</div>'; |
echo '</div>'; |
254 |
echo '<div class="list-sel-ser-them">'; |
echo '<div class="list-sel-ser-them">'; |
255 |
|
echo '<div class=\'row\'>'; |
256 |
|
echo '<div class=\'cell1 liste_droite_title list-sel-ser-them-title\'>'._('Service a consulter').'</div>'; |
257 |
|
echo '<div class=\'cell2 liste_droite_title list-sel-ser-them-title\'>'._('Version papier').'</div>'; |
258 |
|
echo '</div>'; |
259 |
echo '</div>'; |
echo '</div>'; |
260 |
echo '</div>'; |
echo '</div>'; |
261 |
/* -- FIN --*/ |
/* -- FIN --*/ |
280 |
echo '</div>'; |
echo '</div>'; |
281 |
echo '<div class="formControls">'; |
echo '<div class="formControls">'; |
282 |
echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all" |
echo '<input class="om-button ui-button ui-widget ui-state-default ui-corner-all" |
283 |
type="button" onclick="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');" |
type="button" onclick="if ( $(\'.liste_gauche_service_selected\').length > 0 && $(\'#date_envoi\').val() != \'\' ) { ajaxIt(\'consultation\', \'../app/consultation_multiple.php\'); } else alert(\'Veuillez choisir au moins un service et une date d envoi\');" |
284 |
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
285 |
role="button" aria-disabled="false" id="button_val">'; |
id="button_val">'; |
286 |
echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\');" |
echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj='.$obj.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idx.'&premier=0&tricol=\');" |
287 |
href="#">'; |
href="#">'; |
288 |
echo 'Retour'; |
echo 'Retour'; |
289 |
echo '</a>'; |
echo '</a>'; |
292 |
echo '</div>'; |
echo '</div>'; |
293 |
|
|
294 |
echo " |
echo " |
295 |
<script> |
<script language='javascript' type='text/javascript'> |
296 |
$(function(){ |
$(function(){ |
297 |
|
|
298 |
/* |
/* |
299 |
Sélectionne tous les services d'un thème au clique sur celui ci. |
Sélectionne tous les services d'un thème au clique sur celui ci. |
300 |
*/ |
*/ |
302 |
function(){ |
function(){ |
303 |
|
|
304 |
var id = $(this).attr('id').split('_')[1]; |
var id = $(this).attr('id').split('_')[1]; |
305 |
|
var numSer = 0; |
306 |
|
var numSerWithClass = 0; |
307 |
|
|
308 |
$('.list-ser-them div').each( |
$('.list-ser-them div').each( |
309 |
function() { |
function() { |
310 |
|
|
311 |
|
if ( $(this).attr('id').indexOf('them') == -1 && |
312 |
|
$(this).attr('id').indexOf(id) == 1 && |
313 |
|
$(this).hasClass('liste_gauche_service_selected') ) |
314 |
|
|
315 |
|
numSerWithClass++; |
316 |
|
|
317 |
if ( $(this).attr('id').indexOf('them') == -1 && |
if ( $(this).attr('id').indexOf('them') == -1 && |
318 |
$(this).attr('id').indexOf(id) == 0 ){ |
$(this).attr('id').indexOf(id) == 1 ) |
319 |
$(this).toggleClass('liste_gauche_service_selected'); |
|
320 |
} |
numSer++; |
321 |
} |
} |
322 |
); |
); |
323 |
|
|
324 |
|
if ( numSerWithClass < numSer && numSerWithClass >= 0 ){ |
325 |
|
|
326 |
|
$('.list-ser-them div').each( |
327 |
|
function() { |
328 |
|
|
329 |
|
if ( $(this).attr('id').indexOf('them') == -1 && |
330 |
|
$(this).attr('id').indexOf(id) == 1 && |
331 |
|
!$(this).hasClass('liste_gauche_service_selected') ) |
332 |
|
|
333 |
|
$(this).addClass('liste_gauche_service_selected'); |
334 |
|
} |
335 |
|
); |
336 |
|
} |
337 |
|
|
338 |
|
else { |
339 |
|
|
340 |
|
$('.list-ser-them div').each( |
341 |
|
function() { |
342 |
|
|
343 |
|
if ( $(this).attr('id').indexOf('them') == -1 && |
344 |
|
$(this).attr('id').indexOf(id) == 1 && |
345 |
|
$(this).hasClass('liste_gauche_service_selected') ) |
346 |
|
|
347 |
|
$(this).removeClass('liste_gauche_service_selected'); |
348 |
|
} |
349 |
|
); |
350 |
|
} |
351 |
} |
} |
352 |
); |
); |
353 |
|
|
363 |
/* |
/* |
364 |
Change la class CSS d'un service sur lequel on clique dans la liste de droite. |
Change la class CSS d'un service sur lequel on clique dans la liste de droite. |
365 |
*/ |
*/ |
366 |
$('.liste_droite_service').live( |
$('.field-ser-them').on( |
367 |
'click', |
'click', |
368 |
|
'.cell1', |
369 |
function(){ |
function(){ |
370 |
$(this).toggleClass('liste_droite_service_selected'); |
if ( !$(this).hasClass('liste_droite_title') ) |
371 |
|
$(this).parent().toggleClass('liste_droite_service_selected'); |
372 |
} |
} |
373 |
); |
); |
374 |
|
|
375 |
$('.liste_droite_service input[type=checkbox]').live( |
$('.liste_droite_service input[type=checkbox]').live( |
376 |
'click', |
'click', |
377 |
|
'input[type=checkbox]', |
378 |
function(){ |
function(){ |
379 |
old_id = $(this).attr('name'); |
|
380 |
tab_don = $(this).attr('name').split('_'); |
old_id = $(this).attr('class'); |
381 |
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[1] == 0 ) ? 1 : 0 ) + '_'; |
|
382 |
//alert($('#' + old_id+'.cell1').attr('id')); |
tab_don = old_id.split('_'); |
383 |
$(this).attr('name', new_id); |
|
384 |
|
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_'; |
385 |
|
|
386 |
|
changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) ); |
387 |
|
$('div[class=\"' + old_id + '\"]').attr('class', new_id); |
388 |
|
$(this).attr('class', new_id); |
389 |
|
|
390 |
} |
} |
391 |
); |
); |
392 |
|
|
399 |
$('.liste_gauche_service_selected').each( |
$('.liste_gauche_service_selected').each( |
400 |
function(i) { |
function(i) { |
401 |
|
|
402 |
var id = $(this).attr('id'); |
var name = $(this).attr('name'); |
403 |
|
|
404 |
|
if ( listServ.length > 0 && listServ.indexOf(name.split('_')[1]) != -1 ) |
|
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
|
405 |
return; |
return; |
406 |
listServ[i] = id.split('_')[1]; |
listServ[i] = name.split('_')[1]; |
407 |
data += id.split('_')[1] + '_' + id.split('_')[2] + ';'; |
data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ; |
408 |
|
|
409 |
} |
} |
410 |
); |
); |
434 |
$('.liste_droite_service_selected').each( |
$('.liste_droite_service_selected').each( |
435 |
function() { |
function() { |
436 |
|
|
437 |
var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id'); |
var name = $('#'+ $(this).attr('id') + ' .cell1 div').attr('name'); |
438 |
|
|
439 |
manageListServ('.list-ser-them div', id, 1); |
manageListServ('.list-ser-them div', name, 1); |
440 |
data += id.split('_')[1] + '_' + id.split('_')[2] + ';'; |
data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ; |
441 |
|
|
442 |
$(this).remove(); |
$(this).remove(); |
443 |
} |
} |
459 |
/* |
/* |
460 |
Affiche ou cache un élément qui n'est pas une thématique et dont son identifiant correspond. |
Affiche ou cache un élément qui n'est pas une thématique et dont son identifiant correspond. |
461 |
*/ |
*/ |
462 |
function manageListServ( objet ,id, type){ |
function manageListServ( objet , name, type){ |
463 |
|
|
464 |
$(objet).each( |
$(objet).each( |
465 |
function() { |
function() { |
466 |
|
|
467 |
if ( isNotthemIsOneServ(this, id) ){ |
if ( isNotthemIsOneServ(this, name) ){ |
468 |
if ( type == 0 ) |
if ( type == 0 ) |
469 |
|
|
470 |
$(this).hide() ; |
$(this).hide() ; |
483 |
); |
); |
484 |
} |
} |
485 |
|
|
486 |
|
/* |
487 |
|
Change les actions qui sont réalisées lors de la soumission du formulaire |
488 |
|
*/ |
489 |
function changeActionVal(data){ |
function changeActionVal(data){ |
490 |
date = $('#date_envoi').val(); |
date = $('#date_envoi').val(); |
491 |
|
|
492 |
$('#form_val').attr( |
$('#form_val').attr( |
493 |
'onsubmit', |
'onsubmit', |
494 |
'if ( $(\'.liste_gauche_service_selected\').length > 0 ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?data='+data+'&idx=$idx&date_envoi='+date+'\',true);return false;' + |
'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;' + |
495 |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);}' |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir au moins un service et une date d envoi\');' |
496 |
|
|
497 |
); |
); |
498 |
$('#button_val').attr( |
$('#button_val').attr( |
499 |
'onclick', |
'onclick', |
500 |
'if ( $(\'.liste_gauche_service_selected\').length > 0 ) { messageIt(\'consultation\', \'../app/consultation_multiple.php?data='+data+'&idx=$idx&date_envoi='+date+'\',true);' + |
'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);' + |
501 |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=consultation&retourformulaire=PC&idxformulaire=PC12R0001&premier=0&tricol=\',false);}' |
'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir au moins un service et une date d envoi\');' |
502 |
|
|
503 |
); |
); |
504 |
} |
} |
505 |
|
|
506 |
|
/* |
507 |
|
Change les actions qui sont réalisées lors de la soumission du formulaire |
508 |
|
*/ |
509 |
|
function changeOneData( oldData, newData) { |
510 |
|
|
511 |
|
date = $('#date_envoi').val(); |
512 |
|
|
513 |
|
$('#form_val').attr( |
514 |
|
'onsubmit', |
515 |
|
$('#form_val').attr('onsubmit').replace(oldData,newData) |
516 |
|
); |
517 |
|
$('#button_val').attr( |
518 |
|
'onclick', |
519 |
|
$('#button_val').attr('onclick').replace(oldData,newData) |
520 |
|
); |
521 |
|
} |
522 |
|
|
523 |
function changeDataLeftColumn(){ |
function changeDataLeftColumn(){ |
524 |
|
|
525 |
$('.list-sel-ser-them').empty(); |
$('.list-sel-ser-them').empty(); |
526 |
|
$('.list-sel-ser-them').html( |
527 |
|
'<div class=\"row\">' + |
528 |
|
'<div class=\"cell1 liste_droite_title list-sel-ser-them-title\">Service a consulter</div>' + |
529 |
|
'<div class=\"cell2 liste_droite_title list-sel-ser-them-title\">Version papier</div>' + |
530 |
|
'</div>' |
531 |
|
); |
532 |
|
|
533 |
var listServ = new Array(); |
var listServ = new Array(); |
534 |
var data = ''; |
var data = ''; |
535 |
|
|
536 |
$('.liste_gauche_service_selected').each( |
$('.liste_gauche_service_selected').each( |
537 |
function(i) { |
function(i) { |
538 |
|
|
539 |
var id = $(this).attr('id'); |
var id = $(this).attr('id'); |
540 |
|
|
541 |
( i == 0 ) ? |
if ( $.inArray(id.split('_')[1], listServ) != -1 ) |
|
$('.list-sel-ser-them').append(''+ |
|
|
'<div class=\'row\'>'+ |
|
|
'<div class=\'cell1\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+ |
|
|
'<div class=\'cell2\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+ |
|
|
'</div>') |
|
|
: '' ; |
|
|
|
|
|
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
|
542 |
return; |
return; |
543 |
|
|
544 |
|
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
545 |
listServ[i] = id.split('_')[1]; |
listServ[i] = id.split('_')[1]; |
|
data += id.split('_')[1] + '_' + id.split('_')[2] + ';'; |
|
546 |
|
|
547 |
$('.list-sel-ser-them').append( |
$('.list-sel-ser-them').append( |
548 |
'<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+ |
'<div id=\'s' + i + '\' class=\'row liste_droite_service\'>'+ |
549 |
'<div class=\'cell1\'>'+ |
'<div class=\'cell1\'>'+ |
550 |
'<div id=\'' + $(this).attr('id') + '\'>'+ |
'<div class=\'' + $(this).attr('id') + '\' name=\'' + $(this).attr('id') + '\'>'+ |
551 |
$(this).html().split('<')[0]+ |
$(this).html().split('<')[0]+ |
552 |
'</div>'+ |
'</div>'+ |
553 |
'</div>' + |
'</div>' + |
554 |
'<div class=\'cell2\'>'+ |
'<div class=\'cell2\'>'+ |
555 |
'<div>'+ |
'<div>'+ |
556 |
'<'+$(this).html().split('<')[1]+ |
'<input class=\'' + $(this).attr('id') + '\''+$(this).html().split('<input')[1]+ |
557 |
'</div>'+ |
'</div>'+ |
558 |
'</div>'+ |
'</div>'+ |
559 |
'</div>' |
'</div>' |
565 |
|
|
566 |
} |
} |
567 |
); |
); |
|
|
|
568 |
changeActionVal(data); |
changeActionVal(data); |
569 |
} |
} |
570 |
</script>"; |
</script>"; |
571 |
} |
} |
|
?> |
|
572 |
|
?> |