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

   1  <?php
   2  /* Copyright (C) 2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   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: home.php,v 1.15 2005/09/26 01:01:53 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/user/home.php,v $
  20   */
  21  
  22  /**
  23          \file       htdocs/user/home.php
  24          \brief      Page acceuil de la zone utilisateurs et groupes
  25          \version    $Revision: 1.15 $
  26  */
  27  
  28  require ("./pre.inc.php");
  29  
  30  if (! $user->rights->user->user->lire && !$user->admin)
  31  {
  32    // Redirection vers la page de l'utilisateur
  33    Header("Location: fiche.php?id=".$user->id);
  34  }
  35  
  36  $langs->load("users");
  37  
  38  
  39  llxHeader();
  40  
  41  
  42  $lien="";
  43  if ($user->admin) $lien='<a href="'.DOL_URL_ROOT.'/user/admin/index.php">'.img_picto($langs->trans("Setup"),"setup").' '.$langs->trans("Setup").'</a>';
  44  
  45  print_fiche_titre($langs->trans("MenuUsersAndGroups"),$lien);
  46  
  47  
  48  print '<table border="0" width="100%" class="notopnoleftnoright">';
  49  
  50  print '<tr><td valign="top" width="30%" class="notopnoleft">';
  51  
  52  
  53  
  54  /*
  55   * Recherche User
  56   */
  57  $var=false;
  58  print '<form method="post" action="'.DOL_URL_ROOT.'/user/index.php">';
  59  print '<table class="noborder" width="100%">';
  60  print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAUser").'</td></tr>';
  61  print '<tr '.$bc[$var].'><td>';
  62  print $langs->trans("Ref").'</td><td><input class="flat" type="text" name="search_user" size="18"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
  63  print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td></tr>';
  64  print "</table><br>\n";
  65  print '</form>';
  66  
  67  /*
  68   * Recherche Group
  69   */
  70  $var=false;
  71  print '<form method="post" action="'.DOL_URL_ROOT.'/user/group/index.php">';
  72  print '<table class="noborder" width="100%">';
  73  print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAGroup").'</td></tr>';
  74  print '<tr '.$bc[$var].'><td>';
  75  print $langs->trans("Ref").':</td><td><input class="flat" type="text" name="search_group" size="18"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
  76  print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td></tr>';
  77  print "</table><br>\n";
  78  print '</form>';
  79  
  80  print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
  81  
  82  
  83  /*
  84   * Derniers utilisateurs créés
  85   */
  86  $max=10;
  87  
  88  $sql = "SELECT u.rowid, u.name, u.firstname, u.admin, u.login, u.code, u.fk_societe, ".$db->pdate("u.datec")." as datec,";
  89  $sql.= " s.nom";
  90  $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
  91  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe=s.idp";
  92  $sql.= " ORDER BY u.datec";
  93  $sql.= " DESC limit $max";
  94  
  95  $resql=$db->query($sql);
  96  if ($resql)
  97  {
  98      $num = $db->num_rows($resql);
  99      print '<table class="noborder" width="100%">';
 100      print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("LastUsersCreated",min($num,$max)).'</td></tr>';
 101      $var = true;
 102      $i = 0;
 103  
 104      while ($i < $num && $i < $max)
 105      {
 106          $obj = $db->fetch_object($resql);
 107          $var=!$var;
 108  
 109          print "<tr $bc[$var]>";
 110          print "<td><a href=\"".DOL_URL_ROOT."/user/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowUser"),"user")." ".$obj->firstname." ".$obj->name."</a>";
 111          if ($obj->admin) print img_picto($langs->trans("Administrator"),'star');
 112          print "</td>";
 113          print "<td align=\"left\">".$obj->login.' ('.$obj->code.')</td>';
 114          print "<td>";
 115          if ($obj->fk_societe)
 116          {
 117              print '<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->fk_societe.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a>';
 118          }
 119          else print $langs->trans("InternalUser");
 120          print '</td>';
 121          print "<td width=\"80\" align=\"center\">".dolibarr_print_date($obj->datec)."</td>";
 122          print '</tr>';
 123          $i++;
 124      }
 125      print "</table><br>";
 126  
 127      $db->free($resql);
 128  }
 129  else
 130  {
 131      dolibarr_print_error($db);
 132  }
 133  
 134  
 135  /*
 136   * Derniers groupes créés
 137   */
 138  $max=5;
 139  
 140  $sql = "SELECT g.rowid, g.nom, g.note, ".$db->pdate("g.datec")." as datec";
 141  $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
 142  $sql .= " ORDER BY g.datec DESC";
 143  if ($max) $sql .= " LIMIT $max";
 144  
 145  if ( $db->query($sql) )
 146  {
 147      $num = $db->num_rows();
 148      print '<table class="noborder" width="100%">';
 149      print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastGroupsCreated",$max).'</td></tr>';
 150      $var = true;
 151      $i = 0;
 152  
 153      while ($i < $num && (! $max || $i < $max))
 154      {
 155          $obj = $db->fetch_object();
 156          $var=!$var;
 157  
 158          print "<tr $bc[$var]>";
 159          print "<td><a href=\"".DOL_URL_ROOT."/user/group/fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowGroup"),"group")." ".$obj->nom."</a></td>";
 160          print "<td width=\"80\" align=\"center\">".dolibarr_print_date($obj->datec)."</td>";
 161          print '</tr>';
 162          $i++;
 163      }
 164      print "</table><br>";
 165  
 166      $db->free();
 167  }
 168  else
 169  {
 170      dolibarr_print_error($db);
 171  }
 172  
 173  
 174  print '</td></tr>';
 175  print '</table>';
 176  
 177  $db->close();
 178  
 179  
 180  llxFooter('$Date: 2005/09/26 01:01:53 $ - $Revision: 1.15 $');
 181  ?>


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