* Copyright (C) 2003 Jean-Louis Bergamo * * 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"); require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); $adho = new AdherentOptions($db); $form = new Form($db); if ($HTTP_POST_VARS["action"] == 'add' && $user->admin) { // type et taille non encore pris en compte => varchar(255) if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){ $adho->create($_POST['attrname'],$_POST['type'],$_POST['size']); } if (isset($_POST['label'])){ $adho->create_label($_POST['attrname'],$_POST['label']); } Header("Location: $PHP_SELF"); } if ($HTTP_POST_VARS["action"] == 'update' && $user->admin) { //if ($adho->update($user->id) ) // { // } if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){ $adho->update($_POST['attrname'],$_POST['type'],$_POST['size']); } if (isset($_POST['label'])){ $adho->update_label($_POST['attrname'],$_POST['label']); } Header("Location: $PHP_SELF"); } if ($action == 'delete' && $user->admin) { if(isset($attrname) && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){ $adho->delete($attrname); } Header("Location: $PHP_SELF"); } llxHeader(); print_titre("Configuration des champs optionnels"); /* ************************************************************************** */ /* */ /* */ /* */ /* ************************************************************************** */ $array_options=$adho->fetch_name_optionals(); $array_label=$adho->fetch_name_optionals_label(); if (sizeof($array_options)>0) { print ""; print ''; print ""; print ""; print ""; print "\n"; $var=True; foreach($adho->attribute_name as $key => $value) { $var=!$var; print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; // $i++; } print "
LibelleNom de l'attributtype  
".$adho->attribute_label[$key]." $key$valueEditerSupprimer
"; } print "

"; /* * Case 1 */ print ""; /* * Case 2 */ print ""; /* * Case 3 */ print ""; /* * Case 4 */ print ""; print "
[Nouvel attribut]---

"; /* ************************************************************************** */ /* */ /* Création d'un champ optionnel */ /* */ /* ************************************************************************** */ if ($action == 'create') { print_titre("Nouvel attribut"); print "

"; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; print "
Libellé
Nom de l\'attribut (pas d\'espace et uniquement des carateres alphanumeriques)
Type (non pris en compte)'; $form->select_array('type',array('varchar'=>'chaine', 'text'=>'texte', 'integer'=>'entier', 'date'=>'date', 'datetime'=>'date et heure')); /* print ''; */ print '
taille
\n"; } /* ************************************************************************** */ /* */ /* Edition d'un champ optionnel */ /* */ /* ************************************************************************** */ if (isset($attrname) && $attrname != '' && $action == 'edit') { print_titre("Edition du champ $attrname"); print "
"; print ''; print ''; print ''; print ''; print "
Libellé'.$adho->attribute_label[$attrname].' 
Nom de l\'attribut'.$attrname.' 
Type'.$adho->attribute_name[$attrname].' 
\n"; /* * formulaire d'edition */ print ''; print ''; print ''; print ''; print ''; print ''; list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$attrname]); print ''; // print ''; print ''; print ''; print '
Libellé
Nom de l\'attribut'.$attrname.' 
Type (non pris en compte)'; $form->select_array('type',array('varchar'=>'chaine', 'text'=>'texte', 'integer'=>'entier', 'date'=>'date', 'datetime'=>'date et heure'),$type); print '
Type (non pris en compte)
taille
'; print "
"; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>