Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 10 → Rev 11

/trunk/test.php
File deleted
/trunk/documentation/gtt_v4.sql
1,5 → 1,5
DROP DATABASE IF EXISTS `gestion_v4`;
CREATE DATABASE `gestion_v4` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE DATABASE `gestion_v4` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 
CREATE TABLE `gestion_v4`.gestion_absence (
ga_id_abscence INTEGER(11) UNSIGNED NOT NULL,
9,7 → 9,7
ga_date_fin DATE NOT NULL DEFAULT "0000-00-00",
ga_date_envoi_lettre DATE NOT NULL DEFAULT "0000-00-00",
PRIMARY KEY(ga_id_abscence)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_absence_motif (
gam_id_absence_motif TINYINT(3) UNSIGNED NOT NULL,
17,7 → 17,7
gam_mark_rtt BOOL NOT NULL,
gam_nbre_heure INT(11) NULL,
PRIMARY KEY(gam_id_absence_motif)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_frais_km (
gfk_id_frais_km INTEGER(11) UNSIGNED NOT NULL,
29,13 → 29,13
gfk_trajet VARCHAR(255) NULL,
gfk_montant_total FLOAT NOT NULL,
PRIMARY KEY(gfk_id_frais_km)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_frais_km_taux (
gfkt_id_frais_km_taux INTEGER(11) UNSIGNED NOT NULL,
gfkt_taux FLOAT NOT NULL,
PRIMARY KEY(gfkt_id_frais_km_taux)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_note_frais (
gnf_id_note_frais INTEGER(11) UNSIGNED NOT NULL,
42,7 → 42,7
gnf_ce_utilisateur INTEGER(11) UNSIGNED NOT NULL,
gnf_libelle VARCHAR(255) NOT NULL,
PRIMARY KEY(gnf_id_note_frais)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_note_frais_ligne (
gnfl_id_note_frais_ligne INTEGER(11) UNSIGNED NOT NULL,
52,7 → 52,7
gnfl_taux_tva FLOAT NULL,
gnfl_montant_ttc FLOAT NOT NULL,
PRIMARY KEY(gnfl_id_note_frais_ligne)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_projet (
gp_id_projet INTEGER(11) UNSIGNED NOT NULL,
63,13 → 63,13
gp_duree_prevue FLOAT NULL,
gp_avancement INTEGER(11) NULL,
PRIMARY KEY(gp_id_projet)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_projet_categorie (
gpc_id_categorie INTEGER(11) UNSIGNED NOT NULL,
gpc_libelle VARCHAR(255) NOT NULL,
PRIMARY KEY(gpc_id_categorie)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_projet_tache (
gpt_id_tache INTEGER(11) UNSIGNED NOT NULL,
81,7 → 81,7
gpt_duree_prevue INTEGER(11) UNSIGNED NULL,
gpt_avancement INTEGER(11) NULL,
PRIMARY KEY(gpt_id_tache)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_travail_projet (
gtp_id_utilisateur INTEGER(11) UNSIGNED NOT NULL,
89,7 → 89,7
gtp_id_date_travail DATE NOT NULL DEFAULT "0000-00-00",
gtp_duree FLOAT NOT NULL DEFAULT 0,
PRIMARY KEY(gtp_id_utilisateur, gtp_id_projet, gtp_id_date_travail)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_travail_tache (
gtt_id_utilisateur INTEGER(11) UNSIGNED NOT NULL,
97,7 → 97,7
gtt_id_date_travail DATE NOT NULL,
gtt_duree FLOAT NOT NULL DEFAULT 0,
PRIMARY KEY(gtt_id_utilisateur, gtt_id_tache, gtt_id_date_travail)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_utilisateur (
gu_id_utilisateur INTEGER(11) UNSIGNED NOT NULL,
117,16 → 117,16
gu_mark_recapitulatif BOOL NULL,
gu_notes TEXT NULL,
PRIMARY KEY(gu_id_utilisateur)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_utilisateur_a_projet (
guap_id_utilisateur INTEGER(11) UNSIGNED NOT NULL,
guap_id_projet INTEGER(11) UNSIGNED NOT NULL,
PRIMARY KEY(guap_id_utilisateur, guap_id_projet)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
 
CREATE TABLE `gestion_v4`.gestion_utilisateur_statut (
gus_id_utilisateur_statut TINYINT(3) UNSIGNED NOT NULL,
gus_libelle VARCHAR(255) NOT NULL,
PRIMARY KEY(gus_id_utilisateur_statut)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
/trunk/presentation/connexion.tpl.html
New file
0,0 → 1,20
 
<form action="<?=$url;?>" method="post" name="login" id="login">
<fieldset>
<legend>Identifiez vous</legend>
<table id="connexion">
<caption>Identification</caption>
<tr>
<th>Courriel</th>
<td><input name="username" type="text" /></td>
</tr>
<tr>
<th>Mot de passe</th>
<td><input name="password" type="password" /></td>
</tr>
<tr>
<td colspan="2"><input name="btn_submit" value="OK" type="submit" /></td>
</tr>
</table>
</fieldset>
</form>
/trunk/presentation/principal.tpl.html
3,10 → 3,19
<head>
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="presentation/gtt_vert.css" media="screen" title="Vert" />
<title>Editer Preferences</title>
<title><?=$titre;?></title>
</head>
<body>
<h1 id="titre_principal"><?=$titre;?></h1>
<div id="contenu_principal"><?=$contenu_principal;?></div>
<div id="zone_contenu_principal"><?=$zone_contenu;?></div>
<div id="zone_identification"><?=$zone_identification;?></div>
<div id="zone_menu">
<h2>Menu</h2>
<ul>
<li><a href="index.php?action=<?=GTT_ACTION_GESTION;?>">Gestion de mon temps de travail</a></li>
<li><a href="index.php?action=<?=GTT_ACTION_PREFERENCE;?>">Gestion de mes projets</a></li>
<li><a href="index.php?action=<?=GTT_ACTION_DECONNEXION;?>">Déconnexion</a></li>
</ul>
</div>
</body>
</html>
/trunk/presentation/gtt_vert.css
194,14 → 194,6
float: left;
}
 
/*ID pour la div contenant le calendrier*/
#calendrier {
text-align: center;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 1.1em;
color: #BB0000;
}
 
/*ID pour la div contenant la navigation dans le calendrier du menu travail*/
#navigation_calendrier_travail {
text-align: center;
216,18 → 208,46
color: #BB0000;
}
 
/*ID pour la div contenant le jour courant dans le calendrier*/
#jourcourant {
color: #BB0000;
background-color: #FFFFFF;
border-color: #74C054;
border-width: 4px;
border-style: outset;
}
/* GTT VERSION 4 */
/* presentation des listes de definitions */
dl {width:100%;}
dt {
float:left;
font-weight: bold;
line-height:1.1em;
text-align:top left;
margin-right:0.3em;}
dd {
width:auto;
margin-left:0;
line-height:1.1em;
margin:0.5em 0;}
.ajout_2_points dt:after {content:" : ";}
 
#calendrier {
font-family:verdana, arial, helvetica, sans-serif;
font-size:1.1em;}
#calendrier table {background-color: silver;}
.selected {
background-color: yellow;
}
.empty {
color: white;
}
#calendrier table td {text-align: center;}
#calendrier caption {font-weight: bold;}
#calendrier .categorie {
font-size:1.6em;
text-align:left;
padding:1px;
margin-top:0;
margin-bottom:0;}
#calendrier .projet {
text-align:left;
font-weight:bold;}
.jour_courrant {
color:#BB0000;
background-color:yellow;
border-color:#74C054;
border-width:2px;
border-style:outset;}
.jour_ferie {
background-color:red;
border-color:#74C054;
border-width:2px;
border-style:outset;}
.jour_vide {color:white;}
/trunk/presentation/identite.tpl.html
New file
0,0 → 1,7
<h2>Votre identité</h2>
<dl class="ajout_2_points">
<dt>Prénom</dt>
<dd><?=$prenom;?></dd>
<dt>Nom</dt>
<dd><?=$nom;?></dd>
</dl>
/trunk/presentation/gestion.tpl.html
1,15 → 1,20
<dl>
<dl class="ajout_2_points">
<dt>Vous devez travailler</dt>
<dd><?=$tps_w;?> heures par jour</dd>
<dt>Congés payés restants</dt>
<dd>22 jours</dd>
<dd><?=$conges_payes;?> jours</dd>
<dt>Heures supp restantes</dt>
<dd> 2 jours 6heures </dd>
<dd><?=$rtt;?> heures</dd>
</dl>
 
<p>Aujourd'hui, nous sommes le <a href="<?=$jc_url;?>"><?=$jc['jour'];?> <?=$jc['mois_nom'];?> <?=$jc['annee'];?></a></p>
<p>Semaine du <a href="<?=$jc_url;?>"><?=$sjc_1['jour'];?> <?=$sjc_1['mois'];?> <?=$sjc_1['annee'];?> au <?=$sjc_7['jour'];?> <?=$sjc_7['mois'];?> <?=$sjc_7['annee'];?></a></p>
<div id="calendrier">
<p><a href="<?=$url_mois_precedent;?>">Mois précédent</a> - <a href="<?=$url_mois_suivant;?>">Mois suivant</a></p>
<p><a href="<?=$url_semaine_precedente;?>">Semaine précédente</a> - <a href="<?=$url_semaine_suivante;?>">Semaine suivante</a></p>
<table>
<caption><?=$mois_courant_nom;?></caption>
<caption>
<a href="<?=$url_mois_precedent;?>">&lt;&lt;</a>
<?=$mois['mois'];?> <?=$mois['annee'];?>
<a href="<?=$url_mois_suivant;?>">&gt;&gt;</a>
</caption>
<thead>
<tr>
<th>Lun</th>
26,16 → 31,52
<tr>
<?php foreach ($semaine as $jour) : ?>
<td class="<?=$jour['class'];?>">
<? if ($jour['class'] == 'empty') :?>
<? if ($jour['class'] == 'jour_vide') :?>
<?=$jour['jour'];?>
<? else :?>
<a href="index.php?action=<?=GTT_ACTION_GESTION;?>&amp;annee=<?=$jour['annee'];?>&amp;mois=<?=$jour['mois'];?>&amp;jour=<?=$jour['jour'];?>"><?=$jour['jour'];?></a>
<a href="<?=$jour['url'];?>"><?=$jour['jour'];?></a>
<? endif;?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
 
<form id="gestion" name="gestion" action="<?=$url_gestion_valider;?>" method="post">
<table>
<caption>
<a href="<?=$url_semaine_precedente;?>">&lt;&lt;</a>
<?=$sj_1['jour'];?> <?=$sj_1['mois'];?> <?=$sj_1['annee'];?> au <?=$sj_7['jour'];?> <?=$sj_7['mois'];?> <?=$sj_7['annee'];?>
<a href="<?=$url_semaine_suivante;?>">&gt;&gt;</a>
</caption>
<thead>
<tr>
<th>Projets</th>
<?php foreach ($elements[$s] as $jour) : ?>
<th class="<?=$jour['class'];?>">
<? if ($jour['class'] == 'jour_vide') :?>
<?=$jour['jour_nom'];?> <?=$jour['jour'];?>
<? else :?>
<a href="<?=$jour['url'];?>"><?=$jour['jour_nom'];?> <?=$jour['jour'];?></a>
<? endif;?>
</th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?foreach ($preferences as $categorie => $projets):?>
<tr><td colspan="8" class="categorie"><?=$categorie;?></td></tr>
<?foreach ($projets as $projet):?><tr>
<td class="projet"><?=$projet['nom'];?></td>
<?php foreach ($elements[$s] as $num => $jour) : ?>
<td class="<?=$jour['class'];?>"><input id="pr:<?=$projet['id'];?>:<?=$num;?>" name="pr:<?=$projet['id'];?>:<?=$num;?>" value="<?=$projet['date'][$num];?>" type="text"/></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
<input id="btn_valider" name="btn_valider" value="<?=$i18n_general_valider;?>" type="submit" />
</form>
</div>
/trunk/classes/Controlleur.class.php
File deleted
\ No newline at end of file
/trunk/classes/aAction.class.php
File deleted
\ No newline at end of file
/trunk/classes/Resultat.class.php
File deleted
\ No newline at end of file
/trunk/classes/Registre.class.php
New file
0,0 → 1,83
<?php
 
class Registre {
private static $registre = null;
private $suivant;
private $titre;
private $espaces = array();
private $donnees = array();
private $squelettes;
 
public static function getRegistre()
{
if (is_null(Registre::$registre)) {
Registre::$registre = new Registre;
}
return Registre::$registre;
}
// Titre
public function getTitre()
{
return $this->titre;
}
public function setTitre($t)
{
$this->titre = $t;
}
// Espaces De Nomage
public function setEspaces($e)
{
$this->espaces = $e;
}
public function ajouterEspace($cle, $val)
{
$this->espaces[$cle] = $val;
}
public function getEspaces($cle = null)
{
if ($cle != null) {
return $this->espaces[$cle];
} else {
return $this->espaces;
}
}
// Donnees
public function setDonnees($d)
{
$this->donnees = $d;
}
public function ajouterDonnee($cle, $val)
{
$this->donnees[$cle] = $val;
}
public function getDonnees($cle = null)
{
if (!is_null($cle)) {
return $this->donnees[$cle];
} else {
return $this->donnees;
}
}
 
// Squelettes
public function setSquelettes($s)
{
$this->squelettes = $s;
}
public function ajouterSquelette($cle, $val)
{
$this->squelettes[$cle] = $val;
}
public function getSquelettes($cle = null)
{
if ($cle != null) {
return $this->squelettes[$cle];
} else {
return $this->squelettes;
}
}
}
?>
/trunk/classes/aControlleurAction.class.php
New file
0,0 → 1,73
<?php
 
abstract class aControlleurAction {
private $suivant;
public function getRegistre()
{
return Registre::getRegistre();
}
// Suivant
public function getSuivant()
{
return $this->suivant;
}
public function setSuivant($s)
{
if (is_array($s)){
$this->suivant = $s;
} else {
$this->suivant[] = $s;
}
}
public function demarrer()
{
if (!is_null($this->getSuivant())) {
// ATTENTION :
// Il est important de laisser "count($this->getSuivant())" $this->getSuivant() peut varier de taille
for ($i = 0; $i < count($this->getSuivant()) ; $i++) {
$liste_actions = $this->getSuivant();
if ($liste_actions[$i] instanceof aControlleurAction) {
$liste_actions[$i]->demarrer();
} else {
if ($liste_actions[$i] == '__defaut__') {
$methode = 'executer';
} else {
$methode = 'executer'.$liste_actions[$i];
}
if (method_exists($this, $methode)) {
$this->$methode();
} else {
$m = "La méthode $methode de la classe ".get_class($this)." est introuvable!";
trigger_error($m, E_USER_ERROR);
}
}
}
} else {
$m = "Le registre ne contient aucune action!";
trigger_error($m, E_USER_ERROR);
}
}
public function verifier()
{
// Nous rassemblons les valeurs du tableau _POST contenant des : dans des sous-tableau de _POST.
foreach ($_POST as $cle => $val) {
$morceau = array();
if (preg_match('/^(.+?)(:.+)+$/', $cle, $morceau)) {
$table = '';
foreach (explode(':', trim($morceau[2], ':')) as $c) {
$table .= '['.$c.']';
}
eval('$_POST[$morceau[1]]'.$table.' = $val;');
unset($_POST[$cle]);
}
}
}
 
abstract protected function executer();
}
?>
/trunk/classes/Calendrier.class.php
59,19 → 59,10
private $mois;
private $semaine;
private $jour;
private $nom_jours = array();
private $nom_mois = array();
private $liste_feries = array();
/** contient le nom des variables que recevra l'url spécifié
* @var string
*/
var $var_jour = "jour";
var $var_mois = "mois";
var $var_annee = "annee";
 
/**
*constructeur de la classe calendrier
*toutes les variables sont initialises avec les donnees
80,24 → 71,28
*@param semaine
*@param annee
*/
public function __construct($semaine = null, $annee = null)
public function __construct($jour = null, $semaine = null, $mois = null, $annee = null)
{
if (is_null($jour)) {
$jour = date('d', time());
}
$this->jour = $jour;
if (is_null($semaine)) {
$semaine = date('W', time());
}
$this->semaine = $semaine;
if (is_null($mois)) {
$mois = date('m', time());
}
$this->mois = $mois;
if (is_null($annee)) {
// TODO : vérifier le standard ISO-8601
$annee = date('Y', time());
}
$tableau = $this->donnerLundiEtDimancheSemaine($semaine, $annee);
$this->jour = date('d',mktime(0,0,0,1,$tableau[0],$annee));
$this->semaine = $semaine;
$this->mois = date('n',mktime(0,0,0,1,$tableau[0],$annee));
$this->annee = $annee;
$this->nom_jours = array (GESTION_LUN_L, GESTION_MAR_L, GESTION_MER_L, GESTION_JEU_L, GESTION_VEN_L, GESTION_SAM_L ,GESTION_DIM_L);
$this->nom_mois = array(1 => "Janvier","Février","Mars","Avril","Mai","Juin","Juillet", "Août","Septembre","Octobre","Novembre","Décembre");
$this->nom_jours = array (1 => GESTION_LUN_L, GESTION_MAR_L, GESTION_MER_L, GESTION_JEU_L, GESTION_VEN_L, GESTION_SAM_L ,GESTION_DIM_L);
$this->nom_mois = array(1 => "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
$this->liste_feries = $this->calculerJoursFeries($this->annee);
}
122,6 → 117,27
return $this->jour;
}
public function getNomJours($j = null)
{
if (is_null($j)) {
return $this->nom_jours;
}
return $this->nom_jours[$j];
}
 
public function getNomMois($m = null)
{
if (is_null($m)) {
return $this->nom_mois;
}
return $this->nom_mois[$m];
}
public function getListeFeries()
{
return $this->liste_feries;
}
/**
*Calcule les dates des jours fériés pour la france.
*Renvoie un tableau contenant la liste de dates par mois.
200,131 → 216,6
}
 
/**
*Donne le type de jour de la semaine au format numérique du premier jour du mois.
*
*@return integer le numéro de 1 (lundi) à 7 (dimanche) correspondant au type du premier jour du mois.
*/
function donnerTypePremierJourMois()
{
$intPremierJour = date("w", mktime(0, 0, 0, $this->getMois(), 1, $this->getAnnee()));
if ($intPremierJour == 0) {
$intPremierJour = 7; // si c'est un dimanche
}
return $intPremierJour;
}
 
/**
*Calcule le dernier jour du mois
*@param : annee, mois
*renvoie un entier
*/
function donnerDernierJourMois()
{
$h = $this->donnerNbreJoursMois();
$intDernierJour = date("w", mktime(0, 0, 0, $this->getMois(), $h, $this->getAnnee()));
if($intDernierJour == 0) {
$intDernierJour = 7; // si c'est un dimanche
}
return $intDernierJour;
}
/**
*Calcule le nombre de jours dans un mois
*@return integer le nombre de jour dans le mois.
*/
function donnerNbreJoursMois()
{
return date("t", mktime(0, 0, 0, $this->getMois(), 1, $this->getAnnee()));
}
 
/**
*Calcule la semaine suivante
*/
function donnerSemaineSuivante()
{
if ($this->getSemaine() == date('W', mktime(0, 0, 0, 12, 31, $this->getAnnee()))) {
$tab['semaine'] = 1;
$tab['annee'] = $this->getAnnee() + 1;
} else {
$tab['semaine'] = $this->getSemaine() + 1;
$tab['annee'] = $this->getAnnee();
}
return $tab;
}
 
/**
*Calule la semaine précédente
*/
function donnerSemainePrecedente()
{
if ($this->getSemaine() == 1) {
$tab['semaine'] = date('W', mktime(0, 0, 0, 12, 31, ($this->getAnnee() - 1)));
$tab['annee'] = $this->annee - 1;
} else {
$tab['semaine'] = $this->semaine - 1 ;
$tab['annee'] = $this->annee;
}
return $tab;
}
 
/**
*Calucule le mois suivant
*renvoie l'annee et le mois suivant sous forme de chiffre
*dans un tableau
*/
function donnerMoisSuivant()
{
if ($this->mois == 12) {
$tab['mois'] = 1;
$tab['annee'] = $this->annee + 1;
} else {
$tab['mois'] = $this->mois + 1;
$tab['annee'] = $this->annee;
}
return $tab;
}
/**
*Calcule le mois precedent
*renvoie l'annee et le mois precedent sous forme de chiffre
*/
function donnerMoisPrecedent()
{
if ($this->mois == 1) {
$tab['mois'] = 12;
$tab['annee'] = $this->annee - 1;
} else {
$tab['mois'] = $this->mois - 1;
$tab['annee'] = $this->annee;
}
return $tab;
}
/**
*Renvoie la date du lundi et dimanche d'une semaine
*a partir du numero de semaine
*
*@return un tableau contenat le timestamp unix de lundi et dimanche
*de la semaine en question
*/
function donnerLundiEtDimancheSemaine()
{
if ((date("w", mktime(0, 0, 0, 1, 1, $this->getAnnee())) <= 4) && (date("w", mktime(0, 0, 0, 1, 1, $this->getAnnee())) != 0)) {
$nbre_jour = ($this->getSemaine() - 1) * 7;
} else {
$nbre_jour = ($this->getSemaine()) * 7;
}
if (date("w", mktime(0, 0, 0, 1, 1, $this->getAnnee())) == 0) {
$nbre_jour += 7;
} else {
$nbre_jour += 7 - ((date("w", mktime(0, 0, 0, 1, 1, $this->getAnnee())) - 1) % 7);
}
$nbre_jour_7 = $nbre_jour - 6;
return array($nbre_jour_7, $nbre_jour);
}
 
/**
*Indique si une date est fériée ou non
*renvoie 1 si férié
*0 sinon
337,116 → 228,5
return 0;
}
}
 
/**
*Affiche un calendrier naviguable par semaine
*option pour cliquer sur une semaine donnee
*utilisation de la bibliotheque HTML/TABLE de PEAR
*@param numero de semaine et annee
*/
function afficherCalendrier($annee)
{
$id="CALENDRIER";
$text=/*"</tr></td>".*/"<div id=\"calendrier\">";
//initialisation des donnees
$intPremierJour = &Calendrier::premierJourMois($this->mois,$this->annee);
$intNbJoursMois = &Calendrier::nbJourMois($this->mois,$this->annee);
$prevMonth=&Calendrier::prevMonth($this->mois,$this->annee);
$intNbJourPrec=&Calendrier::nbJourMois($prevMonth[0],$prevMonth[1]);
$intDernierJour=&Calendrier::dernierJourMois($this->mois,$this->annee);
//calcul du lundi et dimanche de la semaine courante
//calcul de l'annee
$tabLundiDimanche =& Calendrier::lundiEtDimancheSemaine($this->semaine,$annee);
//creation de la table HTML representant le calendrier
$tableAttrs = array("class" =>$id,"width" => "300");
//creation de la barre de navigation
//semaine precedente
$tabPrevWeek=&Calendrier::prevWeek();
$text.="<a href=".$GLOBALS['urlBase'].GESTION_TRAVAIL."&semaine=";
$text.=$tabPrevWeek[0]."&annee=".$tabPrevWeek[1].">";
$text.="<<"."</a>";
//semaine courante
$text.='<button>';
$text.=date('d/m/y',mktime(0,0,0,1,$tabLundiDimanche[0],$annee));
$text.=' -- ';
$text.=date('d/m/y',mktime(0,0,0,1,$tabLundiDimanche[1],$annee));
$text.='</button>';
//semaine suivante
$tabNextWeek= &Calendrier::nextWeek();
$text.="<a href=".$GLOBALS['urlBase'].GESTION_TRAVAIL."&semaine=";
$text.=$tabNextWeek[0]."&annee=".$tabNextWeek[1].">";
$text.=">>"."</a>";
$table = new HTML_Table($tableAttrs);
$table -> setAutoGrow(true);
$table->addRow($this->nom_jours);
//remplissage de la premiere ligne
//test si on est dans la semaine courante
//si dimanche egale a la fin de la semaine
$semCourante=(date('d',mktime(0,0,0,1,$tabLundiDimanche[1],$annee))==(7-$intPremierJour+1));
$p=1;
for($i=1; $i<=7;$i++) {
if ($i<$intPremierJour and $semCourante) {//mois prec et semaine courante
$elem[$i-1]="<div id=\"moisprecedent\">".($intNbJourPrec-$intPremierJour+$i+1);
} elseif ($i<$intPremierJour and !$semCourante) {//mois prec et pas semaien courante
$semaineL=date('W',mktime(0,0,0,$prevMonth[0],($intNbJourPrec-$intPremierJour+$i+1),$prevMonth[1]));
$elem[$i-1]= "<a href=".$this->url."?action=".GESTION_TRAVAIL."&semaine=$semaineL"."&annee=$prevMonth[1]".">".($intNbJourPrec-$intPremierJour+$i+1)."</a>";
} elseif ($i>=$intPremierJour and $semCourante) {//mois courant et semaine courante
$elem[$i-1] = "<div id=\"jourcourant\">".$p."</div>";
$p++;
} else {//mois courant et pas semaine courante
$semaineL=date('W',mktime(0,0,0,$this->mois,$p,$this->annee));
$elem[$i-1] = "<a href=".$this->url."?action=".GESTION_TRAVAIL."&semaine=$semaineL";
$elem[$i-1] .="&annee=".$this->annee.">".$p."</a>";
$p++;
}
}
$table->addRow($elem);
//remplissage du reste des lignes
$i=0; //indice du tableau
//lundi de la semaien courante
// $t=&Calendrier::lundiEtDimancheSemaine($this->semaine,$this->annee);
$lundiCourant=date('d',mktime(0,0,0,1,$tabLundiDimanche[0],$annee));
$semCourante2=0;
for ($f=$p; $f<=$intNbJoursMois ; $f++) {
if ($f==$lundiCourant and $i==0) {
$semCourante2=1;//booleen
}
//calcul de la semaine courante
$semaineL2=date('W',mktime(0,0,0,$this->mois,$f,$this->annee));
if ($semCourante2==1) {
$elem[$i]= "<div id=\"jourcourant\">".$f."</div>";
} else {
$elem[$i]="<a href=".$this->url."?action=".GESTION_TRAVAIL."&semaine=$semaineL2";
$elem[$i].="&annee=".$this->annee.">".$f."</a>";
}
if ($i==6) {
$i=0;
if ($semCourante2==1) {
$semCourante2=0;
}
$table->addRow($elem);
} else {
$i++;
}
}
//remplissage de la derniere ligne
$semaineL3=date('W',mktime(0,0,0,$this->mois,$intNbJoursMois,$this->annee));
if ($semCourante2==0) {
for ($d=$i; $d<=6;$d++) {
$s=$d-$i+1;
$elem[$d]="<a href=".$this->url."?action=".GESTION_TRAVAIL."&semaine=$semaineL2";
$elem[$d].="&annee=".$this->annee.">".$s."</a>";
}
} else {
for ($d=$i; $d<=6;$d++) {
$elem[$d]= ($d-$i+1);
}
}
$table->addRow($elem);
$text.=$table->toHtml();
$text .= "</div>";
return $text;
}
}
?>
/trunk/classes/ControlleurFrontal.class.php
New file
0,0 → 1,92
<?php
 
class ControlleurFrontal {
public function getRegistre()
{
return Registre::getRegistre();
}
public function parserAction($url)
{
if (preg_match('/^(.+?)(?:_(.+)|)$/', $url, $match)) {
$retour['classe_action'] = 'GttCtrlAction'.ucfirst($match[1]);
}
$retour['tab_actions'] = array('');
if (isset($match[2])) {
preg_match_all('/(.+)(?:_|$)/', $match[2], $match_actions);
$retour['tab_actions'] = $match_actions[1];
}
return $retour;
}
 
public function executer($url_action)
{
$tab_info_url = $this->parserAction($url_action);
//echo '<pre>'.print_r($tab_info_url, true).'</pre>';
$classe_action = $tab_info_url['classe_action'];
$fichier_action = GTT_CHEMIN_ACTION.$classe_action.'.class.php';
if (file_exists($fichier_action)) {
require_once $fichier_action;
$Action = new $classe_action($this->getRegistre());
foreach ($tab_info_url['tab_actions'] as $action) {
// Vérification des données POST ou GET avant l'appel de l'action
if (isset($_POST) || isset($_GET)) {
$Action->verifier();
$methode_verif = 'verifier'.ucfirst($action);
if (method_exists($Action, $methode_verif)) {
// Méthode "vérifier" spécifique à une action
$Action->$methode_verif();
}
}
// Execution de l'action
$Action->setSuivant(ucfirst($action));
}
$Action->demarrer();
$aso_principal['principal'] = $this->rendre();
//echo '<pre>'.print_r($aso_principal, true).'</pre>';
$Resultats = $this->getRegistre();
$aso_principal['principal']['titre'] = $Resultats->getTitre();
$Resultats->setEspaces(array());
$Resultats->setSquelettes(array());
$Resultats->setDonnees(array());
$Resultats->ajouterEspace('Principal', 'principal');
$Resultats->ajouterSquelette('principal', 'principal.tpl.html');
$Resultats->ajouterDonnee('principal', $aso_principal['principal']);
return $this->rendre();
} else {
$m = "Le fichier $fichier_action contenant l'action est introuvable!";
trigger_error($m, E_USER_ERROR);
}
}
public function rendre()
{
$contenu_principal = null;
$aso_contenu = array('zone_contenu' => '', 'zone_identification' => '');
foreach ($this->getRegistre()->getEspaces() as $espace_de_nom) {
ob_start();
extract($GLOBALS['_GTT_']['i18n']['general'], EXTR_PREFIX_ALL, 'i18n_general');
extract($this->getRegistre()->getDonnees($espace_de_nom));
include_once GTT_CHEMIN_PRESENTATION.$this->getRegistre()->getSquelettes($espace_de_nom);
// Répartition dans des zones
switch($espace_de_nom) {
case 'principal' :
$contenu_principal .= ob_get_contents();
break;
case 'identification' :
$aso_contenu['zone_identification'] .= ob_get_contents();
break;
default:
$aso_contenu['zone_contenu'] .= ob_get_contents();
}
ob_end_clean();
}
if (!is_null($contenu_principal)) {
return $contenu_principal;
}
return $aso_contenu;
}
}
?>
/trunk/classes/metiers/Projet.class.php
48,7 → 48,8
/*** Constantes : */
const GP_TOUS = 'PROJET_TOUS';
const GP_ID = 'PROJET_ID';
const GP_ID_MAX = 'PROJET_ID_MAX';
const GP_ID_MAX = 'PROJET_ID_MAX';
const GP_ID_LIST = 'PROJET_ID_LIST';
/*** Attributs : */
private $id_projet;
175,6 → 176,11
case Projet::GP_ID_MAX:
$requete = 'SELECT MAX(gp_id_projet) '.
'FROM gestion_projet ';
break;
case Projet::GP_ID_LIST:
$requete = 'SELECT * '.
'FROM gestion_projet '.
'WHERE gp_id_projet IN ('.$parametres[0].') ';
break;
default :
$message = 'Commande '.$cmd.'inconnue!';
181,7 → 187,6
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
trigger_error($e, E_USER_ERROR);
}
$resultat = $GLOBALS['db']->query($requete);
(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
$tab_resultat = array();
/trunk/classes/metiers/TravailProjet.class.php
46,7 → 46,8
*/
class TravailProjet extends aGttSql {
/*** Constantes : */
const GTP_ID = 'TRAVAILPROJET_ID';
const GTP_ID = 'TRAVAILPROJET_ID';
const GTP_ID_UTILISATEUR_DATE_DEB_FIN = 'TRAVAILPROJET_ID_UTILISATEUR_DATE';
const GTP_ID_MAX_UTILISATEUR = 'TRAVAILPROJET_ID_MAX_UTILISATEUR';
const GTP_ID_MAX_PROJET = 'TRAVAILPROJET_ID_MAX_PROJET';
const GTP_ID_MAX_DATE_TRAVAIL = 'TRAVAILPROJET_ID_MAX_DATE_TRAVAIL';
128,8 → 129,13
case TravailProjet::GTP_ID:
$requete = 'SELECT * '.
'FROM gestion_travail_projet '.
'WHERE gtp_id_utilisateur = '.$parametres[0].' AND gtp_id_projet = '.$parametres[1].' AND gtp_id_date_travail = '.$parametres[2].' ';
'WHERE gtp_id_utilisateur = '.$parametres[0].' AND gtp_id_projet = '.$parametres[1].' AND gtp_id_date_travail = "'.$parametres[2].'" ';
break;
case TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN:
$requete = 'SELECT * '.
'FROM gestion_travail_projet '.
'WHERE gtp_id_utilisateur = '.$parametres[0].' AND gtp_id_date_travail > "'.$parametres[1].'" '.' AND gtp_id_date_travail < "'.$parametres[2].'" ';
break;
case TravailProjet::GTP_ID_MAX_UTILISATEUR:
$requete = 'SELECT MAX(gtp_id_utilisateur) '.
'FROM gestion_travail_projet ';
141,9 → 147,9
case TravailProjet::GTP_ID_MAX_DATE_TRAVAIL:
$requete = 'SELECT MAX(gtp_id_date_travail) '.
'FROM gestion_travail_projet ';
break;
break;
default :
$message = 'Commande '.$cmd.'inconnue!';
$message = 'Commande '.$cmd.' inconnue!';
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
trigger_error($e, E_USER_ERROR);
}
/trunk/index.php
63,41 → 63,40
'db_fields' => '*');
// Création de l'objet auth
$a = new Auth('DB', $params, 'afficherMenuConnexion', true);
$a = new Auth('DB', $params, null, false);
$a->setSessionname('temps_travail');
$a->setExpire(3600*24*30);
$a->start();
echo $a->getStatus();
if ($a->getAuth()) {
// Récuperation d'informations générales
require_once GTT_CHEMIN_CLASSE.'GestionnaireErreur.class.php';
require_once GTT_CHEMIN_METIER.'aGttSql.class.php';
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($a->getUserName()));
// Utilisation du mécanisme MVC avec Squelette PHP et objet
require_once GTT_CHEMIN_CLASSE.'Controlleur.class.php';
require_once GTT_CHEMIN_CLASSE.'aAction.class.php';
require_once GTT_CHEMIN_CLASSE.'Resultat.class.php';
$module = 'Preference';
if (isset($_GET['module']) && !empty($_GET['module'])) {
$module = $_GET['module'];
}
$nom_module = 'GttControlleur'.$module;
$fichier_module = GTT_CHEMIN_MODULE.$nom_module.'.class.php';
$nom_module_general = 'Controlleur';
$fichier_module_general = GTT_CHEMIN_CLASSE.$nom_module_general.'.class.php';
if (file_exists($fichier_module)) {
require_once $fichier_module;
$Controlleur = new $nom_module;
} else if (file_exists($fichier_module_general)) {
require_once $fichier_module_general;
$Controlleur = new $nom_module_general;
}
echo $Controlleur->executer($action);
} else {
echo afficherMenuConnexion();
if (!$a->getAuth()) {
$action = GTT_ACTION_DECONNEXION;
}
 
// Récuperation d'informations générales
require_once GTT_CHEMIN_CLASSE.'GestionnaireErreur.class.php';
require_once GTT_CHEMIN_METIER.'aGttSql.class.php';
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
$GLOBALS['_GTT_']['Utilisateur'] = new Utilisateur(Utilisateur::GU_MAIL, array($a->getUserName()));
$GLOBALS['_GTT_']['auth'] = $a;
// Utilisation du mécanisme MVC avec Squelette PHP et objet
require_once GTT_CHEMIN_CLASSE.'aControlleurAction.class.php';
require_once GTT_CHEMIN_CLASSE.'Registre.class.php';
$module = 'Preference';
if (isset($_GET['module']) && !empty($_GET['module'])) {
$module = $_GET['module'];
}
$nom_module = 'GttControlleur'.$module;
$fichier_module = GTT_CHEMIN_MODULE.$nom_module.'.class.php';
$nom_module_general = 'ControlleurFrontal';
$fichier_module_general = GTT_CHEMIN_CLASSE.$nom_module_general.'.class.php';
if (file_exists($fichier_module)) {
require_once $fichier_module;
$Controlleur = new $nom_module;
} else if (file_exists($fichier_module_general)) {
require_once $fichier_module_general;
$Controlleur = new $nom_module_general;
}
echo $Controlleur->executer($action);
} else {
include_once CHEMIN_CLASSES.'gtt_authentification.php';
include_once CHEMIN_PRESENTATION.'gtt_fonctions_generique_affichage.php';
/trunk/actions/GttActionPreferences.class.php
File deleted
\ No newline at end of file
/trunk/actions/GttActionGestion.class.php
File deleted
\ No newline at end of file
/trunk/actions/GttActionUtilisateur.class.php
File deleted
\ No newline at end of file
/trunk/actions/GttCtrlActionGestion.class.php
New file
0,0 → 1,210
<?php
require_once GTT_CHEMIN_CLASSE.'Calendrier.class.php';
 
require_once GTT_CHEMIN_ACTION.'GttCtrlActionIdentification.class.php';
 
require_once GTT_CHEMIN_PEAR.'Calendar/Month/Weeks.php';
require_once GTT_CHEMIN_PEAR.'Calendar/Week.php';
require_once GTT_CHEMIN_PEAR.'Calendar/Day.php';
 
require_once GTT_CHEMIN_METIER.'Projet.class.php';
require_once GTT_CHEMIN_METIER.'TravailProjet.class.php';
require_once GTT_CHEMIN_METIER.'ProjetCategorie.class.php';
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
require_once GTT_CHEMIN_METIER.'UtilisateurAProjet.class.php';
 
class GttCtrlActionGestion extends aControlleurAction {
 
public function __construct(Registre $Registre)
{
$Registre->ajouterEspace('Gestion', 'gestion');
$Registre->ajouterSquelette('gestion', 'gestion.tpl.html');
// TODO : gérer les actions chainées provenant d'un autre ControlleurAction
$GttCtrlActionIdentification = new GttCtrlActionIdentification($this->getRegistre());
$GttCtrlActionIdentification->setSuivant('__defaut__');
$this->setSuivant($GttCtrlActionIdentification);
}
public function executer()
{
$aso_gestion = array();
$this->getRegistre()->setTitre('Gérer son temps');
 
//+-------------------------------------------------------------------------------------------------+
// GESTION DES CALENDRIERS
//+-------------------------------------------------------------------------------------------------+
// Initialisation des variables pour le calendrier
if (!isset($_GET['annee'])) {
$_GET['annee'] = date('Y');
}
if (!isset($_GET['mois'])) {
$_GET['mois'] = date('m');
}
if (!isset($_GET['semaine'])) {
$_GET['semaine'] = date('W');
}
if (!isset($_GET['jour'])) {
$_GET['jour'] = date('d');
}
// Instanciation de la classe Calendrier France
$Calendrier = new Calendrier($_GET['jour'], $_GET['semaine'], $_GET['mois'], $_GET['annee']);
$tab_jours_feries = $Calendrier->getListeFeries();
 
// Create an array of days which are "selected"
// Used for Week::build() below
$CalendrierJourCourrant = new Calendar_Week(date('Y'), date('m'), date('d'));
$aso_gestion['jc']['jour'] = $CalendrierJourCourrant->thisDay();
$aso_gestion['jc']['semaine'] = $CalendrierJourCourrant->thisWeek('n_in_year');
$aso_gestion['jc']['mois'] = $CalendrierJourCourrant->thisMonth();
$aso_gestion['jc']['mois_nom'] = $Calendrier->getNomMois($CalendrierJourCourrant->thisMonth());
$aso_gestion['jc']['annee'] = $CalendrierJourCourrant->thisYear();
$aso_gestion['jc_url'] = 'index.php?action='.GTT_ACTION_GESTION.'&amp;annee='.$aso_gestion['jc']['annee'].'&amp;mois='.$aso_gestion['jc']['mois'].'&amp;semaine='.$aso_gestion['jc']['semaine'].'&amp;jour='.$aso_gestion['jc']['jour'];
$CalendrierJourCourrant->build();
$CalendrierSemaineCourrante = $CalendrierJourCourrant->thisWeek('object');
$CalendrierSemaineCourrante->build();
$tab_jours = $CalendrierSemaineCourrante->fetchAll();
$aso_gestion['sjc_1']['jour'] = $tab_jours[1]->thisDay();
$aso_gestion['sjc_1']['mois'] = $Calendrier->getNomMois($tab_jours[1]->thisMonth());
$aso_gestion['sjc_1']['annee'] = $tab_jours[1]->thisYear();
$aso_gestion['sjc_7']['jour'] = $tab_jours[7]->thisDay();
$aso_gestion['sjc_7']['mois'] = $Calendrier->getNomMois($tab_jours[7]->thisMonth());
$aso_gestion['sjc_7']['annee'] = $tab_jours[7]->thisYear();
$aso_gestion['selectedDays'] = array ($CalendrierJourCourrant);
// Instruct month to build Week objects
// Construction de l'objet mois
$Month = new Calendar_Month_Weeks($_GET['annee'], $_GET['mois']);
$Month->build();
while ($Week = $Month->fetch()) {
$Week->build($aso_gestion['selectedDays']);
//echo '<pre>'.print_r($Month, true).'</pre>';
$tab_semaine_jours = $Week->fetchAll();
foreach ($tab_semaine_jours as $num => $Day) {
$element = array();
$element['annee'] = $Day->thisYear();
$element['mois'] = $Day->thisMonth();
$element['jour'] = $Day->thisDay();
$element['jour_nom'] = $Calendrier->getNomJours($num);
$element['url'] = 'index.php?action='.GTT_ACTION_GESTION.'&amp;annee='.$Day->thisYear().'&amp;mois='.$Day->thisMonth().'&amp;jour='.$Day->thisDay();
// Check to see if day is selected
if ($Day->isSelected()) {
$element['class'] = 'jour_courrant';
} else if ($Day->isEmpty()) {
$element['class'] = 'jour_vide';
} else {
$element['class'] = 'jour';
}
foreach ($tab_jours_feries as $jour_ferie) {
if ($Day->thisDay(true) == $jour_ferie) {
$element['class'] = 'jour_ferie';
}
}
$aso_gestion['elements'][$Week->thisWeek('n_in_year')][$num] = $element;
}
}
// Construction de l'url pour les mois précédent/suivant
$PMonth = $Month->prevMonth('object');
$aso_gestion['url_mois_precedent'] = 'index.php?action='.GTT_ACTION_GESTION.'&amp;annee='.$PMonth->thisYear().'&amp;mois='.$PMonth->thisMonth().'&amp;jour='.$PMonth->thisDay();
$NMonth = $Month->nextMonth('object');
$aso_gestion['url_mois_suivant'] = 'index.php?action='.GTT_ACTION_GESTION.'&amp;annee='.$NMonth->thisYear().'&amp;mois='.$NMonth->thisMonth().'&amp;jour='.$NMonth->thisDay();
$aso_gestion['mois']['mois'] = $Calendrier->getNomMois($Month->thisMonth());
$aso_gestion['mois']['annee'] = $Month->thisYear();
// Construction de l'url pour les semaines précédente/suivante
$Week = new Calendar_Week($_GET['annee'], $_GET['mois'], $_GET['jour']);
$aso_gestion['s'] = $Week->thisWeek('n_in_year');
$PWeek = $Week->prevWeek('object');
$aso_gestion['url_semaine_precedente'] = 'index.php?action='.GTT_ACTION_GESTION.'&amp;annee='.$PWeek->thisYear().'&amp;mois='.$PWeek->thisMonth().'&amp;jour='.$PWeek->thisDay();
$url_sc_param_date = '&amp;annee='.$Week->thisYear().'&amp;mois='.$Week->thisMonth().'&amp;jour='.$Week->thisDay();
$aso_gestion['url_semaine_courante'] = 'index.php?action='.GTT_ACTION_GESTION.$url_sc_param_date;
$NWeek = $Week->nextWeek('object');
$aso_gestion['url_semaine_suivante'] = 'index.php?action='.GTT_ACTION_GESTION.'&amp;annee='.$NWeek->thisYear().'&amp;mois='.$NWeek->thisMonth().'&amp;jour='.$NWeek->thisDay();
$Week->build();
$aso_jours = array();
foreach($Week->fetchAll() as $num => $j) {
$aso_gestion['sj_'.$num]['jour'] = $j->thisDay();
$aso_gestion['sj_'.$num]['mois'] = $Calendrier->getNomMois($j->thisMonth());
$aso_gestion['sj_'.$num]['annee'] = $j->thisYear();
$aso_gestion['sj_'.$num]['mysql'] = $aso_gestion['sj_'.$num]['annee'].'-'.sprintf("%02s", $j->thisMonth()).'-'.$aso_gestion['sj_'.$num]['jour'];
$aso_jours[$aso_gestion['sj_'.$num]['mysql']] = $num;
$aso_tps_w_vide[$num] = '';
}
//+-------------------------------------------------------------------------------------------------+
// GESTION DES PROJETS
//+-------------------------------------------------------------------------------------------------+
// Récupération des infos sur l'utilisateur
$aso_gestion['conges_payes'] = $GLOBALS['_GTT_']['Utilisateur']->getCongesPayes();
$aso_gestion['rtt'] = $GLOBALS['_GTT_']['Utilisateur']->getQuotaHeuresSupp();
$aso_gestion['tps_w'] = $GLOBALS['_GTT_']['Utilisateur']->getTempsDeTravail();
// Récupération des projets sur lesquels l'utilisateur travaille
$UtilsateurAProjet = new UtilisateurAProjet();
$tab_uap = $UtilsateurAProjet->consulter(UtilisateurAProjet::GUAP_UTILISATEUR, $GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
$tab_projet_id = array();
foreach ($tab_uap as $uap) {
$tab_projet_id[] = $uap->getIdProjet();
}
 
// Récupération du temps de travail pour un utilisateur à une date donnée
$TravailProjet = new TravailProjet();
$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN;
$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_gestion['sj_1']['mysql'], $aso_gestion['sj_7']['mysql']);
$tab_tp = $TravailProjet->consulter($cmd, $param);
if ($tab_tp && count($tab_tp) == 1) {
$tab_tp = array($tab_tp);
}
 
// Récupération des infos sur les projets de l'utilisateur
$Projet = new Projet();
$tab_p = $Projet->consulter(Projet::GP_ID_LIST, array(implode(',', $tab_projet_id)));
foreach ($tab_p as $Projet) {
 
// Récupération de la catégorie du projet
$ProjetCategorie = new ProjetCategorie();
$cmd = ProjetCategorie::GPC_ID;
$param = $Projet->getCeCategorie();
$Categorie = $ProjetCategorie->consulter($cmd, $param);
// Nous vérifions le temps de travail pour ce projet pour la semaine courrante
$aso_tps_w = $aso_tps_w_vide;
if ($tab_tp) {
foreach ($tab_tp as $TP) {
if ($TP->getIdProjet() == $Projet->getIdProjet()) {
$aso_tps_w[$aso_jours[$TP->getIdDateTravail()]] = $TP->getDuree();
}
}
}
// Stockage des infos nécessaire pour l'affichage
$aso_gestion['preferences'][$Categorie->getLibelle()][] = array(
'id' => $Projet->getIdProjet(),
'valeur' => $Projet->getIdProjet(),
'nom' => $Projet->getNomProjet(),
'date' => $aso_tps_w);
}
// Création de l'url de réponse du formulaire
$aso_gestion['url_gestion_valider'] = 'index.php?action='.GTT_ACTION_GESTION_VALIDER.$url_sc_param_date;
//echo '<pre>'.print_r($aso_gestion, true).'</pre>';
$this->getRegistre()->ajouterDonnee('gestion', $aso_gestion);
}
public function executerValider()
{
//echo '<pre>'.print_r($_POST, true).'</pre>';
// Action suivante
$this->setSuivant('__defaut__');
}
}
?>
/trunk/actions/GttCtrlActionIdentification.class.php
New file
0,0 → 1,35
<?php
 
class GttCtrlActionIdentification extends aControlleurAction {
public function __construct(Registre $Registre)
{
$Registre->ajouterEspace('Identification', 'identification');
$Registre->ajouterSquelette('identification', 'connexion.tpl.html');
}
public function executer()
{
$aso_identification = array();
$this->getRegistre()->ajouterSquelette('identification', 'identite.tpl.html');
//$GLOBALS['_GTT_']['auth']->logout();
$aso_identification['nom'] = $GLOBALS['_GTT_']['Utilisateur']->getNom();
$aso_identification['prenom'] = $GLOBALS['_GTT_']['Utilisateur']->getPrenom();
//echo '<pre>'.print_r($aso_identification, true).'</pre>';
$this->getRegistre()->ajouterDonnee('identification', $aso_identification);
}
public function executerDeconnexion()
{
$aso_connexion = array();
$this->getRegistre()->setTitre('Bienvenue sur GTT!');
// Création de l'url de réponse du formulaire
$aso_connexion['url'] = 'index.php?action='.GTT_ACTION_CONNEXION;
$GLOBALS['_GTT_']['auth']->logout();
//echo '<pre>'.print_r($aso_connexion, true).'</pre>';
$this->getRegistre()->ajouterDonnee('identification', $aso_connexion);
}
}
?>
/trunk/actions/GttCtrlActionUtilisateur.class.php
New file
0,0 → 1,38
<?php
 
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php';
 
class GttCtrlActionUtilisateur extends aAction {
 
public function __construct()
{
print_r($this->getResultat());
$Resultats = $this->getResultat();
$Resultats->ajouterEspace('Utilisateur', 'utilisateur');
$Resultats->ajouterSquelette('utilisateur', 'utilisateur.tpl.html');
}
public function executer(Resultat $Resultat)
{
$Resultat->setTitre('Ajouter un utilisateur');
$tab_preferences =& Projet::recupererTableauProjet();
$aso_preferences = array();
$Preference = new Preferences($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), 5000);
$aso_preferences['nbre_projets'] = count($tab_preferences);
// Parcourt du tableau de projets
for($i = 0; $i < $aso_preferences['nbre_projets']; $i++) {
$ligne = $tab_preferences[$i];
$coche = false;
if ($Preference->isInPreferences($ligne[GEST_CHAMPS_ID_PROJET])) {
$coche = true;
}
$aso_preferences['preferences'][$ligne[GEST_CHAMPS_LIBELLE_CATEGORIE]][] = array(
'id' => 'pr['.$ligne[GEST_CHAMPS_ID_PROJET].']',
'valeur' => $ligne[GEST_CHAMPS_ID_PROJET],
'nom' => $ligne[GEST_CHAMPS_NOM_PROJET],
'coche' => $coche);
}
$Resultat->ajouterDonnee('preferences', $aso_preferences);
}
}
?>
/trunk/actions/GttCtrlActionPreferences.class.php
New file
0,0 → 1,68
<?php
require_once GTT_CHEMIN_METIER.'Projet.class.php';
require_once GTT_CHEMIN_METIER.'ProjetCategorie.class.php';
require_once GTT_CHEMIN_METIER.'UtilisateurAProjet.class.php';
 
class GttCtrlActionPreferences extends aControlleurAction {
 
public function __construct(Registre $Registre)
{
$Registre->ajouterEspace('Preferences', 'preferences');
$Registre->ajouterSquelette('preferences', 'preferences.tpl.html');
}
public function executer()
{
$aso_preferences = array();
$this->getRegistre()->setTitre('Modifier mes préférences');
$Projet = new Projet();
$tab_projets = $Projet->consulter(Projet::GP_TOUS);
$aso_preferences['nbre_projets'] = count($tab_projets);
// Parcourt du tableau de projets
foreach ($tab_projets as $Projet) {
// Vérification de la présence du projet dans les préférences de l'utilisateur
$UtilisateurAProjet = new UtilisateurAProjet();
$cmd = UtilisateurAProjet::GUAP_ID;
$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $Projet->getIdProjet());
$coche = false;
if ($present = $UtilisateurAProjet->consulter($cmd, $param)) {
$coche = true;
}
// Récupération de la catégorie du projet
$ProjetCategorie = new ProjetCategorie();
$cmd = ProjetCategorie::GPC_ID;
$param = $Projet->getCeCategorie();
$Categorie = $ProjetCategorie->consulter($cmd, $param);
// Récupération de toutes les infos
$aso_preferences['preferences'][$Categorie->getLibelle()][] = array(
'id' => $Projet->getIdProjet(),
'valeur' => $Projet->getIdProjet(),
'nom' => $Projet->getNomProjet(),
'coche' => $coche);
}
ksort($aso_preferences['preferences']);
//echo '<pre>'.print_r($aso_preferences, true).'</pre>';
$this->getRegistre()->ajouterDonnee('preferences', $aso_preferences);
}
public function executerValider()
{
// Mise à jour des Préférences
$UtilisateurAProjet = new UtilisateurAProjet();
$UtilisateurAProjet->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
$UtilisateurAProjet->supprimer();
//echo '<pre>'.print_r($_POST, true).'</pre>';
foreach ($_POST['pr'] as $pr_id) {
$UtilisateurAProjet = new UtilisateurAProjet();
$UtilisateurAProjet->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur());
$UtilisateurAProjet->setIdProjet($pr_id);
$UtilisateurAProjet->ajouter();
}
// Action suivante
$this->setSuivant('__defaut__');
}
}
?>
/trunk/gtt_config.inc.php
4,9 → 4,13
error_reporting(E_ALL);
 
// Les constantes d'action
define ('GTT_ACTION_CONNEXION', 'gestion');
define ('GTT_ACTION_DECONNEXION', 'identification_deconnexion');
define ('GTT_ACTION_IDENTIFICATION', 'identification');
define ('GTT_ACTION_PREFERENCE', 'preferences');
define ('GTT_ACTION_PREFERENCE_VALIDER', 'preferences_valider');
define ('GTT_ACTION_GESTION', 'gestion');
define ('GTT_ACTION_GESTION_VALIDER', 'gestion_valider');
define ('GTT_ACTION_UTILISATEUR', 'utilisateur');
 
// Définition des constantes