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

   1  <?php
   2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>

   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>

   4   * Copyright (C) 2005      Marc Bariley / Ocebo      <marc@ocebo.com>

   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.5 2005/08/31 21:12:28 eldy Exp $

  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/projet/liste.php,v $

  22   */
  23  
  24  /** 

  25          \file       htdocs/projet/liste.php

  26          \ingroup    projet

  27          \brief      Page liste des projets

  28          \version    $Revision: 1.5 $

  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  if (!$user->rights->projet->lire) accessforbidden();
  34  
  35  $socid = ( is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 );
  36  
  37  $title = $langs->trans("Projects");
  38  
  39  // Sécurité accés client

  40  if ($user->societe_id > 0) $socid = $user->societe_id;
  41  
  42  if ($socid > 0)
  43  {
  44    $soc = new Societe($db);
  45    $soc->fetch($socid);
  46    $title .= ' (<a href="liste.php">'.$soc->nom.'</a>)';
  47  }
  48  
  49  
  50  $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
  51  $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
  52  $page = isset($_GET["page"])? $_GET["page"]:$_POST["page"];
  53  $page = is_numeric($page) ? $page : 0;
  54  $page = $page == -1 ? 0 : $page;
  55  
  56  if ($sortfield == "")
  57  {
  58      $sortfield="p.ref";
  59  }
  60  if ($sortorder == "")
  61  {
  62      $sortorder="ASC";
  63  }
  64  
  65  $offset = $conf->liste_limit * $page ;
  66  $pageprev = $page - 1;
  67  $pagenext = $page + 1;
  68  
  69  
  70  llxHeader();
  71  
  72  /*

  73   *

  74   * Affichage de la liste des projets

  75   * 

  76   */
  77  $sql = "SELECT p.rowid as projectid, p.ref, p.title, ".$db->pdate("p.dateo")." as do";
  78  $sql .= " , s.nom, s.idp, s.client";
  79  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."projet as p";
  80  $sql .= " WHERE p.fk_soc = s.idp";
  81  if ($socid)
  82  { 
  83    $sql .= " AND s.idp = $socid"; 
  84  }
  85  if ($_GET["search_ref"])
  86  {
  87    $sql .= " AND p.ref LIKE '%".$_GET["search_ref"]."%'";
  88  }
  89  if ($_GET["search_label"])
  90  {
  91    $sql .= " AND p.title LIKE '%".$_GET["search_label"]."%'";
  92  }
  93  if ($_GET["search_societe"])
  94  {
  95    $sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
  96  }
  97  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  98  
  99  $var=true;
 100  $resql = $db->query($sql);
 101  if ($resql)
 102  {
 103    $num = $db->num_rows($resql);
 104    $i = 0;
 105    
 106    print_barre_liste($langs->trans("Projects"), $page, "liste.php", "", $sortfield, $sortorder, "", $num);
 107    
 108    print '<table class="noborder" width="100%">';
 109    print '<tr class="liste_titre">';
 110    print_liste_field_titre($langs->trans("Ref"),"liste.php","p.ref","","","",$sortfield);
 111    print_liste_field_titre($langs->trans("Label"),"liste.php","p.title","","","",$sortfield);
 112    print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom","","","",$sortfield);
 113    print '<td>&nbsp;</td>';
 114    print "</tr>\n";
 115    
 116    print '<form method="get" action="liste.php">';
 117    print '<tr class="liste_titre">';
 118    print '<td valign="right">';
 119    print '<input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'">';
 120    print '</td>';
 121    print '<td valign="right">';
 122    print '<input type="text" class="flat" name="search_label" value="'.stripslashes($_GET["search_label"]).'">';
 123    print '</td>';
 124    print '<td valign="right">';
 125    print '<input type="text" class="flat" name="search_societe" value="'.$_GET["search_societe"].'">';
 126    print '</td>';
 127    print '<td align="center">';
 128    print '<input class="button" type="submit" value="'.$langs->trans("Search").'">';
 129    print "</td>";
 130    print "</tr>\n";
 131    
 132    while ($i < $num)
 133      {
 134        $objp = $db->fetch_object($resql);    
 135        $var=!$var;
 136        print "<tr $bc[$var]>";
 137        print "<td><a href=\"fiche.php?id=$objp->projectid\">".img_object($langs->trans("ShowProject"),"project")." ".$objp->ref."</a></td>\n";
 138        print "<td><a href=\"fiche.php?id=$objp->projectid\">".$objp->title."</a></td>\n";
 139        print '<td>';
 140        print img_object($langs->trans("ShowCompany"),"company");
 141        
 142        print '&nbsp;<a href="'.DOL_URL_ROOT.'/soc.php?socid='.$objp->idp.'">'.$objp->nom.'</a></td>';
 143        print '<td>&nbsp;</td>';
 144        print "</tr>\n";
 145        
 146        $i++;
 147      }
 148    
 149    $db->free($resql);
 150  }
 151  else
 152  {
 153    dolibarr_print_error($db);
 154  }
 155  
 156  print "</table>";
 157  
 158  $db->close();
 159  
 160  
 161  llxFooter('$Date: 2005/08/31 21:12:28 $ - $Revision: 1.5 $');
 162  
 163  ?>


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