Subversion Repositories Applications.gtt

Rev

Rev 5 | Go to most recent revision | Blame | Compare with Previous | 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
*/
// +------------------------------------------------------------------------------------------------------+
// |                                            INCLUSION DE FICHIERS                                       |
// +------------------------------------------------------------------------------------------------------+
error_reporting(E_ALL);
//fichiers de la bibliotheque PEAR
include_once "Auth/Auth.php";
include_once "DB.php";
include_once 'gtt_config.inc.php';
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
include_once CHEMIN_CLASSES.'gtt_authentification.php';
include_once CHEMIN_FN_GENERIQUE_AFFICHAGE;
include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
include_once CHEMIN_MENU.'gtt_menu_travail.php';
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_motif_absence.php';
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_projet.php';
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_statut.php';
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
include_once CHEMIN_CONTROLEUR.'gtt_controleur_travail.php';
include_once CHEMIN_CONTROLEUR.'gtt_controleur_editer_preferences.php';
include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php';


//definition des constantes
define ("GESTION_TRAVAIL",1);
define ("GESTION_ADMIN_UTILISATEUR", 13);
define ("GESTION_EDITER_UTILISATEUR",14);
define ("GESTION_ADMIN_PROJET",15);
define ("GESTION_ADMIN_CATEGORIE",16);
define ("GESTION_ADMIN_MOTIF_ABSENCE",17);
define ("GESTION_ADMIN_STATUT",18);
define ("GESTION_ADMIN_FRAIS",19);
define ("GESTION_ADMIN_TACHE",20);
define ("GESTION_EDITER_PREFERENCES",21);
define ("GESTION_DECONNEXION",22); 

//creation du dsn
//connexion a la base de donnees
$GLOBALS['db']=DB::connect($GLOBALS['dsn']);

if (DB::isError($GLOBALS['db']))
{
 $GLOBALS['db']->getMessage();
 echo "echec connexion a la base de donnees";
}



$params=array(
          "dsn"=>$GLOBALS['dsn'],
          "table"=>GEST_UTILISATEUR,
          "usernamecol"=>GEST_CHAMPS_EMAIL,
          "passwordcol"=>GEST_CHAMPS_PASSWORD,
          "cryptype"=>"md5",
          "db_fields"=>"*");
        
//creation de l'objet auth 

$a = new Auth("DB",$params,"afficherMenuConnexion",true);

$a->setSessionname('temps_travail');
$a->setExpire(3600*24*30);

$a->start();
echo $a->getStatus();

if ($a->getAuth())
{
     $mail=$a->getUserName();
     $utilisateur=&Utilisateur::recupIDUtilisateurMail($mail);
     $GLOBALS['idCurrentUser']=$utilisateur;
     //recuperation de l'identifiant de la personne
     
     //test des choix de menu a afficher
    
     if (empty($action)){ $action = 1 ;} 
   switch ($action)
   {
       //cas affichage menu travail 1
       case GESTION_TRAVAIL :
       if (!isset($semaine))
         {
        $semaine=date('W',mktime(0,0,0,date('m'),date('d'),date('Y')));
         }
         if (!isset($annee))
         {
        $annee=date('Y');
         }
        $text=traiterAdminTravail($_SERVER["PHP_SELF"],$semaine,$annee,$utilisateur);
       
       break;
       
       //cas affichage du menu ajout autilisateurss 13
       case GESTION_ADMIN_UTILISATEUR :
        $text=traiterAdminUtilisateur('',0);
       break;
       
       //cas editer des utilisateurs 14
       case GESTION_EDITER_UTILISATEUR :
        $text=traiterAdminUtilisateur(renvoyerDonneesUser(),1);
       break;
       
       //cas afficher menu administration projet 15
       case GESTION_ADMIN_PROJET :
       $text=traiterAdminProjet();
       break;
       
       //cas afficher menu administration categorie 16
       case GESTION_ADMIN_CATEGORIE :
       $text=traiterAdminCategorie();
       break;
       
       //cas afficher menu admin motif absence 17 
       case GESTION_ADMIN_MOTIF_ABSENCE :
       $text=traiterAdminMotif();
       break;
       
       //cas afficher menu admin statut 18
       case GESTION_ADMIN_STATUT :
       $text=traiterAdminStatut();
       break;
       
       //cas afficher admin editer frais 19 
       case GESTION_ADMIN_FRAIS :
       $text='';
       break;
       
       //cas afficher admin editer taches 20
       case GESTION_ADMIN_TACHE :
       $text='';
       break;
       
       //cas editer preferences d'un utilisateur 21
       case GESTION_EDITER_PREFERENCES :
       $text=traiterEditerPreferences($GLOBALS['idCurrentUser']);
       break;
       
       //cas deconnexion 22
       case GESTION_DECONNEXION :
       $a->logout();
       $text=afficherMenuConnexion();
       //$GLOBALS['db']->disconnect();
       break;
       
   }
   $text.=fermerBalisesFin();
   echo $text;
}else 
{
echo afficherMenuConnexion();
}

//tester le choix de l'utilisateur


?>