/trunk/controleur/gtt_controleur_admin_categorie.php |
---|
New file |
0,0 → 1,133 |
<?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_categorie.php'; |
/** |
*fonction traitant l'ajout d'une categorie |
*/ |
function ajouterCategorie() |
{ |
if (isset($_POST["champ_valider_cat"])) |
{ |
$i=&Categorie::nextId(); |
$c=new Categorie($i); |
$c->setLibelleCategorie($_POST["champ_nom_cat"]); |
$j= $c->enregistrerNewCategorie(); |
if ($j!=1) echo "echec"; |
} |
$_POST["champ_valider_cat"]='dejaValider'; |
$_POST["champ_nom_cat"]=''; |
} |
/** |
*fonction effectuant la suppression d'une categorie |
*/ |
function traiterSupprimerCategorie() |
{ |
if (isset($_POST["btn_supprimer_cat"])) |
{ |
$identifiant=$_POST["champ_cat_supprimer"]; |
//verification si la categorie ne contient pas de projets |
$verif=&Categorie::contientProjet($identifiant); |
if($verif!=1) |
{ |
$b=&Categorie::supprimerCategorie($identifiant); |
}else $b=0; |
if ($b==0) |
{ |
echo "echec supression"; |
} |
} |
$_POST["champ_cat_supprimer"]=''; |
$_POST["btn_supprimer_cat"]='essai'; |
} |
/**fonction traitant toutesles actions du menu admin categorie |
*/ |
function traiterAdminCategorie() |
{ |
$text=creerEntetePage(GESTION_ADMIN_CATEGORIE_L); |
//cas de l'ajout |
$form=afficherMenuAjouterCategorie(); |
if (isset($_POST["champ_valider_cat"]) and $_POST["champ_valider_cat"]!='dejaValider' and $form->validate()) |
{ |
$form->process('ajouterCategorie'); |
$t=afficherMenuAjouterCategorie(); |
$text.=$t->ToHTml(); |
}else |
{ |
$text.=$form->ToHtml(); |
} |
//cas supression |
$forms=afficherMenuSupressionCategorie(); |
if (isset($_POST["btn_supprimer_cat"]) and $_POST["btn_supprimer_cat"]!='essai' and $forms->validate()) |
{ |
$forms->process('traiterSupprimerCategorie'); |
$j=afficherMenuSupressionCategorie(); |
$text.=$j->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; |
} |
/** |
*fonction verifiant si la categorie ne contient pas de |
projets |
*/ |
function verifContientProjet() |
{ |
$identifiant=$_POST["champ_cat_supprimer"]; |
$verif=&Categorie::contientProjet($identifiant); |
if ($verif==1)return false; |
else return true; |
} |
?> |
/trunk/controleur/CVS/Repository |
---|
New file |
0,0 → 1,0 |
gestion/version_3/controleur |
/trunk/controleur/CVS/Root |
---|
New file |
0,0 → 1,0 |
:extssh:jp_milcent@adullact.net:/cvsroot/eflore |
/trunk/controleur/CVS/Entries |
---|
New file |
0,0 → 1,7 |
/gtt_controleur_admin_categorie.php/1.1/Tue Feb 22 12:07:13 2005// |
/gtt_controleur_admin_motif_absence.php/1.1/Tue Feb 22 12:07:13 2005// |
/gtt_controleur_admin_projet.php/1.1/Tue Feb 22 12:07:13 2005// |
/gtt_controleur_admin_statut.php/1.1/Tue Feb 22 12:07:13 2005// |
/gtt_controleur_admin_utilisateur.php/1.1/Tue Feb 22 12:07:13 2005// |
/gtt_controleur_editer_preferences.php/1.1/Tue Feb 22 12:07:13 2005// |
/gtt_controleur_travail.php/1.1/Tue Feb 22 12:07:13 2005// |
/trunk/controleur/gtt_controleur_admin_projet.php |
---|
New file |
0,0 → 1,155 |
<?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; |
} |
?> |
/trunk/controleur/gtt_controleur_admin_statut.php |
---|
New file |
0,0 → 1,130 |
<?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_statut.php'; |
/** |
*fonction traitant l'enregistrement des statuts |
*/ |
function traiterAjouterStatut() |
{ |
if (isset($_POST["champ_valider_statut"])) |
{ |
$i=&Statut::nextId(); |
$s=new Statut($i); |
$s->setLibelleStatut($_POST["champ_nom_statut"]); |
$s->enregistrerStatut(); |
} |
$_POST["champ_valider_statut"]='dejaValider'; |
$_POST["champ_nom_statut"]=''; |
} |
/** |
*fonction traitant la supression de statut |
*/ |
function traiterSupprimerStatut() |
{ |
if (isset($_POST["btn_supprimer_statut"])) |
{ |
$identifiant=$_POST["champ_statut_supprimer"]; |
$verif=&Statut::statutUtilise($identifiant); |
if($verif!=1) |
{ |
$j=&Statut::supprimerStatut($identifiant); |
}else $j=0; |
if ($j==0) |
{ |
echo "echec supression"; |
} |
} |
$_POST["btn_supprimer_statut"]='dejaValider'; |
$_POST["champ_statut_supprimer"]=''; |
} |
/** |
*fonction verifiant si statut peut etre supprime |
*/ |
function verifStatutUtilise() |
{ |
$identifiant=$_POST["champ_statut_supprimer"]; |
$verif=&Statut::statutUtilise($identifiant); |
if ($verif==1)return false; |
else return true; |
} |
/** |
*fonction traitant toutes les actions du menu admin statut |
*/ |
function traiterAdminStatut() |
{ |
$text=creerEntetePage(GESTION_ADMIN_STATUT_L); |
//cas ajout utilisateur |
$form=afficherMenuAjouterStatut(); |
if (isset($_POST["champ_valider_statut"]) and $_POST["champ_valider_statut"]!='dejaValider' and $form->validate()) |
{ |
$form->process('traiterAjouterStatut'); |
$m=afficherMenuAjouterStatut(); |
$text.=$m->ToHTml(); |
}else |
{ |
$text.=$form->ToHtml(); |
} |
//cas supression |
$forms=afficherMenuSupressionstatut(); |
if (isset($_POST["btn_supprimer_statut"]) and $_POST["btn_supprimer_statut"]!='dejaValider' and $forms->validate()) |
{ |
$forms->process('traiterSupprimerStatut'); |
$m=afficherMenuSupressionStatut(); |
$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; |
} |
?> |
/trunk/controleur/gtt_controleur_editer_preferences.php |
---|
New file |
0,0 → 1,77 |
<?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 | |
// +------------------------------------------------------------------------------------------------------+ |
//inclusion des paquets de la librairie pear |
include_once CHEMIN_FN_GENERIQUE_AFFICHAGE; |
include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php'; |
include_once CHEMIN_CLASSES_METIER.'gtt_preference.class.php'; |
/** |
*fonction traitant les fonctions du menu editer prefernces |
*/ |
function traiterEditerPreferences($user) |
{ |
$text=creerEntetePage(GESTION_EDITER_PREFERENCES_L); |
$form= afficherMenuEditerPref($user); |
if (isset($_POST["btn_valider_editer"])and $_POST["btn_valider_editer"]!='dejaValider'and $form->validate()) |
{ |
$form->process(editerPref($user)); |
$t=afficherMenuEditerPref($user); |
$text.=$t->ToHTml(); |
}else{ |
$text.=$form->ToHtml(); |
} |
//affichage des options disponibles pour l'utilisateur courant |
$text.=afficherOptionAplication($user); |
return $text; |
} |
/** |
*fonction realisant l'ajout et la supression de preferences |
*/ |
function editerPref($user) |
{ |
$r=&Preference::supprimerPreferences($user); |
$nb=$_POST["champ_nb_total_proj"]; //NB TOTAL DE PROJET |
for($u=0;$u<$nb;$u++) |
{ |
if(isset($_POST["champ_check".$u])) |
{ |
$preference1=new Preference($user,$_POST["champ_id_pr".$u]); |
$ret= $preference1->enregistrerPreference(); |
if($ret!=1)echo "erreur preferences"; |
} |
} |
} |
?> |
/trunk/controleur/gtt_controleur_admin_utilisateur.php |
---|
New file |
0,0 → 1,268 |
<?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_utilisateur.php'; |
include_once CHEMIN_CLASSES_METIER.'gtt_utilisateur.class.php'; |
/** |
*creation de regles de validation relatives aux valeurs saisies |
*/ |
function verifValeurTemps() |
{ |
if (($_POST["champ_temps_travail"]<12)and ($_POST["champ_temps_travail"]>=0)) |
{ |
return true; |
} |
} |
/** |
*traitement des donnees recuperees par l'utilisateur |
* |
*/ |
function traiterDonneeAdminAjoutUser($values) |
{ |
//test des champs administrateur |
if (isset($values["champ_administrateur"])) |
{ |
$admin=1; |
}else $admin=0; |
if (isset($values["champ_admin2"])) |
{ |
$admin2=1; |
}else $admin2=0; |
if (!isset($values["champ_nom"])) |
{ |
$values["champ_nom"]=$_POST['nom_utilisateur']; |
} |
if (isset ($_POST["champ_valider"])) |
{ |
if ($values["champ_verif"]==0) |
{ |
$tab=array( |
GEST_CHAMPS_NOM =>$values["champ_nom"], |
GEST_CHAMPS_PRENOM =>$values["champ_prenom"], |
GEST_CHAMPS_PASSWORD =>$values["champ_password"], |
GEST_CHAMPS_EMAIL =>$values["champ_email"], |
GEST_CHAMPS_TELEPHONE =>$values["champ_telephone"], |
GEST_CHAMPS_ADRESSE =>$values["champ_adresse"], |
GEST_CHAMPS_CODE_POSTAL =>$values["champ_code_postal"], |
GEST_CHAMPS_VILLE =>$values["champ_ville"] , |
GEST_CHAMPS_QUOTA_HEURES_SUPP => $values["champ_heure_supp_init"], |
GEST_CHAMPS_CONGES_PAYES =>$values["champ_nb_conge"] , |
GEST_CHAMPS_TEMPS_DE_TRAVAIL => $values["champ_temps_travail"], |
GEST_CHAMPS_ADMIN => $admin, |
GEST_CHAMPS_ADMIN2 => $admin2, |
GEST_CHAMPS_STATUT => $values["champ_statut"], |
GEST_CHAMPS_NOTES =>null); |
}else { |
$tab=array( |
GEST_CHAMPS_NOM =>$values["nom_utilisateur"], |
GEST_CHAMPS_PRENOM =>$values["prenom_utilisateur"], |
GEST_CHAMPS_PASSWORD =>$values["champ_password"], |
GEST_CHAMPS_EMAIL =>$values["champ_email"], |
GEST_CHAMPS_TELEPHONE =>$values["champ_telephone"], |
GEST_CHAMPS_ADRESSE =>$values["champ_adresse"], |
GEST_CHAMPS_CODE_POSTAL =>$values["champ_code_postal"], |
GEST_CHAMPS_VILLE =>$values["champ_ville"] , |
GEST_CHAMPS_QUOTA_HEURES_SUPP => $values["heure_supp_utilisateur"], |
GEST_CHAMPS_CONGES_PAYES =>$values["conges_utilisateur"] , |
GEST_CHAMPS_TEMPS_DE_TRAVAIL => $values["champ_temps_travail"], |
GEST_CHAMPS_ADMIN => $admin, |
GEST_CHAMPS_ADMIN2 => $admin2, |
GEST_CHAMPS_STATUT => $values["champ_statut"], |
GEST_CHAMPS_NOTES =>null); |
} |
//verification si mode insertion ou modification |
if ($values["champ_verif"]!=1) |
{ |
$id=&Utilisateur::nextId(); |
$l=new Utilisateur($id); |
$l->construireUtilisateur($tab); |
$res=$l->enregistrerNewUtilisateur(); |
} |
else |
{ |
$i=&Utilisateur::recupIDUtilisateurMail($values["champ_email"]); |
$user= new Utilisateur($i); |
$user->construireUtilisateur($tab); |
$user->MettreAJourUtilisateur(); |
if (isset($_POST["champ_password"])and isset($_POST["champ_confirm_password"])) |
{ |
$user->mettreAJourPassword($_POST["champ_password"]); |
} |
} |
} |
$_POST["champ_valider"]='dejaValider'; |
} |
/*fonction traitant la supression d'utilisateur |
*a verifier les valeurs d'erreur |
*/ |
function traiterAdminEditerUser($values) |
{ |
//cas supression |
if (isset($_POST["btn_supprimer"])) |
{ |
$rang =$values['champ_utilisateur_supprimer']; |
$k = &Utilisateur::supprimerUtilisateur($rang); |
} |
$_POST["btn_supprimer"]='dejaValider'; |
//$_POST["champ_utilisateur_supprimer"]=''; |
} |
/** |
*fonction renvoyant un tableau avec les donnees |
*de l'utilisateur a modifier |
*@return tab |
*/ |
function renvoyerDonneesUser() |
{ |
if (isset($_POST["btn_modifier"])and isset($_POST["champ_utilisateur_supprimer"])) |
{ |
$ident= $_POST["champ_utilisateur_supprimer"]; |
$u= &Utilisateur::recupererUtilisateur($ident); |
//champ admin |
if ($u->isAdmin()==1) |
{ |
$ad1=true; |
}else $ad1=false; |
if ($u->isAdmin2()==1) |
{ |
$ad2=true; |
}else $ad2=false; |
$defaults=array ('champ_nom' =>$u->getNom(), |
'champ_prenom'=>$u->getPrenom(), |
'champ_adresse' =>$u->getAdresse(), |
'champ_ville' =>$u->getVille(), |
'champ_code_postal' =>$u->getCode(), |
'champ_telephone' =>$u->getTelephone(), |
'champ_email' =>$u->getEmail(), |
//champ_password =>$u->getPassword(), |
'champ_statut' =>$u->getStatut(), |
'champ_administrateur' =>$ad1, |
'champ_admin2' => $ad2, |
'champ_nb_conge' =>$u->getConges( ), |
'champ_temps_travail' =>$u->getTempsTravail(), |
'champ_heure_supp_init' =>$u->getQuota( )); |
return $defaults; |
} |
} |
/** |
*fonction traitant toutes les fonctions liees a l'administration d'un utilisateur |
*/ |
function traiterAdminUtilisateur($tab,$mode) |
{ |
$text=creerEntetePage(GESTION_ADMIN_UTILISATEUR_L); |
//cas de l'ajout d'un utilisateur |
$form=afficherMenuAjouterUser($tab,$mode); |
if (isset($_POST["champ_valider"])and $_POST["champ_valider"]!='dejaValider') |
{ |
if ($form->validate()) |
{ |
$form->process('traiterDonneeAdminAjoutUser'); |
$m=afficherMenuAjouterUser('',0); |
$text.=$m->ToHtml(); |
} |
elseif($_POST["champ_verif"]==1) |
{ |
if (verifValeurTemps()) |
{ |
$form->process('traiterDonneeAdminAjoutUser'); |
$m=afficherMenuAjouterUser('',0); |
$text.=$m->ToHtml(); |
}else echo "heure de travail erronée"; |
} |
}else{ |
$text.=$form->ToHtml(); |
} |
//cas supprimer utilisateur |
$forms=afficherMenuEditerUser(); |
if (isset($_POST["btn_supprimer"])and $_POST["btn_supprimer"]!='dejaValider'and $forms->validate()) |
{ |
$forms->process('traiterAdminEditerUser'); |
$m=afficherMenuEditerUser(); |
$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; |
} |
?> |
/trunk/controleur/gtt_controleur_travail.php |
---|
New file |
0,0 → 1,771 |
<?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 'gtt_config.inc.php'; |
include_once CHEMIN_MENU.'gtt_menu_travail.php'; |
include_once CHEMIN_CLASSES_METIER.'gtt_travail.class.php'; |
include_once CHEMIN_CLASSES_METIER.'gtt_taches.class.php'; |
include_once CHEMIN_CLASSES_METIER.'gtt_prevision_tache.class.php'; |
/** |
*fonction verifiant si les heures rentrees sont bien valides |
*verification si heure rentree dans une case <24 ou >0 |
*verifiaction si somme heure d'une journee<24 |
*/ |
function verifTempsTravail() |
{ |
$nb=$_POST["champ_nb_projet"]; |
$res = true; |
//iniatilisation des variables |
$somme1=$somme2=$somme3=$somme4=$somme5=$somme6=$somme7=0; |
$verif_a_faire=false; |
//tableau jour |
$tabJour=array(0=>"champ_lundi",1=>"champ_mardi","champ_mercredi","champ_jeudi","champ_vendredi","champ_samedi","champ_dimanche"); |
for ($i=0;$i<$nb;$i++) |
{ |
for ($j=0;$j<count($tabJour);$j++) |
{ |
//on ne fait les tests que si des jours de travail ou de recuperation partielle |
if ((isset($_POST[$tabJour[$j].$i]))and (($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_TRAVAIL) or |
($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]=="Récup part:1/2j"))) |
{ |
$verif_a_faire=true; |
//attribution de la limite selon le type de jour |
if ($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_TRAVAIL) |
{ |
$limite = 24; |
} |
elseif($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]=="Récup part:1/2j") |
{ |
$limite = 12; |
} |
if ((!(($_POST[$tabJour[$j].$i]<$limite)and ($_POST[$tabJour[$j].$i]>=0)))or |
(empty($_POST[$tabJour[$j].$i])!=1 and is_numeric($_POST[$tabJour[$j].$i])!=1)) |
{ |
$res=false; |
}else{ |
switch ($j) |
{ |
//cas lundi |
case 1: |
$somme1 += $_POST[$tabJour[$j].$i]; |
break; |
//cas mardi |
case 2 : |
$somme2 += $_POST[$tabJour[$j].$i]; |
break; |
//cas mercredi |
case 3 : |
$somme3 += $_POST[$tabJour[$j].$i]; |
break; |
//cas jeudi |
case 4 : |
$somme4 += $_POST[$tabJour[$j].$i]; |
break; |
//cas vendredi |
case 5 : |
$somme5 += $_POST[$tabJour[$j].$i]; |
break; |
//cas samedi |
case 6 : |
$somme6 += $_POST[$tabJour[$j].$i]; |
break; |
//cas dimanche |
case 7 : |
$somme7 += $_POST[$tabJour[$j].$i]; |
break; |
} |
} |
} |
} |
} |
//test si une des valeurs >24 |
if( $verif_a_faire==true) |
{ |
$resultat=(($somme1<$limite)and ($somme2<$limite)and ($somme3<$limite)and ($somme4<$limite)and ($somme5<$limite) |
and ($somme6<$limite)and ($somme7<$limite)and ($res==true)); |
}else $resultat=true; |
return $resultat; |
} |
/** |
*fonction traitant l'ajout d'un champ travail dans la base |
*@param : utilisateur |
*/ |
function traiterSemaine($utilisateur) |
{ |
if (isset($_POST["champ_valider_travail"])) |
{ |
//recuperation de l'utilisateur |
$user1=&Utilisateur::recupererUtilisateur($utilisateur); |
//parcours du tableau de jours |
$tabListeJour=array(0 =>'champ_lundi',1 =>'champ_mardi','champ_mercredi','champ_jeudi','champ_vendredi','champ_samedi','champ_dimanche'); |
//parcourt du tableau de jour |
for ($nb=0;$nb<$_POST["champ_nb_projet"];$nb++) |
{ |
for($j=0; $j<count($tabListeJour);$j++) |
{ |
//test du type de jour |
if (isset($_POST["champ_type_jour".$j])) |
{ |
//cas jour de travail ou recuperation partielle(recuperation partielle ne reduit pas le temps de travail |
if (($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_TRAVAIL) |
or (($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_RECUP_PART) |
and ($_POST["champ_rtt_type_jour".$_POST["champ_type_jour".$j]]==0))) |
{ |
//test si aucun conges prealablement rentre ne chevauche la date voulue |
//construction d'un objet absence equivalent a la date de travail |
$testAbs= new Absence($utilisateur,0,date('Y-m-d',$_POST["champ_date_j".$j])); |
$testAbs->setDateFin(date('Y-m-d',$_POST["champ_date_j".$j])); |
$tabAbsence=$testAbs->existeAbsence(); |
//booleen pour indiquer si on peut ajouter |
$possibleAjout=true; |
//si chevauchement: verification si tous validee |
if(count($tabAbsence)>0) |
{ |
if($testAbs->existeAbsenceValidee()==true) |
{ |
$possibleAjout=false; |
$_POST[$tabListeJour[$j].$nb]=''; |
$codeErreur=2; |
}else{ |
//supression des absences non validees |
for($p=0;$p<count($tabAbsence);$p++) |
{ |
$l=$tabAbsence[$p]; |
$absTemp2=$testAbs; |
$absTemp2->construireAbsence($l); |
$nbJour2=$absTemp2->getDureeAbsence(); |
//mise a jour des quota heures sup et des conges payes de l'utilisateur |
if($_POST["champ_libelle_type_jour".$l[GEST_CHAMPS_ID_MOTIF]]==GTT_NOM_RECUPERATION) |
{ |
$quotaTemp=$user1->getQuota(); |
$user1->setQuota($quotaTemp+(($user1->getTempsTravail())*$nbJour2)); |
}elseif($_POST["champ_libelle_type_jour".$l[GEST_CHAMPS_ID_MOTIF]]==GTT_NOM_RECUP_PART) |
{ |
$quotaTemp=$user1->getQuota(); |
$user1->setQuota($quotaTemp+((($user1->getTempsTravail())/2)*$nbJour2)); |
}else |
{ |
if ($_POST["champ_libelle_type_jour".$l[GEST_CHAMPS_ID_MOTIF]]==GTT_NOM_CONGES_PAYES) |
{ |
$congesTemp=$user1->getConges(); |
$user1->setConges($congesTemp+($nbJour2*1)); |
} |
} |
$f=$testAbs->supprimerAbsence($utilisateur,$l[GEST_CHAMPS_DATE_DEBUT_ABSENCE]); |
if ($f!=1)$codeErreur=3; |
} |
} |
} |
//determination des limites de travail en fonction du type de jour |
if ($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_TRAVAIL) |
{ |
$limiteHeureTravail=$GLOBALS['limiteJourTravail']; |
}else |
{ |
$limiteHeureTravail=$GLOBALS['limiteJourRecupPart']; |
//construction de l'absence |
$absenceRecupPart=new Absence($utilisateur,$_POST["champ_type_jour".$j],date('Y-m-d',$_POST["champ_date_j".$j])); |
$absenceRecupPart->setDateFin(date('Y-m-d',$_POST["champ_date_j".$j])); |
//traitement de l'enregistrement de la recuperation partielle |
if($possibleAjout==true) |
{ |
$q = $absenceRecupPart->enregistrerNewAbsence(); |
//mise a jour des quotas |
$val=$user1->getQuota(); |
$duree=$user1->getTempsTravail(); |
$user1->setQuota($val-(($user1->getTempsTravail())/2)); |
if ($q!=1 ) |
{ |
//attribution d'un code erreur |
$codeErreur=1; |
} |
} |
} |
//test si le champ n'est pas vide et le champ est different de 0 |
if (empty($_POST[$tabListeJour[$j].$nb])!=1 and ($_POST[$tabListeJour[$j].$nb])!=0) |
{ |
//test si date <=date d'aujourd'hui |
if ($_POST["champ_date_j".$j]<=time() and ($possibleAjout==true)) |
{ |
//impossible de modifier des donnees une fosi que l'absence |
//est enregistree |
//construction de l'objet travail |
$travail= new Travail($utilisateur,$_POST["champ_tache".$nb]); |
$travail->setDateTravail(date('Y-m-d',$_POST["champ_date_j".$j])); |
$travail->setDureeTravail($_POST[$tabListeJour[$j].$nb]); |
//traitement de l'objet travail |
$t=traiterTravail($travail,$limiteHeureTravail); |
$_POST[$tabListeJour[$j].$nb]=''; |
if($t!=1)$codeErreur=$t; |
}else{ |
if($possibleAjout==true) |
{ |
//cas ou la date est superieure a la date d'aujourd'hui |
//construction de l'objet prevision |
$prevision=new Prevision(1000,1000); |
$tableau=array(GEST_CHAMPS_ID_UTILISATEUR=>$utilisateur, |
GEST_CHAMPS_ID_TACHE=>$_POST["champ_tache".$nb], |
GEST_CHAMPS_DATE_PREVISION=>date('Y-m-d',$_POST["champ_date_j".$j]), |
GEST_CHAMPS_DUREE_PREVISION=> $_POST["$tabListeJour[$j]".$nb]); |
$prevision->construirePrevision($tableau); |
$o=traiterPrevision($prevision, $limiteHeureTravail); |
$_POST[$tabListeJour[$j].$nb]=''; |
if($o!=1)$codeErreur=$o; |
} |
} |
}//fin traitement travail et prevision |
}else{ |
//cas des conges |
//cas : conges paye,recup,maladie,greve,ferie |
if(($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_CONGES_PAYES) |
or ($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_RECUPERATION) |
or ($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_MALADIE) |
or ($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_GREVE) |
or ($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_WEEK_END) |
or ($_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]==GTT_NOM_FERIE)) |
{ |
//construction du nouvel objet absence |
$objetAbsence=new Absence($utilisateur,$_POST["champ_type_jour".$j],date('Y-m-d',$_POST["champ_date_j".$j])); |
$objetAbsence->setDateFin(date('Y-m-d',$_POST["champ_date_j".$j])); |
//traitement de l'objet absence |
$g=traiterAbsence($objetAbsence,$user1,$_POST["champ_libelle_type_jour".$_POST["champ_type_jour".$j]]); |
if ($g[0]!=1){ |
$codeErreur=$g[0]; |
}else { |
$user1=$g[1]; |
} |
} |
}//fin traitement type jour |
}//typr jour |
} |
// } |
} |
$h=$user1->mettreAJourUtilisateur(); |
if ($h!=1) |
{ |
$codeErreur=25; |
} |
} |
$_POST["champ_valider_travail"]='dejaValider'; |
} |
/** |
fonction qui traite les travaux |
*enregistre si nouveau travail |
*met a jour si existe deja |
*@param : $travail : objet travail |
*@param :limiteHeuretravail=la limite des heure sde travail |
*/ |
function traiterTravail($travail,$limiteHeureTravail) |
{ |
//verification si on ne depasse pas 24 heures |
$sommeTravail= $travail->sommeHeureTravail($travail->getIdUserTravail(),$travail->getDateTravail()); |
if (is_null($sommeTravail)) |
{ |
$sommeTravail=0; |
} |
//verification si donnees precedemment rentrees |
if (($travail->existeTravail()!=0)and ($travail->existeTravail()!=-1)) |
{ |
if (($sommeTravail + ($travail->getDureeTravail())-($travail->existeTravail()))<$limiteHeureTravail) |
{ |
$q=$travail->mettreAjourTravail(); |
if ($q!=1) { |
$res=4; |
}else $res=1; |
} |
}else |
//cas travail n'existe pas encore |
{ |
if ($travail->existeTravail()==0) |
{ |
//test si on de depasse pas 24 heures pour une journee |
if ($sommeTravail + ($travail->getDureeTravail())<$limiteHeureTravail) |
{ |
$w=$travail->enregistrerNewTravail(); |
if ($w!=1){ |
$res=5; |
}else $res=1; |
} |
} |
} |
return $res; |
} |
/** |
*fonction qui traite les previsions |
*@param $prevision: l'objet prevision |
*@param : limite heure de travail |
*@return 1 si aucun erreur |
*@return 5 ou 6 si erreur |
*/ |
function traiterPrevision($prevision, $limiteHeureTravail) |
{ |
//verification si on ne depasse pas 24 heures pour les donnees |
//rentrees a unedate donnee dans la base de donnees |
$sommePrev = $prevision->sommeHeurePrevision($prevision->getIdUserPrevision(),$prevision->getDatePrevision()); |
//verification si une prevision a deja ete faite |
if (($prevision->existePrevision()!=0) and (($prevision->existePrevision()!=-1))) |
{ |
if ($sommePrev+($prevision->getDureePrevision())-($prevision->existePrevision())<$limiteHeureTravail) |
{ |
$q=$prevision->mettreAJourPrevision(); |
if ($q!=1) |
{ |
$res=5; |
echo "echec enregistrement prevision dans base de donnees <br />"; |
}else $res=1; |
} |
}else{ |
//cas ou aucuen prevsion n'a deja ete rentree |
if( $prevision->existePrevision()==0) |
{ |
//test si la somme des previsions de depasse pas 24 heures |
if (($sommePrev+($prevision->getDureePrevision()))<<$limiteHeureTravail) |
{ |
$w =$prevision->enregistrerNewPrevision(); |
if ($w!=1) { |
$res=6; |
echo "erreur enregistrement prevision"; |
}else $res=1; |
} |
} |
} |
return $res; |
} |
/** |
*fonction qui traite les absences |
*@param : $abs : objet absence |
*@param : user: objet utilisateur |
*@param $j : jour de la semaine : lundi =0 |
*supression d'eventuelle absences prealablement rentree |
*supression et enregistrement effectif que si aucune lettre n'a prealablement ete |
*renvoie 1 si enregistrement effectuee |
*met a jour la det de fin si l'absence fait partie d'une periode |
*renvoie code erreur si erreur |
*/ |
function traiterAbsence($abs,$user,$libelle) |
{ |
$tabAbs=$abs->existeAbsence(); |
$ok=true;//booleen indiquant si traitement a faire ou non |
$possible=true;//booleen indiquant que l'absence est possible |
//test si weekend =>on n'insere aucun enregistrement |
if($libelle==GTT_NOM_WEEK_END) |
{ |
$ok=false; |
} |
//si chevauchement existe |
if(count($tabAbs)>0) |
{ |
//on sait que $tabAbs contient au plus un enregistrement |
//car la periode ne tient que sur une journee |
$line=$tabAbs[0]; |
//si pas meme identifiant |
if($line[GEST_CHAMPS_ID_MOTIF]!=$abs->getIdMotif()) |
{ |
if($line[GEST_CHAMPS_DATE_ENVOI_LETTRE]!='0000-00-00') |
{ |
//si le jour d'absence a ete valide |
$ok=false; |
}else{ |
//si absence non encore validee |
//verifiaction pour un jour de conges payes ou recuperation |
if(($libelle==GTT_NOM_CONGES_PAYES)or ($libelle=GTT_NOM_RECUPERATION)) |
{ |
//recuperation de la duree de l'absence qui chevauche le jour demande |
$debut=explode('-',$line[GEST_CHAMPS_DATE_DEBUT_ABSENCE]); |
$fin=explode('-',$line[GEST_CHAMPS_DATE_FIN_ABSENCE]); |
$dateDeb=mktime(0,0,0,$debut[1],$debut[2],$debut[0]); |
$dateFin=mktime(0,0,0,$fin[1],$fin[2],$fin[0]); |
//verification si absence precedente est un conges payes |
if($_POST["champ_libelle_type_jour".$line[GEST_CHAMPS_ID_MOTIF]]==GTT_NOM_CONGES_PAYES) |
{ |
$duree=intval((($dateFin-$dateDeb)/3600)/24); |
}else $duree=0; |
//verification si possible de prendre le conge paye |
if($libelle==GTT_NOM_CONGES_PAYES) |
{ |
if (((($user->getConges())+($duree)-($abs->getDureeAbsence()))<0)) |
{ |
$possible=false; |
} |
}else |
{ |
//mise a jour de la quantite d'heure supp |
$heureSup=$user->getQuota(); |
$user->setQuota($heureSup-($user->getTempsTravail())); |
} |
}//fin test conges payes |
//supression des anciennes absence dans le cas d'une nouvelle absence |
if($possible==true) |
{ |
for ($p=0;$p<count($tabAbs);$p++) |
{ |
$line1=$tabAbs[$p]; |
//duree de l'absence a supprimer |
$abs2=$abs; |
$abs2->construireAbsence($line1); |
$nbJour=$abs2->getDureeAbsence(); |
//mise a jour des quota heures sup et des conges payes de l'utilisateur |
if($_POST["champ_libelle_type_jour".$line1[GEST_CHAMPS_ID_MOTIF]]==GTT_NOM_RECUPERATION) |
{ |
$quotaTemp=$user->getQuota(); |
$user->setQuota($quotaTemp+(($user->getTempsTravail())*$nbJour)); |
}elseif($_POST["champ_libelle_type_jour".$line1[GEST_CHAMPS_ID_MOTIF]]==GTT_NOM_RECUP_PART) |
{ |
$quotaTemp=$user->getQuota(); |
$user->setQuota($quotaTemp+($nbJour*(($user->getTempsTravail())/2))); |
}else |
{ |
if ($_POST["champ_libelle_type_jour".$line1[GEST_CHAMPS_ID_MOTIF]]==GTT_NOM_CONGES_PAYES) |
{ |
$congesTemp=$user->getConges(); |
$user->setConges($congesTemp+(1*$nbJour)); |
} |
} |
$z=$abs->supprimerAbsence($abs->getIdUserAbsence(),$line1[GEST_CHAMPS_DATE_DEBUT_ABSENCE]); |
if($z!=1) |
{ |
$res=7; |
}else $res=1; |
} |
} |
} |
}else |
{ |
//si meme motif on ne fait rien |
$ok=false; |
} |
}else{ |
//si pas de chevauchement |
$supprimTravail=true; |
//supression d'eventuelles travaux |
if ($supprimTravail==true) |
{ |
$res=&Travail::supprimerTachesUserDate($abs->getIdUserAbsence(),$abs->getDateDebAbsence()); |
if($res!=1) |
{ |
$res=8; |
} |
} |
//mise a jour des conge spayes et heures sup |
if(($libelle==GTT_NOM_CONGES_PAYES)or ($libelle=GTT_NOM_RECUPERATION)) |
{ |
//verification si possible de prendre le conge paye |
if($libelle==GTT_NOM_CONGES_PAYES) |
{ |
if ((($user->getConges())-($abs->getDureeAbsence()))>=0) |
{ |
$temp=$user->getConges(); |
//mise a jour des conges payes |
$user->setConges($temp-($abs->getDureeAbsence())); |
}else $ok=false; |
}else |
{ |
//mise a jour de la quantite d'heure supp |
$heureSup=$user->getQuota(); |
$user->setQuota($heureSup-($user->getTempsTravail())); |
} |
}//fin test conges payes |
} |
//enregistrement de la nouvelle absence |
//si traitement a faire |
if($ok==true and $possible==true) |
{ |
$nouveau=true; //booleen indiquant s'il faut enregistrer une nouvelle absence |
$absencePrec=$abs->getAbsencesPrec(); |
$absenceSuiv=$abs->getAbsencesSuiv(); |
//timestamp de la date de debut d'absence |
$dDeb=explode('-',$abs->getDateDebAbsence()); |
$timeDeb=mktime(0,0,0,$dDeb[1],$dDeb[2],$dDeb[0]); |
//timestamp de la date de fin d'absence |
$dFin=explode('-',$abs->getDateFinAbsence()); |
$timeFin=mktime(0,0,0, $dFin[1], $dFin[2], $dFin[0]); |
//creation des timestamp des absences precedentes et suivantes |
if($absencePrec!=-1) |
{ |
$finPrec=explode('-',$absencePrec->getDateFinAbsence()); |
$datePrec=mktime(0,0,0,$finPrec[1],$finPrec[2],$finPrec[0]); |
} |
//timestamp de l'absence suivant |
if($absenceSuiv!=-1) |
{ |
$debSuiv=explode('-',$absenceSuiv->getDateDebAbsence()); |
$dateSuiv=mktime(0,0,0,$debSuiv[1],$debSuiv[2],$debSuiv[0]); |
} |
//verification s'il existe des absences precedentes |
//non encore validees |
//si pas d'absence precedentes |
if($absencePrec==-1) |
{ |
if ($absenceSuiv!=-1) |
{ |
//si absence suivante est contigue |
if(isDateContigues($timeFin,$dateSuiv)==1) |
{ |
$absTemp=$absenceSuiv; |
$absTemp->setDateDeb($abs->getDateDebAbsence()); |
$w=$absTemp->supprimerAbsence($absenceSuiv->getIdUserAbsence(),$absenceSuiv->getDateDebAbsence()); |
$resTemp=$absTemp->enregistrerNewAbsence(); |
$nouveau=false; |
if ($resTemp!=1 or $w!=1) |
{ |
$res=9; |
} |
} |
} |
}else//s'il existe une absence precedentes |
{ |
//si absence precedente contigue |
if(isDateContigues($datePrec,$timeDeb)==1) |
{ |
$absTemp=$absencePrec; |
$absTemp->setDateFin($abs->getDateFinAbsence()); |
$nouveau=false; |
//test si l'absence suivante est vide |
if($absenceSuiv==-1) |
{ |
$resTemp=$absTemp->mettreAJourAbsence(); |
if($resTemp!=1) |
{ |
$res=10; |
} |
}else//si absence suivante existe |
{ |
//test si absence suivante contigue |
if(isDateContigues($timeFin,$dateSuiv)==1) |
{ |
$absTemp->setDateFin($absenceSuiv->getDateFinAbsence()); |
//supression de l'absence suivante |
$res=&Absence::supprimerAbsence($absenceSuiv->getIdUserAbsence(),$absenceSuiv->getDateDebAbsence()); |
if($res!=1) |
{ |
$res=11; |
} |
//mise a jour de l'absence |
$resTemp=$absTemp->enregistrerNewAbsence(); |
if($resTemp!=1) |
{ |
$res=12; |
} |
}else |
{ |
//absence suivante non contigue |
//mise a jour de l'absence |
$resTemp=$absTemp->mettreAJourAbsence(); |
if($resTemp!=1) |
{ |
$res=13; |
} |
} |
} |
}else |
{ |
//si l'absence precedente n'est pas contigue |
if($absenceSuiv!=-1)//verification si absence suivante non vide |
{ |
if(isDateContigues($timeFin,$dateSuiv)==1) |
{ |
//si contigue |
$absTemp=$absenceSuiv; |
$absTemp->setDateDeb($abs->getDateDebAbsence()); |
//enregistrement de l'absence |
$w=$absTemp->supprimerAbsence($absTemp->getIdUserAbsence(),$absenceSuiv->getDateDebAbsence()); |
$resTemp=$absTemp->enregistrerNewAbsence(); |
if($resTemp!=1 or $w!=1) |
{ |
$res=14; |
} |
$nouveau=false; |
} |
} |
} |
} |
if($nouveau==true) |
{ |
$res=$abs->enregistrerNewAbsence(); |
if($res!=1) |
{ |
$res=15; |
} |
} |
return array($res,$user); |
} |
} |
/** |
*fonction qui verifie si deu dates sont contigues |
*@param $dateVerif : timestamp unix |
*@param $date : timestamp unix |
*/ |
function isDateContigues($dateVerif,$date) |
{ |
if ($dateVerif<$date) |
{ |
$dateDeb=$date; |
$dateFin=$dateVerif; |
}else{ |
$dateDeb=$dateVerif; |
$dateFin=$date; |
} |
$r=-1; |
//verification si la date de debut est en semaine |
//ou lundi |
$jour=date('w',$dateDeb); |
//si c un lundi |
if ($jour==1) |
{ |
if(($dateDeb-(3600*24*3))==$dateFin) |
{ |
$r=1; |
} |
}else//si c un jour de semaine |
{ |
if(($dateDeb-(3600*24))==$dateFin) |
{ |
$r=1; |
} |
} |
return $r; |
} |
/** |
*fonction traitant le menu travail |
*/ |
function traiterAdminTravail($url,$semaine,$annee,$utilisateur) |
{ |
$text=creerEntetePage(GESTION_GESTIONDEPOSTE_L); |
$form=afficherTableauJour($url,$utilisateur,$semaine,$annee); |
if (isset($_POST["champ_valider_travail"])and $_POST["champ_valider_travail"]!='dejaValider'and $form->validate()) |
{ |
$form->process(traiterSemaine($utilisateur)); |
$t=afficherTableauJour($url,$utilisateur,$semaine,$annee); |
$text.=$t->ToHTml(); |
}else{ |
$text.=$form->ToHtml(); |
} |
return $text; |
} |
?> |
Property changes: |
Added: svn:executable |
/trunk/controleur/gtt_controleur_admin_motif_absence.php |
---|
New file |
0,0 → 1,143 |
<?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_motif_absence.php'; |
/** |
*fonction traitantg l'ajout des motifs dans la base de donnees |
*/ |
function traiterAjoutermotif() |
{ |
if (isset($_POST["champ_valider_motif"])) |
{ |
$i=&Motif::nextId(); |
$tableau=array(GEST_CHAMPS_ID_MOTIF =>$i, |
GEST_CHAMPS_LIBELLE_MOTIF=>$_POST["champ_nom_motif"], |
GEST_CHAMPS_TYPE_RTT=>0); |
if (isset($_POST["champ_rtt"])) |
{ |
$tableau[GEST_CHAMPS_TYPE_RTT]=1; |
} |
$mot=new Motif($i); |
$mot->ConstruireMotif($tableau); |
$j =$mot->enregistrerMotif(); |
} |
$_POST["champ_valider_motif"]='dejaValider'; |
$_POST["champ_nom_motif"]=''; |
} |
/** |
*fonction traitant la supression des motifs d'absence |
*/ |
function traiterSupprimerMotif() |
{ |
if (isset($_POST["btn_supprimer_motif"])) |
{ |
$identifiant=$_POST["champ_motif_supprimer"]; |
$g=&Motif::motifUtilise($identifiant); |
if ($g!=1) |
{ |
$j=&Motif::supprimerMotif($identifiant); |
}else $j=0; |
if ($j==0) |
{ |
echo "echec supression"; |
} |
} |
$_POST["btn_supprimer_motif"]='dejaValider'; |
$_POST["champ_motif_supprimer"]=''; |
} |
/** |
*fonction verifiant si le motif d'absence est en cours d'utilisation |
*la suppression sera interdite dans ce cas afin de maintenir la cohérence de |
*de la base de donnees |
*/ |
function verifMotifUtilise() |
{ |
$identifiant=$_POST["champ_motif_supprimer"]; |
$verif=&Motif::motifUtilise($identifiant); |
if ($verif==1)return false; |
else return true; |
} |
/** |
*fonction traitant le menu admin motif absence |
*/ |
function traiterAdminMotif() |
{ |
$text=creerEntetePage(GESTION_ADMIN_MOTIF_L); |
//cas de l'ajout |
$form=afficherMenuAjouterMotif(); |
if (isset($_POST["champ_valider_motif"]) and $_POST["champ_valider_motif"]!='dejaValider' and $form->validate()) |
{ |
$form->process('traiterAjouterMotif'); |
$m=afficherMenuAjouterMotif(); |
$text.=$m->ToHTml(); |
}else |
{ |
$text.=$form->ToHtml(); |
} |
//cas supression |
$forms=afficherMenuSupressionMotif(); |
if (isset($_POST["btn_supprimer_motif"]) and $_POST["btn_supprimer_motif"]!='dejaValider' and $forms->validate()) |
{ |
$forms->process('traiterSupprimerMotif'); |
$m=afficherMenuSupressionMotif(); |
$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; |
} |
?> |