* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ require "./pre.inc.php"; if (!$user->rights->categorie->creer) accessforbidden(); if (isset ($_REQUEST['choix'])) { $nbcats = $_REQUEST['choix']; } else { // par défault, une nouvelle catégorie sera dans une seule catégorie mère $nbcats = 1; } llxHeader("","",$langs->trans("Categories")); print_titre($langs->trans("CreateCat")); print ''; print '
'; ?>
get_all_categories ();//on récupère toutes les catégories et leurs attributs for ($i = 0; $i < $nbcats ; $i++) { echo ""; } ?> 1 && sizeof (array_unique ($cats_meres)) != sizeof ($cats_meres)) { // alors il y a des valeurs en double echo "

".$langs->trans ("ErrSameCatSelected")."

"; $OK = false; } // vérification des champs renseignés par l'utilisateur: si il y a un problème, on affiche un message d'erreur foreach ($cats_meres as $nb => $cat_mere) { if ($cat_mere == -1) { echo "

".$langs->trans ("ErrForgotCat")." ".($nb+1)."

"; $OK = false; } } // si les champs de description sont mal renseignés if ($_POST["nom"] == '') { echo "

".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Label")."\"

"; $OK = false; } else if ($c->already_exists ($_POST["nom"])) { // on regarde si le champ nom n'est pas déjà dans la table catégorie (rappel: un nom est unique dans la table catégorie // nb a déjà été renseigné, il contient le nombre de catégories echo "

".$langs->trans ("ErrCatAlreadyExists")."

"; $OK = false; } if ($_POST["description"] == '') { echo "

".$langs->trans ("ErrForgotField")." \"".$langs->trans ("Description")."\"

"; $OK = false; } // vérification pour savoir si tous les champs sont corrects if ($OK) { $nom = htmlspecialchars(stripslashes($_REQUEST['nom']) ,ENT_QUOTES); $description = htmlspecialchars(stripslashes($_REQUEST['description']),ENT_QUOTES); // creation de champs caches pour etre appele dans la classe de traitement ?>
trans ("Label"); ?> : ' />
trans ("Description"); ?> :
trans ("In"); ?> trans ("categories"); ?> " name="ok" id="ok" />
".$langs->trans ("Categorie")." ".($i+1)."

trans ("ValidateFields"); ?> ? $cat_mere) { echo ""; } ?>

'; $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>