[ 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/user/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: index.php,v 1.26 2005/10/22 13:48:47 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/user/index.php,v $
  21   */
  22   
  23  /**
  24          \file       htdocs/user/index.php
  25          \brief      Page d'accueil de la gestion des utilisateurs
  26          \version    $Revision: 1.26 $
  27  */
  28  
  29  require ("./pre.inc.php");
  30  
  31  $user->getrights();
  32  
  33  if (! $user->rights->user->user->lire && ! $user->admin) accessforbidden();
  34  
  35  $langs->load("users");
  36  
  37  $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
  38  
  39  $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
  40  $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
  41  $page=isset($_GET["page"])?$_GET["page"]:$_POST["page"];
  42  if ($page < 0) $page = 0;
  43  
  44  $limit = $conf->liste_limit;
  45  $offset = $limit * $page ;
  46  
  47  if (! $sortfield) $sortfield="u.login";
  48  if (! $sortorder) $sortorder="ASC";
  49  
  50  
  51  llxHeader();
  52  
  53  print_titre($langs->trans("ListOfUsers"));
  54  
  55  $sql = "SELECT u.rowid, u.name, u.firstname, u.admin, u.code, u.fk_societe, u.login, ".$db->pdate("u.datec")." as datec,";
  56  $sql.= " s.nom";
  57  $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
  58  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.idp";
  59  $sql.= " WHERE 1=1";
  60  if ($_POST["search_user"])
  61  {
  62      $sql.= " AND (u.name like '%".$_POST["search_user"]."%' OR u.firstname like '%".$_POST["search_user"]."%')";
  63  }
  64  if ($sall) $sql.= " AND (u.login like '%".$sall."%' OR u.name like '%".$sall."%' OR u.firstname like '%".$sall."%' OR u.code like '%".$sall."%' OR u.email like '%".$sall."%' OR u.note like '%".$sall."%')";
  65  if ($sortfield) $sql.=" ORDER BY $sortfield $sortorder";
  66  
  67  $result = $db->query($sql);
  68  if ($result)
  69  {
  70      $num = $db->num_rows($result);
  71      $i = 0;
  72  
  73      print "<br>";
  74  
  75      $param="search_user=$search_user&amp;sall=$sall";
  76      print "<table class=\"noborder\" width=\"100%\">";
  77      print '<tr class="liste_titre">';
  78      print_liste_field_titre($langs->trans("Login"),"index.php","u.login",$param,"","",$sortfield);
  79      print_liste_field_titre($langs->trans("Lastname"),"index.php","u.name",$param,"","",$sortfield);
  80      print_liste_field_titre($langs->trans("Firstname"),"index.php","u.firstname",$param,"","",$sortfield);
  81      print_liste_field_titre($langs->trans("Code"),"index.php","u.code",$param,"","",$sortfield);
  82      print_liste_field_titre($langs->trans("Company"),"index.php","u.fk_societe",$param,"","",$sortfield);
  83      print_liste_field_titre($langs->trans("DateCreation"),"index.php","u.datec",$param,"","",$sortfield);
  84      print "</tr>\n";
  85      $var=True;
  86      while ($i < $num)
  87      {
  88          $obj = $db->fetch_object($result);
  89          $var=!$var;
  90  
  91          print "<tr $bc[$var]>";
  92          if ($obj->login)
  93          {
  94              print '<td><a href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.'</a>';
  95              if ($obj->admin) 
  96              {
  97                  print img_picto($langs->trans("Administrator"),'star');
  98              }
  99              print '</td>';
 100          }
 101          else
 102          {
 103              print '<td><a class="impayee" href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' Inactif</a>';
 104              if ($obj->admin) 
 105              {
 106                  print img_picto($langs->trans("Administrator"),'star');
 107              }
 108              print '</td>';
 109          }
 110          print '<td>'.ucfirst($obj->name).'</td>';
 111          print '<td>'.ucfirst($obj->firstname).'</td>';
 112          print '<td>'.$obj->code.'</td>';
 113          print "<td>";
 114          if ($obj->fk_societe)
 115          {
 116              print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->fk_societe.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a>';
 117          }
 118          else print $langs->trans("InternalUser");
 119          print '</td>';
 120          print '<td width="100" align="center">'.dolibarr_print_date($obj->datec,"%d %b %Y").'</td>';
 121          print "</tr>\n";
 122          $i++;
 123      }
 124      print "</table>";
 125      $db->free($result);
 126  }
 127  else
 128  {
 129      dolibarr_print_error($db);
 130  }
 131  
 132  $db->close();
 133  
 134  llxFooter('$Date: 2005/10/22 13:48:47 $ - $Revision: 1.26 $');
 135  ?>


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