[ 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/adherents/ -> liste.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2002-2003 Jean-Louis Bergamo   <jlb@j1b.org>
   4   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program; if not, write to the Free Software
  18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19   *
  20   * $Id: liste.php,v 1.33 2005/08/25 20:13:41 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/liste.php,v $
  22   */
  23  
  24  /** 
  25          \file       htdocs/adherents/liste.php
  26          \ingroup    adherent
  27          \brief      Page listant les adhérents
  28          \version    $Revision: 1.33 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  require_once (DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
  34  
  35  
  36  llxHeader();
  37  
  38  
  39  $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
  40  
  41  $sortorder=$_GET["sortorder"];
  42  $sortfield=$_GET["sortfield"];
  43  $page=$_GET["page"];
  44  $filter=$_GET["filter"];
  45  $statut=isset($_GET["statut"])?$_GET["statut"]:1;
  46  
  47  if (! $sortorder) {  $sortorder="ASC"; }
  48  if (! $sortfield) {  $sortfield="d.nom"; }
  49  if ($page == -1) { $page = 0 ; }
  50  $offset = $conf->liste_limit * $page ;
  51  $pageprev = $page - 1;
  52  $pagenext = $page + 1;
  53  
  54  $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin,";
  55  $sql.= " d.email, d.fk_adherent_type as type_id, t.libelle as type, d.morphy, d.statut, t.cotisation";
  56  $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
  57  $sql.= " WHERE d.fk_adherent_type = t.rowid ";
  58  if ($sall) 
  59  {
  60      $sql.=" AND (d.prenom like '%".$sall."%' OR d.nom like '%".$sall."%' OR d.societe like '%".$sall."%'";
  61      $sql.=" OR d.email like '%".$sall."%' OR d.login like '%".$sall."%' OR d.adresse like '%".$sall."%'";
  62      $sql.=" OR d.ville like '%".$sall."%' OR d.note like '%".$sall."%')";
  63  }
  64  if ($_GET["type"])
  65  {
  66      $sql.=" AND t.rowid=".$_GET["type"];
  67  }
  68  if (isset($_GET["statut"]))
  69  {   
  70      $sql.=" AND d.statut in ($statut)";     // Peut valoir un nombre ou liste de nombre séparés par virgules
  71  }
  72  if ( $_POST["action"] == 'search')
  73  {
  74    if (isset($_POST['search']) && $_POST['search'] != ''){
  75      $sql.= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE '%".$_POST['search']."%')";
  76    }
  77  }
  78  if ($filter == 'uptodate') {
  79      $sql.=" AND datefin >= sysdate()";
  80  }
  81  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
  82  
  83  $result = $db->query($sql);
  84  if ($result) 
  85  {
  86      $num = $db->num_rows($result);
  87      $i = 0;
  88  
  89      $titre=$langs->trans("MembersList");
  90      if (isset($_GET["statut"])) {
  91          if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
  92          if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); }
  93          if ($statut == '1')  { $titre=$langs->trans("MembersListValid"); }
  94          if ($statut == '0')  { $titre=$langs->trans("MembersListResiliated"); }
  95      }
  96      elseif ($_POST["action"] == 'search') {
  97          $titre=$langs->trans("MembersListQualified");
  98      }
  99  
 100      if ($_GET["type"]) {
 101          $objp = $db->fetch_object($result);
 102          $titre.=" (".$objp->type.")";
 103      }
 104  
 105      print_barre_liste($titre, $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
 106  
 107      print "<table class=\"noborder\" width=\"100%\">";
 108  
 109      print '<tr class="liste_titre">';
 110      print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),"liste.php","d.nom","&page=$page&statut=$statut","","",$sortfield);
 111      print_liste_field_titre($langs->trans("EndSubscription"),"liste.php","t.cotisation","&page=$page&statut=$statut","","",$sortfield);
 112      print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email","&page=$page&statut=$statut","","",$sortfield);
 113      print_liste_field_titre($langs->trans("Type"),"liste.php","t.libelle","&page=$page&statut=$statut","","",$sortfield);
 114      print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy","&page=$page&statut=$statut","","",$sortfield);
 115      print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut","&page=$page&statut=$statut","","",$sortfield);
 116      print "<td>".$langs->trans("Action")."</td>\n";
 117      print "</tr>\n";
 118  
 119      $var=True;
 120      while ($i < $num)
 121      {
 122          if ($_GET["type"] && $i==0) { # Fetch deja fait
 123              } else {
 124                  $objp = $db->fetch_object($result);
 125              }
 126  
 127              $adh=new Adherent($db);
 128  
 129              $var=!$var;
 130              print "<tr $bc[$var]>";
 131              if ($objp->societe != ''){
 132                  print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_object($langs->trans("ShowAdherent"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."</a></td>\n";
 133                  }else{
 134                      print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_object($langs->trans("ShowAdherent"),"user").' '.stripslashes($objp->prenom)." ".stripslashes($objp->nom)."</a></td>\n";
 135                  }
 136                  print "<td>";
 137                  if ($objp->cotisation == 'yes')
 138                  {
 139                      if ($objp->datefin)
 140                      {
 141                          if ($objp->datefin < time())
 142                          {
 143                              print dolibarr_print_date($objp->datefin)." - ".$langs->trans("SubscriptionLate")." ".img_warning()."</td>\n";
 144                          }
 145                          else
 146                          {
 147                              print dolibarr_print_date($objp->datefin)."</td>\n";
 148                          }
 149                      }
 150                      else {
 151                          print $langs->trans("SubscriptionNotReceived")." ".img_warning()."</td>\n";
 152                      }
 153                  }
 154                  else
 155                  {
 156                      print "&nbsp;</td>";
 157                  }
 158  
 159                  print "<td>$objp->email</td>\n";
 160                  print '<td><a href="type.php?rowid='.$objp->type_id.'">'.img_object($langs->trans("ShowType"),"group").' '.$objp->type.'</a></td>';
 161                  print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
 162  
 163                  // Statut
 164                  print "<td>";
 165                  print $adh->LibStatut($objp->statut);
 166                  print "</td>";
 167  
 168                  print "<td><a href=\"edit.php?rowid=$objp->rowid&action=edit\">".img_edit()."</a> &nbsp; ";
 169                  print "<a href=\"fiche.php?rowid=$objp->rowid&action=resign\">".img_disable($langs->trans("Resiliate"))."</a> &nbsp; <a href=\"fiche.php?rowid=$objp->rowid&action=delete\">".img_delete()."</a></td>\n";
 170                  print "</tr>";
 171                  $i++;
 172              }
 173              print "</table><br>\n";
 174              print "<table class=\"noborder\" width=\"100%\">";
 175  
 176              print_barre_liste("", $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
 177  
 178              print "</table><br>\n";
 179  
 180          }
 181  else
 182  {
 183      dolibarr_print_error($db);
 184  }
 185  
 186  
 187  $db->close();
 188  
 189  llxFooter('$Date: 2005/08/25 20:13:41 $ - $Revision: 1.33 $');
 190  
 191  ?>


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