Subversion Repositories Applications.gtt

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

<?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_statut.class.php';
//fichier langues
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
//inclusion des paquets de la librairie pear
include_once 'HTML/QuickForm.php';

/**
*fonction affichant le menu afficher menu ajout statut
*/

function afficherMenuAjouterStatut()
{
  $id="AJOUTER_STATUT";
  $assoc1=array ('class' =>$id);
 
  $form=new HTML_QuickForm('statut', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_STATUT,'',$assoc1);
  
  //creation des templates pour la mise en forme
   $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");
  
 //creation et ajout des elements
 
  $form->addElement('header', 'entete', GESTION_AJOUTER_STATUT_L);
  
  //creation des Messages d'erreur
    
  $form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE);
  $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
    
 
  //ligne libelle statut
  $size=30;
  $assoc=array('class' =>$id, 'size'=>$size); 
  $ligneNomStatut =  &HTML_QuickForm::createElement('text', 'champ_nom_statut',GESTION_LIBELLE_L.': ',$assoc);
  $form->addElement($ligneNomStatut);
  
  
  //ligne bouton validation 
  $size=5;
  $assoc=array('class' =>$id, 'size'=>$size); 
  $boutonS=   &HTML_QuickForm::createElement('submit', 'champ_valider_statut',GTT_L_G_VALIDER,$assoc);
  $form->addElement($boutonS);
  
  //ajout de regles
  $form->applyFilter('champ_nom_statut', 'trim');
  
 
  $form->addRule('champ_nom_statut',GTT_ERREUR_NOM, 'required','','client');
  $form->addRule('champ_nom_statut',GTT_ERREUR_NOM, 'alphanumeric','','client');
  return $form;
}
  
/**
*fonction affichant le menu supression d'un statut
*/
function afficherMenuSupressionstatut()
{
 $id="SUPPRIMER_STATUT";
 $assoc1=array ('class' =>$id);
 
 $form=new HTML_QuickForm('gestion_categorie2', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_STATUT,'',$assoc1);
 
 //creation et ajout des elements
 
  $form->addElement('header', 'entete', GESTION_SUPPRIMER_STATUT_L);
 
   //creation des elements
  
   $assoc=array('class' =>$id);
   
   $ligne[0]=&HTML_QuickForm::createElement('select', 'champ_statut_supprimer',GTT_L_FU_STATUT." : ",'',$assoc);
   $ligne[0]->load($result) ;  
   $c="SELECT * FROM ".GEST_STATUT."";
  
   $ligne[0]->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_STATUT,GEST_CHAMPS_ID_STATUT);
   
   $ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_statut',GTT_L_G_SUPPRIMER,$assoc);
    
   //ajout 
   $form->addGroup($ligne,'groupe',"",'&nbsp',false);
   
   //ajout des regles de groupe
   $form->registerRule('verifStatutUtilise','function','verifStatutUtilise');
   $regle['champ_statut_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_STATUT,'verifStatutUtilise','','client');
   $form->addGroupRule('groupe', $regle);
   return $form;
}
?>