Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/menu/gtt_menu_admin_projet.php
New file
0,0 → 1,189
<?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_projet.class.php';
include_once CHEMIN_CLASSES_METIER.'gtt_categorie.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 d'ajout d'un projet
*/
 
function afficherMenuAjouterProjet()
{
$id="AJOUTER_PROJET";
$assoc1=array ('class' =>$id);
$form=new HTML_QuickForm('gestion_projet', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_PROJET,'',$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('header', 'entete', GESTION_AJOUTER_PROJET_L);
//creation des Messages d'erreur
$form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE);
$form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
//ligne nom du projet
$size=30;
$assoc=array('class' =>$id, 'size'=>$size);
$ligneNomProjet= &HTML_QuickForm::createElement('text', 'champ_nom_projet',GESTION_NOM_L." : ",$assoc);
$form->addElement($ligneNomProjet);
//ligne categorie du projet
$assoc=array('class' =>$id);
$cat=&HTML_QuickForm::createElement('select', 'champ_categorie_projet',GESTION_CATEGORIE_L." : ",'',$assoc);
$cat->load($result) ;
$c="SELECT * FROM ".GEST_CATEGORIE."";
$cat->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_CATEGORIE,GEST_CHAMPS_ID_CATEGORIE);
$form->addElement($cat);
//ligne date debut prevue
$assoc=array('class'=>$id);
//definition des date sde debut et de fin
$min=date('Y')-5;
$max=date('Y')+5;
$option=array('language'=>'fr','minYear'=>$min, 'maxYear'=>$max);
$dateDeb=&HTML_QuickForm::createElement('date','champ_date_deb_projet',GESTION_DATE_DEB_PROJET_L.' : ',$option,$assoc);
$valDef=date("d,M,Y");
$dateDeb->setValue($valDef);
$form->addElement($dateDeb);
//champ duree prevue du projet compte en jours
$size=3;
$assoc=array('class'=>$id,'size'=>$size);
$dureePrev=&HTML_QuickForm::createElement('text','champ_duree_prev_projet',GESTION_DUREE_PROJET_L.':',$assoc);
$form->addElement($dureePrev);
//etat d'avancement du projet
$size=1;
$assoc=array('class'=>$id,'size'=>$size);
$valeur=array();
for ($i = 0; $i <= 100; $i++) {
array_push($valeur,$i);
}
 
$avancement=&HTML_QuickForm::createElement('select','champ_avancement_projet',GESTION_AVANCEMENT_PROJET_L.':',$valeur,$assoc);
$form->addElement($avancement);
//champ description du projet
$row=4;
$col=30;
$id="CHAMP_DESC_AJOUTER_PROJET";
$assoc=array('class '=>$id ,'rows'=>$row , 'cols'=>$col, 'wrap'=>"physical");
$description=&HTML_QuickForm::createElement('textarea','champ_description',GESTION_DESCRIPTION_L.' : ',$assoc);
$form->addElement($description);
//champ valider
$size=5;
$assoc=array('class' =>$id, 'size'=>$size);
$boutonP= &HTML_QuickForm::createElement('submit', 'champ_valider_projet',GTT_L_G_VALIDER,$assoc);
$form->addElement($boutonP);
//ajout de regles
$form->applyFilter('champ_nom_projet', 'trim');
 
$form->addRule('champ_nom_projet',GTT_ERREUR_NOM, 'required','','client');
$form->addRule('champ_nom_projet',GTT_ERREUR_NOM, 'alphanumeric','','client');
 
return $form;
}
 
 
/**supression d'un projet
*on ne peut supprimer que les projets n'ayant pas de taches
*/
function afficherMenuSupprimerProjet()
{
$id="SUPPRIMER_PROJET";
$assoc1=array ('class' =>$id);
$form=new HTML_QuickForm('gestion_projet2', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_PROJET,'',$assoc1);
//creation et ajout des elements
$form->addElement('header', 'entete', GESTION_SUPPRIMER_PROJET_L);
$form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
//creation des elements
$assoc=array('class' =>$id);
$ligne[0]=&HTML_QuickForm::createElement('select', 'champ_proj_supprimer',GESTION_PROJET_L." : ",'',$assoc);
$ligne[0]->load($result) ;
$p="SELECT * FROM ".GEST_PROJET."";
$ligne[0]->loadQuery($GLOBALS['dsn'],$p,GEST_CHAMPS_NOM_PROJET,GEST_CHAMPS_ID_PROJET);
$ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_projet',GTT_L_G_SUPPRIMER,$assoc);
//ajout
$form->addGroup($ligne,'groupe',"",'&nbsp',false);
//ajout des regles de groupe interdisant la supression
//au cas ou le projet contient des taches
$form->registerRule('verifContientTache','function','verifContientTache');
$regle['champ_proj_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_PROJ,'verifContientTache','','client');
$form->addGroupRule('groupe', $regle);
return $form;
}
?>