New file |
0,0 → 1,155 |
<?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_motif.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 administration des motifs d'absence |
*/ |
|
function afficherMenuAjouterMotif() |
{ |
$id="AJOUTER_MOTIF"; |
$size=30; |
|
|
$assoc1 =array('class'=>$id); |
|
$form=new HTML_QuickForm('gestion_utilisateur', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_MOTIF_ABSENCE,'', $assoc1); |
|
//creation des templates |
$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"); |
|
|
//entete du formulaire |
|
$form->addElement('header', 'entete', GESTION_ADMIN_MOTIF_L); |
|
//creation des Messages d'erreur |
|
$form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE); |
$form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER); |
|
|
//creation et ajouts des elements |
|
//ligne libelle motif |
$size=25; |
$assoc=array('class' =>$id, 'size'=>$size); |
$ligneLibMotif= &HTML_QuickForm::createElement('text', 'champ_nom_motif',GESTION_LIBELLE_L.': ',$assoc); |
$form->addElement($ligneLibMotif); |
|
//ligne bouton validation |
$size=5; |
$assoc=array('class' =>$id, 'size'=>$size); |
$boutonM = &HTML_QuickForm::createElement('submit', 'champ_valider_motif',GTT_L_G_VALIDER,$assoc); |
$form->addElement($boutonM); |
|
|
//ligne ajouter type RTT |
$size=1; |
$assoc=array('class' =>$id,'size'=>$size); |
$ligneRtt = &HTML_QuickForm::createElement('checkbox', 'champ_rtt',GESTION_QUESTION_RTT_L.': ','',$assoc); |
$ligneRtt->setChecked(true); |
$form->addElement($ligneRtt); |
|
|
|
//ajout de regles |
$form->applyFilter('champ_nom_motif', 'trim'); |
$form->addRule('champ_nom_motif',GTT_ERREUR_NOM, 'required','','client'); |
$form->addRule('champ_nom_motif',GTT_ERREUR_NOM, 'alphanumeric','','client'); |
|
return $form; |
} |
/** |
*fonction affichant le menu de supression d'un motif d'absence |
*/ |
function afficherMenuSupressionMotif() |
{ |
$id="SUPPRIMER_MOTIF"; |
$assoc1=array ('class' =>$id); |
|
$form=new HTML_QuickForm('gestion_motif', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_MOTIF_ABSENCE,'',$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"); |
|
|
//cration et ajout des elements |
|
$form->addElement('header', 'entete', GESTION_SUPPRIMER_CONDITION_L); |
$form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER); |
|
//creation des elements |
$assoc=array('class' =>$id); |
|
$ligne[0]=&HTML_QuickForm::createElement('select', 'champ_motif_supprimer',GESTION_MOTIF_L." : ",'',$assoc); |
$ligne[0]->load($result) ; |
$c="SELECT * FROM ".GEST_MOTIF_ABSENCE.""; |
|
$ligne[0]->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_MOTIF,GEST_CHAMPS_ID_MOTIF); |
|
$ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_motif',GTT_L_G_SUPPRIMER,$assoc); |
|
//ajout |
$form->addGroup($ligne,'groupe',"",' ',false); |
//ajout des regles de groupe |
$form->registerRule('verifMotifUtilise','function','verifMotifUtilise'); |
$regle['champ_motif_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_MOTIF,'verifMotifUtilise','','client'); |
$form->addGroupRule('groupe', $regle); |
return $form; |
} |
|
?> |