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

   1  <?php
   2  /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
   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: docreate.php,v 1.1 2005/04/13 12:07:50 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/categories/docreate.php,v $
  20   */
  21  
  22  require  "./pre.inc.php";
  23  
  24  $user->getrights('categorie');
  25  
  26  $langs->load("categories");
  27  
  28  
  29  if (!isset ($_REQUEST["nom"]) || !isset ($_REQUEST["description"]))
  30      accessforbidden();
  31  
  32  
  33  /**
  34   * Affichage page accueil
  35   */
  36  
  37  llxHeader("","",$langs->trans("Categories"));
  38  
  39  print_titre($langs->trans("CatCreated"));
  40  
  41  print '<table border="0" width="100%">';
  42  
  43  print '<tr><td valign="top" width="30%">';
  44  
  45  $cat = new Categorie ($db);
  46  
  47  $cat->label       = $_REQUEST["nom"];
  48  $cat->description = $_REQUEST["description"];
  49  
  50  $cats_meres = isset ($_REQUEST['cats_meres']) ? $_REQUEST['cats_meres'] : array ();
  51  
  52  $res = $cat->create ();
  53  if ($res < 0)
  54      {
  55      print "<p>Impossible d'ajouter la catégorie ".$cat->label.".</p>";
  56      }
  57  else
  58      {
  59      print "<p>La catégorie ".$cat->label." a été ajoutée avec succès.</p>";
  60  
  61      foreach ($cats_meres as $id)
  62          {
  63          $mere = new Categorie ($db, $id);
  64          $res = $mere->add_fille ($cat);
  65          if ($res < 0)
  66              {
  67              print "<p>Impossible d'associer la catégorie à \"".$mere->label."\" ($res).</p>";
  68              }
  69          }
  70      }
  71  
  72  
  73  print '</td></tr></table>';
  74  
  75  $db->close();
  76  ?>


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