43 |
|
|
44 |
foreach ($donnees as $value) { |
foreach ($donnees as $value) { |
45 |
|
|
46 |
$sql = "SELECT delai FROM service WHERE service = $value[0]"; |
$sql = "SELECT delai 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(); |
85 |
$textIdsConsultations .= "&idxConsultations[]=$value"; |
$textIdsConsultations .= "&idxConsultations[]=$value"; |
86 |
|
|
87 |
echo " |
echo " |
88 |
<script> |
<script language='javascript' type='text/javascript'> |
89 |
$.download('../app/pdfetat.php','obj=$obj$textIdsConsultations', 'POST', $obj); |
$.download('../app/pdfetat.php','obj=consultation_avec_avis_attendu$textIdsConsultations', 'POST', 'consultation_avec_avis_attendu'); |
90 |
</script> |
</script> |
91 |
"; |
"; |
92 |
} |
} |
93 |
/*Affichage du message d'information*/ |
/*Affichage du message d'information*/ |
94 |
$f->displayMessage("valid", count($donnees)._(' service(s) sélectionné(s) dont ').$nbConsPap._(' consultation(s) papier.')); |
$f->displayMessage("valid", count($donnees)._(' service(s) selectionne(s) dont ').$nbConsPap._(' consultation(s) papier.')); |
95 |
} |
} |
96 |
|
|
97 |
} |
} |
102 |
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
ser_cat.service_categorie, ser_cat.libelle AS them_lib, |
103 |
ser.service, ser.libelle AS ser_lib, ser.consultation_papier |
ser.service, ser.libelle AS ser_lib, ser.consultation_papier |
104 |
FROM |
FROM |
105 |
public.lien_service_service_categorie lie, |
".DB_PREFIXE."lien_service_service_categorie lie, |
106 |
public.service_categorie ser_cat, |
".DB_PREFIXE."service_categorie ser_cat, |
107 |
public.service ser |
".DB_PREFIXE."service ser |
108 |
WHERE |
WHERE |
109 |
ser_cat.service_categorie = lie.service_categorie AND |
ser_cat.service_categorie = lie.service_categorie AND |
110 |
ser.service = lie.service AND |
ser.service = lie.service AND |
111 |
( |
( |
112 |
ser.om_validite_fin <= CURRENT_DATE OR |
(ser.om_validite_debut IS NULL |
113 |
ser.om_validite_fin IS NULL |
AND (ser.om_validite_fin IS NULL |
114 |
|
OR ser.om_validite_fin > CURRENT_DATE)) |
115 |
|
OR |
116 |
|
(ser.om_validite_debut <= CURRENT_DATE |
117 |
|
AND (ser.om_validite_fin IS NULL |
118 |
|
OR ser.om_validite_fin > CURRENT_DATE)) |
119 |
) |
) |
120 |
|
ORDER BY them_lib, ser_lib |
121 |
"; |
"; |
122 |
|
|
123 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
124 |
|
$f->addToLog("app/consultation_multiple.php: db->query(\"".$sql."\")", VERBOSE_MODE); |
125 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
126 |
|
|
127 |
$temp_ser_cat = 0; |
$temp_ser_cat = 0; |
128 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
129 |
$name = $row['service_categorie'].'_'. |
$name = $row['service_categorie'].'_'. |
130 |
$row['service'].'_'. |
$row['service'].'_'. |
131 |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '0' : '1' ).'_'; |
132 |
/*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*/ |
133 |
if ( $temp_ser_cat != $row['service_categorie'] ){ |
if ( $temp_ser_cat != $row['service_categorie'] ){ |
134 |
|
|
138 |
$row['them_lib']. |
$row['them_lib']. |
139 |
'</div> |
'</div> |
140 |
<div |
<div |
141 |
class="liste_gauche_service '.$name.'" |
class="liste_gauche_service t'.$name.'" |
142 |
id="'.$name.'" > |
id="t'.$name.'" > |
143 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
144 |
<input id="'.$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"' ).'/> |
145 |
</div> |
</div> |
146 |
'; |
'; |
147 |
} |
} |
151 |
|
|
152 |
$liste_gauche .= ' |
$liste_gauche .= ' |
153 |
<div |
<div |
154 |
class="liste_gauche_service '.$name.'" |
class="liste_gauche_service t'.$name.'" |
155 |
id="'.$name.'" > |
id="t'.$name.'" > |
156 |
'.$row['ser_lib'].' |
'.$row['ser_lib'].' |
157 |
<input id="'.$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"' ).'/> |
158 |
</div> |
</div> |
159 |
'; |
'; |
160 |
} |
} |
164 |
/*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*/ |
165 |
$sql = |
$sql = |
166 |
"SELECT service, libelle, consultation_papier |
"SELECT service, libelle, consultation_papier |
167 |
FROM public.service |
FROM ".DB_PREFIXE."service |
168 |
WHERE service NOT IN |
WHERE service NOT IN |
169 |
( |
( |
170 |
SELECT service |
SELECT service |
171 |
FROM lien_service_service_categorie |
FROM ".DB_PREFIXE."lien_service_service_categorie |
172 |
) |
) |
173 |
AND |
AND |
174 |
( |
( |
179 |
|
|
180 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
181 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
182 |
|
|
183 |
if ( $res->numrows() > 0 ) |
if ( $res->numrows() > 0 ) |
184 |
$liste_gauche .= ' |
$liste_gauche .= ' |
185 |
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
<div id="them_0" class="liste_gauche_them">Autres</div>'; |
186 |
|
|
187 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
188 |
|
|
189 |
/*Ajout de tous les services qui n'ont pas de thématique*/ |
/*Ajout de tous les services qui n'ont pas de thématique*/ |
190 |
$name = '0_'. |
$name = '0_'. |
191 |
$row['service'].'_'. |
$row['service'].'_'. |
192 |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_'; |
(($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f' ) ? '0' : '1' ).'_'; |
193 |
$liste_gauche .= ' |
$liste_gauche .= ' |
194 |
<div |
<div |
195 |
class="liste_gauche_service '.$name.'" |
class="liste_gauche_service t'.$name.'" |
196 |
id="'.$name.'" > |
id="t'.$name.'" > |
197 |
'.$row['libelle'].' |
'.$row['libelle'].' |
198 |
<input id="'.$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"' ).'/> |
199 |
</div> |
</div> |
200 |
'; |
'; |
201 |
} |
} |
212 |
echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;" |
echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;" |
213 |
method="get" action="" name="f2" id="form_val">'; |
method="get" action="" name="f2" id="form_val">'; |
214 |
echo '<div class="formEntete ui-corner-all">'; |
echo '<div class="formEntete ui-corner-all">'; |
215 |
echo "<div id='form-content'>"; |
echo "<div>"; |
216 |
echo '<div class="bloc">'; |
echo '<div class="bloc">'; |
217 |
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n"; |
218 |
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'>". |
219 |
_("Consultation par thématique ")."</legend>"; |
_("Consultation par thematique ")."</legend>"; |
220 |
echo "<div class='fieldsetContent' style='width:100%'>"; |
echo "<div class='fieldsetContent' style='width:100%'>"; |
221 |
echo '<div class="field-ser-them field-type-hiddenstatic">'; |
echo '<div class="field-ser-them field-type-hiddenstatic">'; |
222 |
echo '<div class="form-libelle">'; |
echo '<div class="form-libelle">'; |
226 |
echo '</label>'; |
echo '</label>'; |
227 |
echo '</div>'; |
echo '</div>'; |
228 |
echo '<div class="form-content">'; |
echo '<div class="form-content">'; |
229 |
echo '<input id="dossier" class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier">'; |
echo '<input class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier"/>'; |
230 |
echo $idx; |
echo $idx; |
231 |
echo '</div>'; |
echo '</div>'; |
232 |
echo '</div>'; |
echo '</div>'; |
247 |
echo '</div>'; |
echo '</div>'; |
248 |
echo '<div class="list-sel-ser-them">'; |
echo '<div class="list-sel-ser-them">'; |
249 |
echo '<div class=\'row\'>'; |
echo '<div class=\'row\'>'; |
250 |
echo '<div class=\'cell1 liste_gauche_them\' id=\'list-sel-ser-them-title\'>'._('Service à consulter').'</div>'; |
echo '<div class=\'cell1 liste_droite_title list-sel-ser-them-title\'>'._('Service a consulter').'</div>'; |
251 |
echo '<div class=\'cell2 liste_gauche_them\' id=\'list-sel-ser-them-title\'>'._('Version papier').'</div>'; |
echo '<div class=\'cell2 liste_droite_title list-sel-ser-them-title\'>'._('Version papier').'</div>'; |
252 |
echo '</div>'; |
echo '</div>'; |
253 |
echo '</div>'; |
echo '</div>'; |
254 |
echo '</div>'; |
echo '</div>'; |
276 |
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" |
277 |
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\');" |
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\');" |
278 |
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'" |
279 |
role="button" aria-disabled="false" id="button_val">'; |
id="button_val">'; |
280 |
echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj='.$obj.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idx.'&premier=0&tricol=\');" |
echo '<a class="retour" onclick="ajaxIt(\'consultation\', \'../scr/soustab.php?obj='.$obj.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idx.'&premier=0&tricol=\');" |
281 |
href="#">'; |
href="#">'; |
282 |
echo 'Retour'; |
echo 'Retour'; |
286 |
echo '</div>'; |
echo '</div>'; |
287 |
|
|
288 |
echo " |
echo " |
289 |
<script> |
<script language='javascript' type='text/javascript'> |
290 |
$(function(){ |
$(function(){ |
291 |
|
|
292 |
/* |
/* |
293 |
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. |
294 |
*/ |
*/ |
296 |
function(){ |
function(){ |
297 |
|
|
298 |
var id = $(this).attr('id').split('_')[1]; |
var id = $(this).attr('id').split('_')[1]; |
299 |
|
var numSer = 0; |
300 |
|
var numSerWithClass = 0; |
301 |
|
|
302 |
$('.list-ser-them div').each( |
$('.list-ser-them div').each( |
303 |
function() { |
function() { |
304 |
|
|
305 |
|
if ( $(this).attr('id').indexOf('them') == -1 && |
306 |
|
$(this).attr('id').indexOf(id) == 1 && |
307 |
|
$(this).hasClass('liste_gauche_service_selected') ) |
308 |
|
|
309 |
|
numSerWithClass++; |
310 |
|
|
311 |
if ( $(this).attr('id').indexOf('them') == -1 && |
if ( $(this).attr('id').indexOf('them') == -1 && |
312 |
$(this).attr('id').indexOf(id) == 0 ){ |
$(this).attr('id').indexOf(id) == 1 ) |
313 |
$(this).toggleClass('liste_gauche_service_selected'); |
|
314 |
} |
numSer++; |
315 |
} |
} |
316 |
); |
); |
317 |
|
|
318 |
|
if ( numSerWithClass < numSer && numSerWithClass >= 0 ){ |
319 |
|
|
320 |
|
$('.list-ser-them div').each( |
321 |
|
function() { |
322 |
|
|
323 |
|
if ( $(this).attr('id').indexOf('them') == -1 && |
324 |
|
$(this).attr('id').indexOf(id) == 1 && |
325 |
|
!$(this).hasClass('liste_gauche_service_selected') ) |
326 |
|
|
327 |
|
$(this).addClass('liste_gauche_service_selected'); |
328 |
|
} |
329 |
|
); |
330 |
|
} |
331 |
|
|
332 |
|
else { |
333 |
|
|
334 |
|
$('.list-ser-them div').each( |
335 |
|
function() { |
336 |
|
|
337 |
|
if ( $(this).attr('id').indexOf('them') == -1 && |
338 |
|
$(this).attr('id').indexOf(id) == 1 && |
339 |
|
$(this).hasClass('liste_gauche_service_selected') ) |
340 |
|
|
341 |
|
$(this).removeClass('liste_gauche_service_selected'); |
342 |
|
} |
343 |
|
); |
344 |
|
} |
345 |
} |
} |
346 |
); |
); |
347 |
|
|
359 |
*/ |
*/ |
360 |
$('.field-ser-them').on( |
$('.field-ser-them').on( |
361 |
'click', |
'click', |
362 |
'.liste_droite_service', |
'.cell1', |
363 |
function(){ |
function(){ |
364 |
$(this).toggleClass('liste_droite_service_selected'); |
if ( !$(this).hasClass('liste_droite_title') ) |
365 |
|
$(this).parent().toggleClass('liste_droite_service_selected'); |
366 |
} |
} |
367 |
); |
); |
368 |
|
|
371 |
'input[type=checkbox]', |
'input[type=checkbox]', |
372 |
function(){ |
function(){ |
373 |
|
|
374 |
old_id = $(this).attr('id'); |
old_id = $(this).attr('class'); |
375 |
|
|
376 |
tab_don = old_id.split('_'); |
tab_don = old_id.split('_'); |
377 |
|
|
378 |
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_'; |
new_id = tab_don[0] + '_' + tab_don[1] + '_' + ((tab_don[2] == 0 ) ? 1 : 0 ) + '_'; |
379 |
|
|
380 |
changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) ); |
changeOneData( ';' + tab_don[1] + '_' + tab_don[2], ';' + tab_don[1] + '_' + ((tab_don[2] == 0) ? 1 : 0) ); |
381 |
$('div[name=\"' + $(this).attr('class') + '\"]').attr('id', new_id); |
$('div[class=\"' + old_id + '\"]').attr('class', new_id); |
382 |
$(this).attr('id', new_id); |
$(this).attr('class', new_id); |
383 |
|
|
384 |
} |
} |
385 |
); |
); |
393 |
$('.liste_gauche_service_selected').each( |
$('.liste_gauche_service_selected').each( |
394 |
function(i) { |
function(i) { |
395 |
|
|
396 |
var id = $(this).attr('id'); |
var name = $(this).attr('name'); |
|
|
|
397 |
|
|
398 |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
if ( listServ.length > 0 && listServ.indexOf(name.split('_')[1]) != -1 ) |
399 |
return; |
return; |
400 |
listServ[i] = id.split('_')[1]; |
listServ[i] = name.split('_')[1]; |
401 |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ; |
402 |
|
|
403 |
} |
} |
404 |
); |
); |
428 |
$('.liste_droite_service_selected').each( |
$('.liste_droite_service_selected').each( |
429 |
function() { |
function() { |
430 |
|
|
431 |
var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id'); |
var name = $('#'+ $(this).attr('id') + ' .cell1 div').attr('name'); |
432 |
|
|
433 |
manageListServ('.list-ser-them div', id, 1); |
manageListServ('.list-ser-them div', name, 1); |
434 |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ; |
435 |
|
|
436 |
$(this).remove(); |
$(this).remove(); |
437 |
} |
} |
453 |
/* |
/* |
454 |
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. |
455 |
*/ |
*/ |
456 |
function manageListServ( objet ,id, type){ |
function manageListServ( objet , name, type){ |
457 |
|
|
458 |
$(objet).each( |
$(objet).each( |
459 |
function() { |
function() { |
460 |
|
|
461 |
if ( isNotthemIsOneServ(this, id) ){ |
if ( isNotthemIsOneServ(this, name) ){ |
462 |
if ( type == 0 ) |
if ( type == 0 ) |
463 |
|
|
464 |
$(this).hide() ; |
$(this).hide() ; |
477 |
); |
); |
478 |
} |
} |
479 |
|
|
480 |
|
/* |
481 |
|
Change les actions qui sont réalisées lors de la soumission du formulaire |
482 |
|
*/ |
483 |
function changeActionVal(data){ |
function changeActionVal(data){ |
484 |
date = $('#date_envoi').val(); |
date = $('#date_envoi').val(); |
485 |
|
|
496 |
|
|
497 |
); |
); |
498 |
} |
} |
499 |
|
|
500 |
|
/* |
501 |
|
Change les actions qui sont réalisées lors de la soumission du formulaire |
502 |
|
*/ |
503 |
function changeOneData( oldData, newData) { |
function changeOneData( oldData, newData) { |
504 |
|
|
505 |
date = $('#date_envoi').val(); |
date = $('#date_envoi').val(); |
516 |
|
|
517 |
function changeDataLeftColumn(){ |
function changeDataLeftColumn(){ |
518 |
|
|
519 |
|
$('.list-sel-ser-them').empty(); |
520 |
|
$('.list-sel-ser-them').html( |
521 |
|
'<div class=\"row\">' + |
522 |
|
'<div class=\"cell1 liste_droite_title list-sel-ser-them-title\">Service a consulter</div>' + |
523 |
|
'<div class=\"cell2 liste_droite_title list-sel-ser-them-title\">Version papier</div>' + |
524 |
|
'</div>' |
525 |
|
); |
526 |
|
|
527 |
var listServ = new Array(); |
var listServ = new Array(); |
528 |
var data = ''; |
var data = ''; |
529 |
|
|
|
if ( $('.liste_droite_service').length == 0 ){ |
|
|
$('.list-sel-ser-them').empty(); |
|
|
$('.list-sel-ser-them').append(''+ |
|
|
'<div class=\'row\'>'+ |
|
|
'<div class=\'cell1 liste_gauche_them\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+ |
|
|
'<div class=\'cell2 liste_gauche_them\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+ |
|
|
'</div>') ; |
|
|
} |
|
|
|
|
530 |
$('.liste_gauche_service_selected').each( |
$('.liste_gauche_service_selected').each( |
531 |
function(i) { |
function(i) { |
532 |
|
|
|
if ( !$(this).is(':visible') ) |
|
|
return; |
|
|
|
|
533 |
var id = $(this).attr('id'); |
var id = $(this).attr('id'); |
534 |
|
|
535 |
if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 ) |
if ( $.inArray(id.split('_')[1], listServ) != -1 ) |
536 |
return; |
return; |
537 |
listServ[i] = id.split('_')[1]; |
|
538 |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ; |
539 |
|
listServ[i] = id.split('_')[1]; |
540 |
|
|
541 |
$('.list-sel-ser-them').append( |
$('.list-sel-ser-them').append( |
542 |
'<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+ |
'<div id=\'s' + i + '\' class=\'row liste_droite_service\'>'+ |
543 |
'<div class=\'cell1\'>'+ |
'<div class=\'cell1\'>'+ |
544 |
'<div name=\'' + $(this).attr('id') + '\' id=\'' + $(this).attr('id') + '\'>'+ |
'<div class=\'' + $(this).attr('id') + '\' name=\'' + $(this).attr('id') + '\'>'+ |
545 |
$(this).html().split('<')[0]+ |
$(this).html().split('<')[0]+ |
546 |
'</div>'+ |
'</div>'+ |
547 |
'</div>' + |
'</div>' + |
559 |
|
|
560 |
} |
} |
561 |
); |
); |
|
|
|
562 |
changeActionVal(data); |
changeActionVal(data); |
563 |
} |
} |
564 |
</script>"; |
</script>"; |