/[openfoncier]/trunk/app/consultation_multiple.php
ViewVC logotype

Diff of /trunk/app/consultation_multiple.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 572 by vpihour, Wed Oct 31 15:34:17 2012 UTC revision 670 by vpihour, Mon Nov 12 16:28:16 2012 UTC
# Line 85  Line 85 
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=$obj$textIdsConsultations', 'POST', $obj);
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&eacute;lectionn&eacute;(s) dont ').$nbConsPap._(' consultation(s) papier.'));              $f->displayMessage("valid", count($donnees)._(' service(s) selectionne(s) dont ').$nbConsPap._(' consultation(s) papier.'));
95          }          }
96                    
97      }      }
# Line 102  Line 102 
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
# Line 131  Line 131 
131                      $row['them_lib'].                      $row['them_lib'].
132                  '</div>                  '</div>
133                      <div                      <div
134                          class="liste_gauche_service '.$name.'"                          class="liste_gauche_service t'.$name.'"
135                          id="'.$name.'" >                          id="t'.$name.'" >
136                          '.$row['ser_lib'].'                          '.$row['ser_lib'].'
137                          <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"' ).'/>
138                      </div>                      </div>
139                  ';                  ';
140              }              }
# Line 144  Line 144 
144                                    
145                  $liste_gauche .= '                  $liste_gauche .= '
146                      <div                      <div
147                          class="liste_gauche_service '.$name.'"                          class="liste_gauche_service t'.$name.'"
148                          id="'.$name.'" >                          id="t'.$name.'" >
149                          '.$row['ser_lib'].'                          '.$row['ser_lib'].'
150                          <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"' ).'/>
151                      </div>                      </div>
152                  ';                  ';
153              }              }
# Line 157  Line 157 
157          /*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*/
158          $sql =          $sql =
159              "SELECT service, libelle, consultation_papier              "SELECT service, libelle, consultation_papier
160              FROM public.service              FROM ".DB_PREFIXE."service
161              WHERE service NOT IN              WHERE service NOT IN
162                  (                  (
163                      SELECT service                      SELECT service
164                      FROM lien_service_service_categorie                      FROM ".DB_PREFIXE."lien_service_service_categorie
165                  )                  )
166                   AND                   AND
167                  (                  (
# Line 172  Line 172 
172                    
173          $res = $f->db->query($sql);          $res = $f->db->query($sql);
174          $f->isDatabaseError($res);          $f->isDatabaseError($res);
175                
176          if ( $res->numrows() > 0 )          if ( $res->numrows() > 0 )
177              $liste_gauche .= '              $liste_gauche .= '
178                  <div id="them_0" class="liste_gauche_them">Autres</div>';                  <div id="them_0" class="liste_gauche_them">Autres</div>';
179                    
180          while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) {          while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
181                
182              /*Ajout de tous les services qui n'ont pas de thématique*/              /*Ajout de tous les services qui n'ont pas de thématique*/
183              $name = '0_'.              $name = '0_'.
184                      $row['service'].'_'.                      $row['service'].'_'.
185                      (($row['consultation_papier'] == '' || $row['consultation_papier'] == FALSE ) ? '0' : '1' ).'_';                      (($row['consultation_papier'] == '' || $row['consultation_papier'] == 'f'  ) ? '0' : '1' ).'_';
186              $liste_gauche .= '              $liste_gauche .= '
187                  <div                  <div
188                      class="liste_gauche_service '.$name.'"                      class="liste_gauche_service t'.$name.'"
189                      id="'.$name.'" >                      id="t'.$name.'" >
190                      '.$row['libelle'].'&nbsp;                      '.$row['libelle'].'&nbsp;
191                      <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"' ).'/>
192                  </div>                  </div>
193              ';              ';
194          }          }
# Line 204  Line 205 
205              echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;"              echo '<form onsubmit="ajaxIt(\'consultation\', \'../app/consultation_multiple.php\');return false;"
206                    method="get" action="" name="f2" id="form_val">';                    method="get" action="" name="f2" id="form_val">';
207                  echo '<div class="formEntete ui-corner-all">';                  echo '<div class="formEntete ui-corner-all">';
208                      echo "<div id='form-content'>";                      echo "<div>";
209                          echo '<div class="bloc">';                          echo '<div class="bloc">';
210                              echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n";                              echo "<fieldset class='cadre ui-corner-all ui-widget-content'>\n";
211                                  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'>".
212                                      _("Consultation par th&eacute;matique ")."</legend>";                                      _("Consultation par thematique ")."</legend>";
213                                  echo "<div class='fieldsetContent' style='width:100%'>";                                  echo "<div class='fieldsetContent' style='width:100%'>";
214                                      echo '<div class="field-ser-them field-type-hiddenstatic">';                                      echo '<div class="field-ser-them field-type-hiddenstatic">';
215                                          echo '<div class="form-libelle">';                                          echo '<div class="form-libelle">';
# Line 218  Line 219 
219                                              echo '</label>';                                              echo '</label>';
220                                          echo '</div>';                                          echo '</div>';
221                                          echo '<div class="form-content">';                                          echo '<div class="form-content">';
222                                              echo '<input id="dossier" class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier">';                                              echo '<input class="champFormulaire" type="hidden" value="'.$idx.'" name="dossier"/>';
223                                              echo $idx;                                              echo $idx;
224                                          echo '</div>';                                          echo '</div>';
225                                      echo '</div>';                                      echo '</div>';
# Line 238  Line 239 
239                                              echo '</ul>';                                              echo '</ul>';
240                                          echo '</div>';                                          echo '</div>';
241                                          echo '<div class="list-sel-ser-them">';                                          echo '<div class="list-sel-ser-them">';
242                                                echo '<div class=\'row\'>';
243                                                    echo '<div class=\'cell1 liste_droite_title list-sel-ser-them-title\'>'._('Service a consulter').'</div>';
244                                                    echo '<div class=\'cell2 liste_droite_title list-sel-ser-them-title\'>'._('Version papier').'</div>';
245                                                echo '</div>';
246                                          echo '</div>';                                          echo '</div>';
247                                      echo '</div>';                                      echo '</div>';
248                                      /* -- FIN --*/                                      /* -- FIN --*/
# Line 262  Line 267 
267                  echo '</div>';                  echo '</div>';
268                  echo '<div class="formControls">';                  echo '<div class="formControls">';
269                      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"
270                            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\');"
271                            value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'"                            value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'"
272                            role="button" aria-disabled="false" id="button_val">';                            id="button_val">';
273                      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=\');"
274                            href="#">';                            href="#">';
275                         echo 'Retour';                         echo 'Retour';
# Line 274  Line 279 
279          echo '</div>';          echo '</div>';
280                    
281          echo "          echo "
282          <script>          <script language='javascript' type='text/javascript'>
283              $(function(){              $(function(){
284                    
285                  /*                  /*
286                      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.
287                  */                  */
# Line 283  Line 289 
289                      function(){                      function(){
290                                                    
291                          var id = $(this).attr('id').split('_')[1];                          var id = $(this).attr('id').split('_')[1];
292                            var numSer = 0;
293                            var numSerWithClass = 0;
294                            
295                          $('.list-ser-them div').each(                          $('.list-ser-them div').each(
296                              function() {                              function() {
297                                            
298                                    if ( $(this).attr('id').indexOf('them') == -1 &&
299                                         $(this).attr('id').indexOf(id) == 1  &&
300                                         $(this).hasClass('liste_gauche_service_selected') )
301                                        
302                                         numSerWithClass++;                                    
303                                                                    
304                                  if ( $(this).attr('id').indexOf('them') == -1 &&                                  if ( $(this).attr('id').indexOf('them') == -1 &&
305                                       $(this).attr('id').indexOf(id) == 0 ){                                       $(this).attr('id').indexOf(id) == 1  )
306                                      $(this).toggleClass('liste_gauche_service_selected');                                      
307                                  }                                      numSer++;
308                              }                              }
309                          );                          );
310                            
311                            if ( numSerWithClass < numSer && numSerWithClass >= 0 ){
312                            
313                                 $('.list-ser-them div').each(
314                                    function() {
315                                        
316                                        if ( $(this).attr('id').indexOf('them') == -1 &&
317                                         $(this).attr('id').indexOf(id) == 1 &&
318                                         !$(this).hasClass('liste_gauche_service_selected') )
319                                        
320                                            $(this).addClass('liste_gauche_service_selected');
321                                    }
322                                );
323                            }
324                            
325                            else {
326                                
327                                $('.list-ser-them div').each(
328                                    function() {
329                                        
330                                       if ( $(this).attr('id').indexOf('them') == -1 &&
331                                        $(this).attr('id').indexOf(id) == 1  &&
332                                        $(this).hasClass('liste_gauche_service_selected') )
333                                        
334                                           $(this).removeClass('liste_gauche_service_selected');
335                                    }
336                               );
337                            }
338                      }                      }
339                  );                  );
340                                    
# Line 309  Line 352 
352                  */                  */
353                  $('.field-ser-them').on(                  $('.field-ser-them').on(
354                      'click',                      'click',
355                      '.liste_droite_service',                      '.cell1',
356                      function(){                      function(){
357                          $(this).toggleClass('liste_droite_service_selected');                          if ( !$(this).hasClass('liste_droite_title') )
358                                $(this).parent().toggleClass('liste_droite_service_selected');
359                      }                      }
360                  );                  );
361                                    
# Line 320  Line 364 
364                      'input[type=checkbox]',                      'input[type=checkbox]',
365                      function(){                      function(){
366                                                    
367                          old_id = $(this).attr('id');                          old_id = $(this).attr('class');
368                                                    
369                          tab_don = old_id.split('_');                          tab_don = old_id.split('_');
370                                                    
371                          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 ) + '_';
372    
373                          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) );
374                          $('div[name=\"' + $(this).attr('class') + '\"]').attr('id', new_id);                          $('div[class=\"' + old_id + '\"]').attr('class', new_id);
375                          $(this).attr('id', new_id);                          $(this).attr('class', new_id);
376    
377                      }                      }
378                  );                  );
# Line 342  Line 386 
386                          $('.liste_gauche_service_selected').each(                          $('.liste_gauche_service_selected').each(
387                              function(i) {                              function(i) {
388                                                                    
389                                  var id = $(this).attr('id');                                  var name = $(this).attr('name');
                                   
390                                                                    
391                                  if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )                                  if ( listServ.length > 0 && listServ.indexOf(name.split('_')[1]) != -1 )
392                                      return;                                      return;
393                                  listServ[i] = id.split('_')[1];                                  listServ[i] = name.split('_')[1];
394                                  data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;                                  data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ;
395                                                                    
396                              }                              }
397                          );                          );
# Line 378  Line 421 
421                          $('.liste_droite_service_selected').each(                          $('.liste_droite_service_selected').each(
422                              function() {                              function() {
423                                                                    
424                                  var id = $('#'+ $(this).attr('id') + ' .cell1 div').attr('id');                                  var name = $('#'+ $(this).attr('id') + ' .cell1 div').attr('name');
425                                                                    
426                                  manageListServ('.list-ser-them div', id, 1);                                  manageListServ('.list-ser-them div', name, 1);
427                                  data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;                                  data += ';' + name.split('_')[1] + '_' + name.split('_')[2] ;
428                                                                    
429                                  $(this).remove();                                  $(this).remove();
430                              }                              }
# Line 403  Line 446 
446              /*              /*
447                  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.
448              */              */
449              function manageListServ( objet ,id, type){              function manageListServ( objet , name, type){
450            
451                  $(objet).each(                  $(objet).each(
452                      function() {                      function() {
453                                                    
454                          if ( isNotthemIsOneServ(this, id) ){                          if ( isNotthemIsOneServ(this, name) ){
455                              if ( type == 0 )                              if ( type == 0 )
456                                                            
457                                  $(this).hide() ;                                  $(this).hide() ;
# Line 427  Line 470 
470                  );                  );
471              }              }
472                            
473                /*
474                    Change les actions qui sont réalisées lors de la soumission du formulaire
475                */
476              function changeActionVal(data){              function changeActionVal(data){
477                  date = $('#date_envoi').val();                  date = $('#date_envoi').val();
478                                    
479                  $('#form_val').attr(                  $('#form_val').attr(
480                      'onsubmit',                      'onsubmit',
481                      '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;' +                      '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;' +
482                      'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');'                      '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\');'
483                                            
484                  );                  );
485                  $('#button_val').attr(                  $('#button_val').attr(
486                      'onclick',                      'onclick',
487                      '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);' +                      '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);' +
488                      'messageIt(\'consultation\', \'../scr/soustab.php?obj=$obj&retourformulaire=$retourformulaire&idxformulaire=$idx&premier=0&tricol=\',false);} else alert(\'Veuillez choisir une service et une date d envoi\');'                      '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\');'
489                                            
490                  );                  );
491              }              }
492                
493                /*
494                    Change les actions qui sont réalisées lors de la soumission du formulaire
495                */
496              function changeOneData( oldData, newData) {              function changeOneData( oldData, newData) {
497                                    
498                  date = $('#date_envoi').val();                  date = $('#date_envoi').val();
# Line 467  Line 516 
516                      $('.list-sel-ser-them').empty();                      $('.list-sel-ser-them').empty();
517                      $('.list-sel-ser-them').append(''+                      $('.list-sel-ser-them').append(''+
518                                  '<div class=\'row\'>'+                                  '<div class=\'row\'>'+
519                                      '<div class=\'cell1\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+                                      '<div class=\'cell1 liste_droite_title list-sel-ser-them-title\'>"._('Service a consulter')."</div>'+
520                                      '<div class=\'cell2\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+                                      '<div class=\'cell2 liste_droite_title list-sel-ser-them-title\'>"._('Version papier')."</div>'+
521                                  '</div>') ;                                  '</div>') ;
522                  }                  }
523                                    
524                  $('.liste_gauche_service_selected').each(                  $('.liste_gauche_service_selected').each(
525                      function(i) {                      function(i) {
526                                                    
527                            var id = $(this).attr('id');
528                            data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;
529                            
530                          if ( !$(this).is(':visible') )                          if ( !$(this).is(':visible') )
531                              return;                              return;
                               
                         var id = $(this).attr('id');  
532                                                    
533                          if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )                          if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )
534                              return;                              return;
535                          listServ[i] = id.split('_')[1];                          listServ[i] = id.split('_')[1];
536                          data += ';' + id.split('_')[1] + '_' + id.split('_')[2] ;                          
537                                                    
538                          $('.list-sel-ser-them').append(                          $('.list-sel-ser-them').append(
539                              '<div class=\'row liste_droite_service\' id=\'' + i + '\'>'+                              '<div id=\'s' + i + '\' class=\'row liste_droite_service\'>'+
540                                  '<div class=\'cell1\'>'+                                  '<div class=\'cell1\'>'+
541                                      '<div name=\'' + $(this).attr('id') + '\' id=\'' + $(this).attr('id') + '\'>'+                                      '<div class=\'' + $(this).attr('id') + '\' name=\'' + $(this).attr('id') + '\'>'+
542                                          $(this).html().split('<')[0]+                                          $(this).html().split('<')[0]+
543                                      '</div>'+                                      '</div>'+
544                                  '</div>' +                                  '</div>' +

Legend:
Removed from v.572  
changed lines
  Added in v.670

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26