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                                                                                            |

// +------------------------------------------------------------------------------------------------------+
/*
*fichier contenant le menu principal de l'application de gestion du temps de travail 
*@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
*/
// +------------------------------------------------------------------------------------------------------+
include_once CHEMIN_FN_GENERIQUE_AFFICHAGE;
include_once CHEMIN_MENU.'gtt_menu_admin_projet.php';

 
 /**
 *fonction traitant l'ajout de projet
 */
 
 function traiterAjoutProjet()
 {
  if (isset($_POST["champ_valider_projet"]))
  {  
     if(isset( $_POST["champ_date_deb_projet"]))
     {
     $tabDate=$_POST["champ_date_deb_projet"];
     $t='-';
     $dateNonFormate=$tabDate['Y'];
     $dateNonFormate.=$t;
     $dateNonFormate.=$tabDate['M'];
     $dateNonFormate.=$t;
     $dateNonFormate.=$tabDate['d'];
    }else $dateNonFormate=null;
    
     $tab=array(
         GEST_CHAMPS_NOM_PROJET=>$_POST["champ_nom_projet"],
         GEST_CHAMPS_DESCRIPTION_PROJET=>$_POST["champ_description"],
         GEST_CHAMPS_DATE_DEBUT_PROJET=>$dateNonFormate,
         GEST_CHAMPS_DUREE_PREVUE_PROJET=>$_POST["champ_duree_prev_projet"],
         GEST_CHAMPS_AVANCEMENT_PROJET=>$_POST["champ_avancement_projet"],
         GEST_CHAMPS_ID_CATEGORIE=>$_POST["champ_categorie_projet"]);
                 
     $i=&Projet::nextId();
     $proj=new Projet($i);
     
     $proj->construireProjet($tab);
     $k=$proj->enregistrerNewProjet();
      
  }
  $_POST["champ_valider_projet"]='dejaValider';
  $_POST["champ_nom_projet"]='';
 }
 /**
*fonction traitant la supression de projets 
*la supression de projets entraine la suppression d'eventuelles
*taches faisant partie du projet
*/

function traiterSupprimerProjet()
{
   if(isset($_POST["btn_supprimer_projet"]))
   {
    $i=$_POST["champ_proj_supprimer"];
    
    $verif=&Projet::contientTache($i);
    
    if($verif!=1)
    {
    $b=&Projet::supprimerProjet($i);
    }else $b=0;
    if ($b==0)
    {
        echo "echec supression";
    }
    
   }
   $_POST["btn_supprimer_projet"]='dejaValider';
   $_POST["champ_proj_supprimer"]='';
}
 /**
*fonction verifiant si le projet contient des taches
*/

function verifContientTache()
{
    $i=$_POST["champ_proj_supprimer"];
    $verif=&Projet::contientTache($i);
    if ($verif==1)return false;
    else return true;
    
}

/**
*fonction traitant toutes les actions du menu admin projet
*/
function traiterAdminProjet()
{
$text=creerEntetePage(GESTION_ADMIN_PROJET_L);
//cas de l'ajout
$form=afficherMenuAjouterProjet();
if (isset($_POST["champ_valider_projet"])and $_POST["champ_valider_projet"]!='dejaValider'and $form->validate()) 
   {
       $form->process('traiterAjoutProjet');
       $t=afficherMenuAjouterProjet();
       $text.=$t->ToHTml();
   }else{
       $text.=$form->ToHtml();
   }
   
//cas de la suppression
  $forms=afficherMenuSupprimerProjet();
 if (isset($_POST["btn_supprimer_projet"]) and $_POST["btn_supprimer_projet"]!='dejaValider' and  $forms->validate())
   {
       $forms->process('traiterSupprimerProjet');
       $m=afficherMenuSupprimerProjet();
       $text.=$m->ToHtml();
   }else{
       $text.=$forms->ToHtml();
   }
   
   //affichage des options d'administration
    
    $formp=creerFormulaireOptionAdmin();
    $text.=$formp->ToHtml();
      //affichage des options disponibles pour l'utilisateur courant
    $text.=afficherOptionAplication($GLOBALS['idCurrentUser']);
    
 
 return $text;  
}
?>