[ Index ]

PHP Cross Reference of IEUF

title

Body

[close]

/gestion/ -> pers.php (source)

   1  <?php
   2  //Vérification accès
   3  require  'inc/autorisation.inc.php';
   4  if (NonCA()) include  'inc/404.php';
   5  ?>
   6  
   7  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   8  "http://www.w3.org/TR/html4/loose.dtd">
   9  <html>
  10    <head>
  11      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
  12      <meta http-equiv="Pragma" content="no-cache">
  13      <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  14      <meta http-equiv="expires" content="0">
  15      <title>
  16        Personnes
  17      </title>
  18      <style type="text/css">
  19  body {
  20      font-family: Arial,Helvetica,sans-serif;
  21      font-size: 10pt;
  22      }
  23      .parametres {
  24      width: 200px;
  25      height: 500px;
  26      position: fixed;
  27      min-height: 500px;
  28      background-color: #666666;
  29      color: white;
  30      }
  31      .tableau {
  32      margin-left: 205px;
  33      }
  34      #lst_rec {
  35      position: relative;
  36      background-color: #cccccc;
  37      color: black;
  38      font-style: italic;
  39      height: 100pt;
  40      max-height: 100pt;
  41      overflow: auto;
  42      }
  43  
  44      </style>
  45      <script language="JavaScript" type="text/JavaScript" src="ouvr_pers.js">
  46      </script>
  47      <script language="JavaScript" type="text/JavaScript">
  48  <!--
  49      tab_pers = new Array();
  50      <?php
  51      include  "../inclus/connect_bd.inc.php";
  52  
  53      $deb_saison= date("Y")-(date("n")<9?1:0);
  54      $deb_saison .= "-08-31";
  55      $liste_choix=array(
  56          "T" => array("Tous",", login FROM personne LEFT JOIN utilisateur on personne.id = utilisateur.id_perso "),
  57          "P" => array("Participants","FROM personne, participe,adhesion
  58                        WHERE id_perso = personne.id AND id_adh=adhesion.id AND date_adhesion > '$deb_saison' GROUP BY personne.id "),
  59          "A" => array("Adhérents non participants",
  60                        "FROM personne, adhesion LEFT JOIN participe ON adhesion.id=id_adh
  61                        WHERE id_adh IS NULL AND id_perso = personne.id AND date_adhesion > '$deb_saison' GROUP BY personne.id "),
  62          "NP" => array("Non adhérents","FROM personne LEFT JOIN adhesion ON personne.id=adhesion.id_perso WHERE adhesion.id_perso IS NULL"),
  63          "CA" => array("Membres CA","FROM personne WHERE role IS NOT NULL or role <>''"),
  64          "AN" => array("Animateurs","FROM personne, animateur WHERE id_perso = personne.id "),
  65          "PR" => array("Parents relais","FROM personne, relais_parent WHERE id_perso = personne.id "),
  66          "PP" => array("Parents","FROM personne, personne as parents WHERE parents.id_pere = personne.id or parents.id_mere = personne.id ")
  67      );
  68  
  69  
  70      function NormNom($n) {
  71        $org= "ÂÄÀÇÉÊËÈÎÏÔÖÛÜÙ?'";
  72        $dst= "AAACEEEEIIOOUUUY_";
  73        return strtr(strtoupper($n), $org, $dst);
  74      }
  75      $ind_selection= "T";
  76      if (isset ($_POST['choix'])) {
  77          $ind_selection= $_POST['choix'];
  78      }
  79      $compl_req= $liste_choix[$ind_selection][1];
  80      $requete= "SELECT personne.id, personne.civilite, personne.Nom, personne.Prenom, personne.Adr_rue, personne.Adr_comp, personne.Adr_CP, personne.Adr_ville, personne.Tel_dom, personne.mobile, personne.Email
  81                                                      $compl_req ORDER BY personne.nom, personne.Tel_dom, personne.prenom";
  82      $recherche=mysql_query($requete);
  83      if ($recherche === false) die( mysql_error());
  84      $id= 0;
  85      while ($col= mysql_fetch_assoc($recherche)) {
  86        $nom= NormNom($col['Nom']);
  87        echo "tab_pers[$id]= '$nom'; \r\n";
  88        $id++;
  89      }
  90      $rech="";
  91      if (isset ($_POST['recherche']))
  92          $rech=$_POST['recherche'];
  93      ?>
  94  
  95      function Recherche(v) {
  96        var org= "ÂÄÀÇÉÊËÈÎÏÔÖÛÜÙ?'";
  97        var dst= "AAACEEEEIIOOUUUY_";
  98        var val= "";
  99        var scroll= true;
 100        if (v.length == 0) val='###';
 101        else {
 102            v= v.toUpperCase();
 103            for (var i= 0; i < v.length; i++) {
 104              j= org.indexOf(v.charAt(i))
 105              if (j >= 0)
 106                val+= dst.charAt(j);
 107              else
 108                val+= v.charAt(i);
 109          }
 110        }
 111        for (var i= 0; i < tab_pers.length; i++) {
 112          var elt= document.getElementById('idp_'+i);
 113          if (tab_pers[i].indexOf(val) == 0) {
 114             elt.style.backgroundColor='#FFFF88';
 115             if (scroll) {
 116               elt.scrollIntoView();
 117               scroll= false;
 118             }
 119          }
 120          else
 121            elt.style.backgroundColor='';
 122        }
 123      }
 124      //-->
 125      </script>
 126    </head>
 127    <body onload="document.parametres.recherche.focus()">
 128      <div class="parametres" style="height: 21px;">
 129        <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" name="parametres" id="parametres">
 130          Sélection :<br>
 131          <select name="choix" onchange="document.parametres.submit()">
 132              <?php
 133                  foreach ($liste_choix as $idx=>$lc) {
 134                      $sel= $ind_selection == $idx ? " selected='selected'" : '';
 135                      echo "
 136                      <option value='$idx' $sel>
 137                          $lc[0]
 138                       </option>";
 139                  }
 140              ?>
 141          </select>
 142          <br>
 143          <br>
 144          <div>
 145            Rechercher :<br>
 146            <input size="25" name="recherche" autocomplete="off" onkeyup="Recherche(this.value)" value="<?php echo $rech; ?>">
 147            <br>
 148          </div><br>
 149          <input name="Publipostage" value="Publipostage" type="button">
 150          <input name="Creation" value="Ajout d'une personne" type="button" onclick="Ouvreform(0,'i')">
 151        </form>
 152      </div>
 153      <table id="liste" class="tableau" border="1" cellpadding="2" cellspacing="2">
 154        <tbody>
 155          <tr>
 156            <td align="left" width="46">
 157              Civilité
 158            </td>
 159            <td width="120">
 160              Nom
 161            </td>
 162            <td width="90">
 163              Prénom
 164            </td>
 165            <td width="196">
 166              Adresse
 167            </td>
 168            <td width="145">
 169              Ville
 170            </td>
 171            <td width="120">
 172              Tél
 173            </td>
 174            <td>
 175              Mail
 176            </td>
 177            <?php
 178            if ($ind_selection == "T")
 179                echo "
 180            <td>
 181              Login
 182            </td>
 183                    ";
 184            ?>
 185          </tr><?php $id= 0;
 186                  if (mysql_num_rows($recherche)>0) {
 187                   mysql_data_seek($recherche, 0);
 188                   while ($col= mysql_fetch_assoc($recherche)) {
 189                      $login= $ind_selection == "T" ? "<td>{$col['login']}</td>" : "";
 190                      $tel_dom= chunk_split($col['Tel_dom'], 2, " ");
 191                      $tel_mob= chunk_split($col['mobile'], 2, " ");
 192                      echo "
 193                      <tr id='idp_$id'>
 194                              <td>{$col['civilite']}</td>       
 195                              <td><a href='javascript:Ouvreform({$col['id']},\"i\")'>{$col['Nom']}</a></td>
 196                              <td>{$col['Prenom']}</td>
 197                              <td>{$col['Adr_rue']} {$col['Adr_comp']}</td>
 198                              <td>{$col['Adr_CP']} {$col['Adr_ville']}</td>
 199                              <td>$tel_dom<br>$tel_mob</td>
 200                              <td>{$col['Email']}</td>
 201                              $login
 202                      </tr>
 203                      ";
 204                      $id++;
 205                    }
 206                  }
 207                    ?>
 208        </tbody>
 209      </table>
 210      <script type="text/JavaScript">
 211          Recherche("<?php echo $rech; ?>");
 212      </script>
 213  
 214    </body>
 215  </html>


Generated: Fri Jan 31 19:59:00 2014 Cross-referenced by PHPXref 0.7.1