/[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 548 by nhaye, Mon Oct 29 17:14:25 2012 UTC revision 579 by nhaye, Fri Nov 2 13:36:51 2012 UTC
# Line 1  Line 1 
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");
# Line 26  Line 35 
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                            
# Line 39  Line 50 
50                  $delai = $row[0];                  $delai = $row[0];
51                                    
52                  /*Calcul du delai de retour*/                  /*Calcul du delai de retour*/
53                  $date_envoi_temp = explode("/", $date_envoi);                  $date_envoi_temp = $om_dbform->datePHP($date_envoi);
54                  $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];  
55    
56                  /*Les données à ajouter*/                    /*Les données à ajouter*/  
57                  $arrayVal = array(                  $arrayVal = array(
# Line 81  Line 90 
90                      </script>                      </script>
91                  ";                  ";
92              }              }
               
93              /*Affichage du message d'information*/              /*Affichage du message d'information*/
94              echo '<div class="subtitle">';              $f->displayMessage("valid", count($donnees)._(' service(s) s&eacute;lectionn&eacute;(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&eacute;lectionn&eacute;(s) dont '.$nbConsPap.' consultation(s) papier.  
                             </span>  
                         </p>  
                     </div>';    
             echo '</div>';  
95          }          }
96                    
97      }      }
# Line 246  Line 238 
238                                              echo '</ul>';                                              echo '</ul>';
239                                          echo '</div>';                                          echo '</div>';
240                                          echo '<div class="list-sel-ser-them">';                                          echo '<div class="list-sel-ser-them">';
241                                                echo '<div class=\'row\'>';
242                                                    echo '<div class=\'cell1 liste_gauche_them\' id=\'list-sel-ser-them-title\'>'._('Service a consulter').'</div>';
243                                                    echo '<div class=\'cell2 liste_gauche_them\' id=\'list-sel-ser-them-title\'>'._('Version papier').'</div>';
244                                                echo '</div>';
245                                          echo '</div>';                                          echo '</div>';
246                                      echo '</div>';                                      echo '</div>';
247                                      /* -- FIN --*/                                      /* -- FIN --*/
# Line 270  Line 266 
266                  echo '</div>';                  echo '</div>';
267                  echo '<div class="formControls">';                  echo '<div class="formControls">';
268                      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"
269                            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\');"
270                            value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'"                            value="Ajouter le(s) enregistrement(s) de la table : \'Consultation\'"
271                            role="button" aria-disabled="false" id="button_val">';                            role="button" aria-disabled="false" id="button_val">';
272                      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=\');"
273                            href="#">';                            href="#">';
274                         echo 'Retour';                         echo 'Retour';
275                     echo '</a>';                     echo '</a>';
# Line 291  Line 287 
287                      function(){                      function(){
288                                                    
289                          var id = $(this).attr('id').split('_')[1];                          var id = $(this).attr('id').split('_')[1];
290                            var numSer = 0;
291                            var numSerWithClass = 0;
292                            
293                          $('.list-ser-them div').each(                          $('.list-ser-them div').each(
294                              function() {                              function() {
295                                            
296                                    if ( $(this).attr('id').indexOf('them') == -1 &&
297                                         $(this).attr('id').indexOf(id) == 0  &&
298                                         $(this).hasClass('liste_gauche_service_selected') )
299                                        
300                                         numSerWithClass++;                                    
301                                                                    
302                                  if ( $(this).attr('id').indexOf('them') == -1 &&                                  if ( $(this).attr('id').indexOf('them') == -1 &&
303                                       $(this).attr('id').indexOf(id) == 0 ){                                       $(this).attr('id').indexOf(id) == 0  )
304                                      $(this).toggleClass('liste_gauche_service_selected');                                      
305                                  }                                      numSer++;
306                              }                              }
307                          );                          );
308                            
309                            if ( numSerWithClass < numSer && numSerWithClass >= 0 ){
310                            
311                                 $('.list-ser-them div').each(
312                                    function() {
313                                        
314                                        if ( $(this).attr('id').indexOf('them') == -1 &&
315                                         $(this).attr('id').indexOf(id) == 0 &&
316                                         !$(this).hasClass('liste_gauche_service_selected') )
317                                        
318                                            $(this).addClass('liste_gauche_service_selected');
319                                    }
320                                );
321                            }
322                            
323                            else {
324                                
325                                $('.list-ser-them div').each(
326                                    function() {
327                                        
328                                       if ( $(this).attr('id').indexOf('them') == -1 &&
329                                        $(this).attr('id').indexOf(id) == 0  &&
330                                        $(this).hasClass('liste_gauche_service_selected') )
331                                        
332                                           $(this).removeClass('liste_gauche_service_selected');
333                                    }
334                               );
335                            }
336                      }                      }
337                  );                  );
338                                    
# Line 317  Line 350 
350                  */                  */
351                  $('.field-ser-them').on(                  $('.field-ser-them').on(
352                      'click',                      'click',
353                      '.liste_droite_service',                      '.cell1',
354                      function(){                      function(){
355                          $(this).toggleClass('liste_droite_service_selected');                          $(this).parent().toggleClass('liste_droite_service_selected');
356                      }                      }
357                  );                  );
358                                    
# Line 352  Line 385 
385                                                                    
386                                  var id = $(this).attr('id');                                  var id = $(this).attr('id');
387                                                                    
                                   
388                                  if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )                                  if ( listServ.length > 0 && listServ.indexOf(id.split('_')[1]) != -1 )
389                                      return;                                      return;
390                                  listServ[i] = id.split('_')[1];                                  listServ[i] = id.split('_')[1];
# Line 435  Line 467 
467                  );                  );
468              }              }
469                            
470                /*
471                    Change les actions qui sont réalisées lors de la soumission du formulaire
472                */
473              function changeActionVal(data){              function changeActionVal(data){
474                  date = $('#date_envoi').val();                  date = $('#date_envoi').val();
475                                    
476                  $('#form_val').attr(                  $('#form_val').attr(
477                      'onsubmit',                      'onsubmit',
478                      'if ( $(\'.liste_gauche_service_selected\').length > 0 ) { 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;' +
479                      '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\');'
480                                            
481                  );                  );
482                  $('#button_val').attr(                  $('#button_val').attr(
483                      'onclick',                      'onclick',
484                      'if ( $(\'.liste_gauche_service_selected\').length > 0 ) { 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);' +
485                      '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\');'
486                                            
487                  );                  );
488              }              }
489                
490                /*
491                    Change les actions qui sont réalisées lors de la soumission du formulaire
492                */
493              function changeOneData( oldData, newData) {              function changeOneData( oldData, newData) {
494                                    
495                  date = $('#date_envoi').val();                  date = $('#date_envoi').val();
# Line 475  Line 513 
513                      $('.list-sel-ser-them').empty();                      $('.list-sel-ser-them').empty();
514                      $('.list-sel-ser-them').append(''+                      $('.list-sel-ser-them').append(''+
515                                  '<div class=\'row\'>'+                                  '<div class=\'row\'>'+
516                                      '<div class=\'cell1\' id=\'list-sel-ser-them-title\'>"._('Service à consulter')."</div>'+                                      '<div class=\'cell1 liste_gauche_them\' id=\'list-sel-ser-them-title\'>"._('Service a consulter')."</div>'+
517                                      '<div class=\'cell2\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+                                      '<div class=\'cell2 liste_gauche_them\' id=\'list-sel-ser-them-title\'>"._('Version papier')."</div>'+
518                                  '</div>') ;                                  '</div>') ;
519                  }                  }
520                                    
# Line 519  Line 557 
557              }              }
558          </script>";          </script>";
559      }      }
     ?>  
560        ?>

Legend:
Removed from v.548  
changed lines
  Added in v.579

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26