[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/adsl/ -> liste.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: liste.php,v 1.4 2005/08/19 14:15:36 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/adsl/liste.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if (!$user->rights->telephonie->adsl->lire) accessforbidden();
  25  
  26  $page = $_GET["page"];
  27  $sortorder = $_GET["sortorder"];
  28  $sortfield = $_GET["sortfield"];
  29  
  30  llxHeader('','Telephonie - Ligne - Liste');
  31  /*
  32   * Sécurité accés client
  33   */
  34  if ($user->societe_id > 0) 
  35  {
  36    $action = '';
  37    $socidp = $user->societe_id;
  38  }
  39  
  40  /*
  41   * Recherche
  42   *
  43   *
  44   */
  45  
  46  $offset = $conf->liste_limit * $page ;
  47  if ($sortorder == "") $sortorder="ASC";
  48  if ($sortfield == "") $sortfield="la.statut ASC, s.nom";
  49  
  50  /*
  51   * Mode Liste
  52   *
  53   *
  54   */
  55  
  56  $sql = "SELECT la.rowid, fk_client, s.nom as nom, la.numero_ligne, la.statut, t.intitule";
  57  $sql .= " , s.idp";
  58  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as la";
  59  $sql .= " ,  ".MAIN_DB_PREFIX."societe as s";
  60  $sql .= " ,  ".MAIN_DB_PREFIX."telephonie_adsl_type as t";
  61  $sql .= " WHERE la.fk_client = s.idp";
  62  $sql .= " AND t.rowid = la.fk_type";
  63  
  64  if ($_GET["search_ligne"])
  65  {
  66    $sel =urldecode($_GET["search_ligne"]);
  67    $sel = ereg_replace("\.","",$sel);
  68    $sel = ereg_replace(" ","",$sel);
  69    $sql .= " AND la.numero_ligne LIKE '%".$sel."%'";
  70  }
  71  
  72  if ($_GET["search_client"])
  73  {
  74    $sel =urldecode($_GET["search_client"]);
  75    $sql .= " AND s.nom LIKE '%".$sel."%'";
  76  }
  77  
  78  if (strlen($_GET["statut"]))
  79  {
  80    $sql .= " AND la.statut = ".$_GET["statut"];
  81  }
  82  
  83  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  84  
  85  $resql = $db->query($sql);
  86  if ($resql)
  87  {
  88    $num = $db->num_rows($resql);
  89    $i = 0;
  90    
  91    $urladd= "&amp;statut=".$_GET["statut"];
  92  
  93    print_barre_liste("Liaisons ADSL", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
  94    print"\n<!-- debut table -->\n";
  95    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  96    print '<tr class="liste_titre">';
  97  
  98    print_liste_field_titre("Ligne","liste.php","l.ligne");
  99    print_liste_field_titre("Client","liste.php","s.nom");
 100  
 101    print '<td>Type</td>';
 102    print '<td align="center">Statut</td>';
 103  
 104    print "</tr>\n";
 105    
 106    print '<tr class="liste_titre">';
 107    print '<form action="liste.php" method="GET">';
 108    print '<td><input type="text" name="search_ligne" value="'. $_GET["search_ligne"].'" size="10"></td>'; 
 109    print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="10"></td>';
 110    print '<td>&nbsp;</td>';
 111  
 112    print '<td><input type="submit" value="Chercher"></td>';
 113    print '</form>';
 114    print '</tr>';
 115    
 116  
 117    $var=True;
 118  
 119    $ligne = new LigneAdsl($db);
 120  
 121    while ($i < min($num,$conf->liste_limit))
 122      {
 123        $obj = $db->fetch_object($resql);
 124        $var=!$var;
 125  
 126        print "<tr $bc[$var]><td>";
 127  
 128        print '<img src="./statut'.$obj->statut.'.png">&nbsp;';
 129        
 130        print '<a href="'.DOL_URL_ROOT.'/telephonie/adsl/fiche.php?id='.$obj->rowid.'">';
 131        print img_file();      
 132        print '</a>&nbsp;';
 133  
 134        print '<a href="fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->numero_ligne)."</a></td>\n";
 135  
 136        print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("Fiche Compta"),"bill")."</a> ";
 137  
 138        print '&nbsp;<a href="'.DOL_URL_ROOT.'/telephonie/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
 139        print '<td>'.$obj->intitule.'</td>';
 140  
 141        print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n";
 142  
 143        print "</tr>\n";
 144        $i++;
 145      }
 146    print "</table>";
 147    $db->free($resql);
 148  }
 149  else 
 150  {
 151    print $db->error($resql) . ' ' . $sql;
 152  }
 153  
 154  $db->close();
 155  
 156  llxFooter("<em>Derni&egrave;re modification $Date: 2005/08/19 14:15:36 $ r&eacute;vision $Revision: 1.4 $</em>");
 157  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics