New file |
0,0 → 1,140 |
<?php |
|
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This library is free software; you can redistribute it and/or | |
// | modify it under the terms of the GNU Lesser General Public | |
// | License as published by the Free Software Foundation; either | |
// | version 2.1 of the License, or (at your option) any later version. | |
// | | |
// | This library 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 | |
// | Lesser General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU Lesser General Public | |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// |@author ABDOOL RAHEEM shaheen shaheenar50@hotmail.com | |
// |@version 3 | |
/*@package gtt_general |
//Auteur original : |
*@author Dorian Bannier <dbannier@aol.com> |
//Autres auteurs : |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
*@copyright Copyright (C) 2003 Tela-Botanica |
@version $Date: 2004/07/06 |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// +------------------------------------------------------------------------------------------------------+ |
// | INCLUSION DE FICHIERS | |
// +------------------------------------------------------------------------------------------------------+ |
|
include_once CHEMIN_CLASSES_METIER.'gtt_categorie.class.php'; |
//fichier langues |
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php'; |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php'; |
|
//inclusion des paquets de la librairie pear |
include_once 'HTML/QuickForm.php'; |
|
|
/** |
*fonction affichant le menu administration des categorie |
*option ajout de categorie |
*/ |
|
function afficherMenuAjouterCategorie() |
{ |
|
$id="AJOUTER_CATEGORIE"; |
$assoc1=array ('class' =>$id); |
|
$form=new HTML_QuickForm('gestion_categorie', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_CATEGORIE,'',$assoc1); |
$squelette =& $form->defaultRenderer(); |
$squelette->setFormTemplate("\n<form{attributes}>\n<ul>{content}\n</ul></form>"); |
$squelette->setElementTemplate('<li>'."\n".'{label}'."\n".'{element}'."\n". |
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n". |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n". |
'</li>'."\n"); |
$squelette->setGroupElementTemplate('{label}{element}','groupe'); |
$squelette->setRequiredNoteTemplate("\n".'<li>'.'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'.'</li>'."\n"); |
$squelette->setHeaderTemplate("\n".'<li><h2>'."\n".'{header}'."\n".'</h2></li>'."\n"); |
|
|
//creation et ajout des elements |
$form->addElement('html','<fieldset>'); |
$form->addElement('header', 'entete', GESTION_AJOUTER_CATEGORIE_L); |
|
//creation des Messages d'erreur |
|
$form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE); |
$form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER); |
|
|
//ligne nom categorie |
$size=30; |
$assoc=array('class' =>$id, 'size'=>$size); |
$ligneNomCat= &HTML_QuickForm::createElement('text', 'champ_nom_cat',GESTION_LIBELLE_L.': ',$assoc); |
$form->addElement($ligneNomCat); |
|
|
//ligne bouton validation |
$size=5; |
$assoc=array('class' =>$id, 'size'=>$size); |
$boutonC= &HTML_QuickForm::createElement('submit', 'champ_valider_cat',GTT_L_G_VALIDER,$assoc); |
$form->addElement($boutonC); |
|
|
//ajout de regles |
$form->applyFilter('champ_nom_cat', 'trim'); |
|
$form->addRule('champ_nom_cat',GTT_ERREUR_NOM, 'required','','client'); |
$form->addRule('champ_nom_cat',GTT_ERREUR_NOM, 'alphanumeric','','client'); |
$form->addElement('html','</fieldset>'); |
return $form; |
} |
|
|
/**fonction affichant le menu |
*supression d'une categorie |
*/ |
|
function afficherMenuSupressionCategorie() |
{ |
$id="SUPPRIMER_CATEGORIE"; |
$assoc1=array ('class' =>$id); |
|
$form=new HTML_QuickForm('gestion_categorie2', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_CATEGORIE,'',$assoc1); |
|
//creation et ajout des elements |
|
$form->addElement('header', 'entete', GESTION_SUPPRIMER_CATEGORIE_L); |
$form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER); |
//creation des elements |
|
$assoc=array('class' =>$id); |
|
$ligne[0]=&HTML_QuickForm::createElement('select', 'champ_cat_supprimer',GESTION_CATEGORIE_L." : ",'',$assoc); |
$ligne[0]->load($result) ; |
$c="SELECT * FROM ".GEST_CATEGORIE.""; |
|
$ligne[0]->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_CATEGORIE,GEST_CHAMPS_ID_CATEGORIE); |
|
$ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_cat',GTT_L_G_SUPPRIMER,$assoc); |
|
//ajout |
$form->addGroup($ligne,'groupe',"",' ',false); |
|
|
//ajout des regles de groupe |
$form->registerRule('verifContientProjet','function','verifContientProjet'); |
$regle['champ_cat_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_CAT,'verifContientProjet','','client'); |
$form->addGroupRule('groupe', $regle); |
return $form; |
} |
?> |