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

   1  <?php
   2  /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
   3   * Copyright (C) 2005 Éric Seigne <eric.seigne@ryxeo.com>
   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  require  "./pre.inc.php";
  20  
  21  if (!$user->rights->categorie->lire) accessforbidden();
  22  
  23  /**
  24   * Affichage page accueil
  25   */
  26  
  27  llxHeader("","",$langs->trans("Categories"));
  28  
  29  print_titre($langs->trans("CategoriesArea"));
  30  
  31  print '<table border="0" width="100%">';
  32  
  33  print '<tr><td valign="top" width="30%">';
  34  
  35  $c = new Categorie ($db);
  36  
  37  /*
  38   * Zone recherche produit/service
  39   */
  40  print '<form method="post" action="index.php">';
  41  print '<table class="noborder" width="100%">';
  42  print '<tr class="liste_titre">';
  43  print '<td colspan="3">'.$langs->trans("Search").'</td>';
  44  print '</tr>';
  45  print '<tr '.$bc[0].'><td>';
  46  print $langs->trans("Name").'&nbsp;:</td><td><input class="flat" type="text" size="20" name="catname" value="' . $_POST['catname'] . '"/></td><td><input type="submit" value="'.$langs->trans ("Search").'"></td></tr>';
  47  print '<tr '.$bc[0].'><td>';
  48  print $langs->trans("SubCatOf").'&nbsp;:</td><td><select class="flat" name="subcatof" />';
  49  print '<option value="-1">'.$langs->trans("Choose").'</option>';
  50  
  51  $cats = $c->get_all_meres ();
  52  
  53  foreach ($cats as $cat)
  54  {
  55    print "<option value='".$cat->id."'>".htmlentities ($cat->label, ENT_QUOTES)."</option>\n";
  56  }
  57  
  58  print '</select></td><td><input type="submit" value="'.$langs->trans ("Search").'"></td></tr>';
  59  print '</table></form>';
  60  
  61  print '</td><td valign="top" width="70%">';
  62  
  63  
  64  /*
  65   * Catégories trouvées
  66   */
  67  
  68  if($_POST['catname']) {
  69    $cats = $c->rechercher_par_nom ($_POST['catname']);
  70    print '<table class="noborder" width="100%">';
  71    print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
  72    
  73    foreach ($cats as $cat)
  74      {
  75        $i = !$i;
  76        print "\t<tr ".$bc[$i].">\n";
  77        print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n";
  78        print "\t\t<td>".$cat->description."</td>\n";
  79        print "\t</tr>\n";
  80      }
  81    print "</table>";
  82    
  83  }
  84  
  85  /*
  86   * Catégories principales
  87   */
  88  $cats = $c->get_main_categories ();
  89  
  90  if ($cats != -1)
  91  {
  92    print '<table class="noborder" width="100%">';
  93    print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("MainCats").'</td></tr>';
  94    
  95    foreach ($cats as $cat)
  96      {
  97        $i = !$i;
  98        print "\t<tr ".$bc[$i].">\n";
  99        print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n";
 100        print "\t\t<td>".$cat->description."</td>\n";
 101        print "\t</tr>\n";
 102      }
 103    print "</table>";
 104  }
 105  else
 106  {
 107    dolibarr_print_error();
 108  }
 109  
 110  
 111  print '</td></tr></table>';
 112  
 113  $db->close();
 114  
 115  llxFooter("<em>Derni&egrave;re modification $Date: 2005/06/13 20:54:14 $ r&eacute;vision $Revision: 1.2 $</em>");
 116  ?>


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