Subversion Repositories Applications.gtt

Rev

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

Rev Author Line No. Line
2 jpm 1
<?php
2
 
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
22
// |@author ABDOOL RAHEEM shaheen   shaheenar50@hotmail.com                                                 |
23
// |@version 3                                                                                            |
24
/*@package gtt_general
25
//Auteur original :
26
*@author        Dorian Bannier <dbannier@aol.com>
27
//Autres auteurs :
28
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
29
*@copyright     Copyright (C) 2003 Tela-Botanica
30
@version        $Date: 2004/07/06
31
*/
32
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
// |                                            INCLUSION DE FICHIERS                                       |
35
// +------------------------------------------------------------------------------------------------------+
36
 
37
include_once CHEMIN_CLASSES_METIER.'gtt_motif.class.php';
38
//fichier langues
39
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
40
//inclusion des paquets de la librairie pear
41
include_once 'HTML/QuickForm.php';
42
 
43
/**
44
*fonction affichant le menu administration des motifs d'absence
45
*/
46
 
47
function afficherMenuAjouterMotif()
48
{
49
   $id="AJOUTER_MOTIF";
50
   $size=30;
51
 
52
 
53
   $assoc1 =array('class'=>$id);
54
 
55
   $form=new HTML_QuickForm('gestion_utilisateur', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_MOTIF_ABSENCE,'', $assoc1);
56
 
57
   //creation des templates
58
   $squelette =&$form->defaultRenderer();
59
   $squelette->setFormTemplate("\n<form{attributes}>\n<ul>{content}\n</ul></form>");
60
   $squelette->setElementTemplate('<li>'."\n".'{label}'."\n".'{element}'."\n".
61
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
62
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
63
                                    '</li>'."\n");
64
 $squelette->setGroupElementTemplate('{label}{element}','groupe');
65
 $squelette->setRequiredNoteTemplate("\n".'<li>'.'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'.'</li>'."\n");
66
 $squelette->setHeaderTemplate("\n".'<li><h2>'."\n".'{header}'."\n".'</h2></li>'."\n");
67
 
68
 
69
   //entete du formulaire
70
 
71
    $form->addElement('header', 'entete', GESTION_ADMIN_MOTIF_L);
72
 
73
    //creation des Messages d'erreur
74
 
75
    $form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE);
76
    $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
77
 
78
 
79
    //creation et ajouts des elements
80
 
81
    //ligne libelle motif
82
    $size=25;
83
    $assoc=array('class' =>$id, 'size'=>$size);
84
    $ligneLibMotif=   &HTML_QuickForm::createElement('text', 'champ_nom_motif',GESTION_LIBELLE_L.': ',$assoc);
85
    $form->addElement($ligneLibMotif);
86
 
87
  //ligne bouton validation
88
   $size=5;
89
   $assoc=array('class' =>$id, 'size'=>$size);
90
   $boutonM = &HTML_QuickForm::createElement('submit', 'champ_valider_motif',GTT_L_G_VALIDER,$assoc);
91
   $form->addElement($boutonM);
92
 
93
 
94
  //ligne ajouter type RTT
95
  $size=1;
96
  $assoc=array('class' =>$id,'size'=>$size);
97
  $ligneRtt = &HTML_QuickForm::createElement('checkbox', 'champ_rtt',GESTION_QUESTION_RTT_L.': ','',$assoc);
98
  $ligneRtt->setChecked(true);
99
  $form->addElement($ligneRtt);
100
 
101
 
102
 
103
  //ajout de regles
104
  $form->applyFilter('champ_nom_motif', 'trim');
105
  $form->addRule('champ_nom_motif',GTT_ERREUR_NOM, 'required','','client');
106
  $form->addRule('champ_nom_motif',GTT_ERREUR_NOM, 'alphanumeric','','client');
107
 
108
  return $form;
109
}
110
/**
111
*fonction affichant le menu de supression d'un motif d'absence
112
*/
113
function afficherMenuSupressionMotif()
114
{
115
  $id="SUPPRIMER_MOTIF";
116
  $assoc1=array ('class' =>$id);
117
 
118
 $form=new HTML_QuickForm('gestion_motif', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_MOTIF_ABSENCE,'',$assoc1);
119
  $squelette =&$form->defaultRenderer();
120
   $squelette->setFormTemplate("\n<form{attributes}>\n<ul>{content}\n</ul></form>");
121
   $squelette->setElementTemplate('<li>'."\n".'{label}'."\n".'{element}'."\n".
122
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
123
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
124
                                    '</li>'."\n");
125
 $squelette->setGroupElementTemplate('{label}{element}','groupe');
126
 $squelette->setRequiredNoteTemplate("\n".'<li>'.'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'.'</li>'."\n");
127
 $squelette->setHeaderTemplate("\n".'<li><h2>'."\n".'{header}'."\n".'</h2></li>'."\n");
128
 
129
 
130
 //cration et ajout des elements
131
 
132
  $form->addElement('header', 'entete', GESTION_SUPPRIMER_CONDITION_L);
133
  $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
134
 
135
 //creation des elements
136
   $assoc=array('class' =>$id);
137
 
138
   $ligne[0]=&HTML_QuickForm::createElement('select', 'champ_motif_supprimer',GESTION_MOTIF_L." : ",'',$assoc);
139
   $ligne[0]->load($result) ;
140
   $c="SELECT * FROM ".GEST_MOTIF_ABSENCE."";
141
 
142
   $ligne[0]->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_MOTIF,GEST_CHAMPS_ID_MOTIF);
143
 
144
   $ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_motif',GTT_L_G_SUPPRIMER,$assoc);
145
 
146
   //ajout
147
   $form->addGroup($ligne,'groupe',"",'&nbsp',false);
148
   //ajout des regles de groupe
149
   $form->registerRule('verifMotifUtilise','function','verifMotifUtilise');
150
   $regle['champ_motif_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_MOTIF,'verifMotifUtilise','','client');
151
   $form->addGroupRule('groupe', $regle);
152
   return $form;
153
}
154
 
155
?>