diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..66096ff --- /dev/null +++ b/.htaccess @@ -0,0 +1,5 @@ +RewriteEngine On +RewriteBase /dolibarr/htdocs/custom/ACM/web/ + +# Redirige /setup ou /about vers index.php?page=setup ou index.php?page=about +RewriteRule ^(setup|about)$ index.php?page=$1 [L,QSA] diff --git a/admin/.htaccess b/admin/.htaccess new file mode 100644 index 0000000..5d14b45 --- /dev/null +++ b/admin/.htaccess @@ -0,0 +1 @@ +Require all granted \ No newline at end of file diff --git a/admin/setup.php b/admin/setup.php new file mode 100644 index 0000000..3c00e7c --- /dev/null +++ b/admin/setup.php @@ -0,0 +1,44 @@ + 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {$i--;$j--;} +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";} +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";} +if (!$res && file_exists("../../main.inc.php")) {$res = @include "../../main.inc.php";} +if (!$res && file_exists("../../../main.inc.php")) {$res = @include "../../../main.inc.php";} +if (!$res) {die("Include of main fails");} + +global $langs, $user; + + +// Translations +$langs->loadLangs(array("admin", "ACM@ACM")); + + +$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken']; + +$data = array( + 'controleur' => 'admin', + 'action' => 'afficherSetup', + 'page' => 'etup', + 'token' => "$csrfToken" +); + +// URL where you want to POST data +$redirect_url = '../index.php'; +echo ''; +echo '
'; +foreach ($data as $key => $value) {echo '';} +echo '
'; +echo ''; +echo ''; + +$db->close(); +?> \ No newline at end of file diff --git a/classe/.htaccess b/classe/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/classe/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/classe/Classe/.htaccess b/classe/Classe/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/classe/Classe/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/classe/Classe/GestionDate/GestionPeriode.php b/classe/Classe/GestionDate/GestionPeriode.php new file mode 100644 index 0000000..a97384c --- /dev/null +++ b/classe/Classe/GestionDate/GestionPeriode.php @@ -0,0 +1,29 @@ +jourDebut = $jourDebut; + $this->jourFin = $jourFin; + } + public function getNbDemiJournnees(){ + $this->jourFin ->modify('+1 day'); + $interval = (($this->jourDebut->diff($this->jourFin))->days)*2; + if ( $this->jourDebut->format("Y-m-d" )==$this->jourFin->format("Y-m-d") + && $this->jourDebut->format("a" )==$this->jourFin->format("a")) { + $interval = $interval - 1; + } else { + if ( $this->jourDebut->format("a") == "pm") {$interval = $interval-1;} + if ( $this->jourFin->format("a") == "am") {$interval = $interval-1;} + }return $interval; + } + + public function jourDansPeriode(DateTime $date) : bool { + return $this->jourDebut->format("Ymd")<=$date->format("Ymd") + && $this->jourFin->format("Ymd")>=$date->format("Ymd"); + } +} diff --git a/classe/Classe/GestionDate/GestionSemaine.php b/classe/Classe/GestionDate/GestionSemaine.php new file mode 100644 index 0000000..959fa3b --- /dev/null +++ b/classe/Classe/GestionDate/GestionSemaine.php @@ -0,0 +1,77 @@ +nom = $nomClasse; + $this->jours = []; + foreach (self::$joursSemaine as $jour) $this->jours[$jour] = [0, 0]; + } + + public function setLundi(int $matin, int $aprem = 0) {$this->jours["lundi"] = [$matin, $aprem];} + public function setMardi(int $matin, int $aprem = 0) {$this->jours["mardi"] = [$matin, $aprem];} + public function setMercredi(int $matin, int $aprem = 0) {$this->jours["mercredi"] = [$matin, $aprem];} + public function setJeudi(int $matin, int $aprem = 0) {$this->jours["jeudi"] = [$matin, $aprem];} + public function setVendredi(int $matin, int $aprem = 0) {$this->jours["vendredi"] = [$matin, $aprem];} + public function setSamedi(int $matin, int $aprem = 0) {$this->jours["samedi"] = [$matin, $aprem];} + public function setDimanche(int $matin, int $aprem = 0) {$this->jours["dimanche"] = [$matin, $aprem];} + + public function setDayByNb(int $day, int $matin, int $aprem = 0 ){ + switch ($day) { + case 1: $this->setLundi($matin, $aprem);break; + case 2: $this->setMardi($matin, $aprem);break; + case 3: $this->setMercredi($matin, $aprem);break; + case 4: $this->setJeudi($matin, $aprem);break; + case 5: $this->setVendredi($matin, $aprem);break; + case 6: $this->setSamedi($matin, $aprem);break; + case 7: $this->setDimanche($matin, $aprem);break; + } + } + + public function getNom() : string {return $this->nom;} + public function toString() : string { + $texte = ""; + $x = 0; + $td = 14; + if (!$this->estVide()){ + foreach (GestionSemaine::$joursSemaine as $jour) { + if ($td <= 0){break;} + if ($x <= 0){ + if ($this->jours[$jour][0] == 0 && $this->jours[$jour][1] == 0) { + $texte = $texte . ""; + $td -= 2; + }else { + if ($this->jours[$jour][0] != 0) {$x = $this->jours[$jour][0]; + $texte = $texte . "
o
"; + $td -= $this->jours[$jour][0]; + } + elseif ($this->jours[$jour][1] != 0) { + $texte = $texte . ""; + $texte = $texte . "
o
"; + $x = $this->jours[$jour][1]-1; + $td -= ($this->jours[$jour][1]+1); + } + } + } + if ($x-2 >= 0) { + $x = $x - 2; + } elseif ($x-1 == 0) { + $x = $x - 1; + $texte = $texte . ""; + } + } + } + return $texte; + } + + public function estVide() { + $somme = 0; + foreach (self::$joursSemaine as $jour) {$somme = $somme + $this->jours[$jour][0] + $this->jours[$jour][1];} + return $somme == 0; + } +} diff --git a/classe/Classe/GestionDate/gestionJour.php b/classe/Classe/GestionDate/gestionJour.php new file mode 100644 index 0000000..3f1dcb9 --- /dev/null +++ b/classe/Classe/GestionDate/gestionJour.php @@ -0,0 +1,27 @@ +jourDansPeriode($date); + } + public function jourCorrespondAuBonNombre (string $jour, DateTime $date) : bool { + $tab = ["lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche"]; + return $tab[((int)$date->format("N")) + 1]==$jour; + } + public function getLundiSemaine(DateTime $date = null) : DateTime { + if ($date == null) {$date = new DateTime();} + if ($date->format("N") != "1") { + $date->modify("-1 day"); + return $this->getLundiSemaine($date); + } + return $date; + } + public function getPremierJourDuMois(DateTime $date = null) { + if ($date == null) {$date = new DateTime();} + return new DateTime($date->format("Y-m")."-1"); + } + +} diff --git a/classe/Classe/GestionPlanning/GestionPlanningGeneriqueSemaine.php b/classe/Classe/GestionPlanning/GestionPlanningGeneriqueSemaine.php new file mode 100644 index 0000000..0b506ac --- /dev/null +++ b/classe/Classe/GestionPlanning/GestionPlanningGeneriqueSemaine.php @@ -0,0 +1,7 @@ +listeJourFerier[$jour['nom']] = ["date"=> new DateTime((new DateTime())->format("Y")."-".$jour['mois']."-".$jour['jour']), "actif" => $jour['actif']]; + }elseif ($jour['regle'] == "paque"){ + $paque =$this->paque(intval((new DateTime())->format("Y"))); + $date = $paque->modify("+".$jour['jour']." day"); + $this->listeJourFerier[$jour['nom']] = ["date"=> $date, "actif" => $jour['actif']]; + } + } + } + public function getListeJourFerier() { + $liste = []; + foreach ($this->listeJourFerier as $key=>$jour) $liste[$key] = $jour["date"]; + return $liste; + } + public function getListeJourFerierActif() { + $liste = []; + foreach ($this->listeJourFerier as $key=>$jour) + if ($jour['actif'] == 'actif') $liste[$key] = $jour["date"]; + return $liste; + } + private function paque(int $year): \DateTime { + $k = intdiv($year, 100); + $m = 15 + intdiv((3 * $k + 3), 4) - intdiv((8 * $k + 13), 25); + $s = 2 - intdiv((3 * $k + 3), 4); + $a = $year % 19; + $d = (19 * $a + $m) % 30; + $r = intdiv(($d + intdiv($a, 11)), 29); + + $og = 21 + $d - $r ; + $sz = 7 - ($year + intdiv($year, 4) + $s) % 7; + $oe = 7 - ($og - $sz) % 7; + $os = $og + $oe; + + $result = new \DateTime(sprintf('%04s-03-01', $year)); + $result->add( + \DateInterval::createFromDateString( + sprintf('%s days', $os-1) + ) + ); + return $result; + } + +} \ No newline at end of file diff --git a/classe/Classe/gestionTexte.php b/classe/Classe/gestionTexte.php new file mode 100644 index 0000000..cbe6fe6 --- /dev/null +++ b/classe/Classe/gestionTexte.php @@ -0,0 +1,16 @@ +user = $user; + $this->dateLundi = $dateLundi; + } + + public function getUser() : string {return $this->user;} + public function getDateLundi() : DateTime {return $this->dateLundi;} + + public function getTravailSemaine() {} + public function getTeletravailSemaine() {} + public function getCongeSemaine() { + return $this->getSemaine("LEAVE_PAID_FR", "couleurCongee"); + } + public function getRecupeSemaine() { + return $this->getSemaine("LEAVE_RECUP", "couleurRecupe"); + } + + private function getSemaine($code, $couleur) { + $dateDimanche = new DateTime($this->dateLundi->format('Y-m-d')." 08:00:00"); + $dateDimanche->modify('+6 day'); + $dateDimanche->modify('+7 hours'); + $listeMalade = gestionUtilisateur::getListeCongeeParNomEtCode($this->user["login"], $code); + $periode = []; + foreach ($listeMalade as $malade) { + if ($malade && ($this->dateLundi->format("Ymd") <= (new DateTime($malade["date_fin"]))->format("Ymd") && (new DateTime($malade["date_debut"]))->format("Ymd") <= $dateDimanche->format("Ymd"))) { + if ( (new DateTime($malade["date_fin"]))->format("Ymd") >= $dateDimanche->format("Ymd")) { + $malade["date_fin"] = $dateDimanche->format("Y-m-d H:i:s"); + } + if ((new DateTime($malade["date_debut"]))->format("Ymd") <= $this->dateLundi->format("Ymd")) { + $malade["date_debut"] = $this->dateLundi->format("Y-m-d H:i:s"); + } + $periode[(new DateTime($malade["date_debut"]))->format("Y-m-d H:i:s")] = new gestionPeriode(new DateTime($malade["date_debut"]), new DateTime($malade["date_fin"])); + } + } + $retour = new GestionSemaine($couleur); + foreach ($periode as $key=>$malade) { + if ((new DateTime($key))->format("a") == "am") + $retour->setDayByNb((new DateTime($key))->format("N"), $malade->getNbDemiJournnees()); + else + $retour->setDayByNb((new DateTime($key))->format("N"), 0, $malade->getNbDemiJournnees()); + } + return $retour->toString(); + } + public function getMaladeSemaine() { + $couleur = "couleurMalade"; + $code1 = "LEAVE_SICK_WORK"; + $code2 = "LEAVE_SICK"; + $dateDimanche = new DateTime($this->dateLundi->format('Y-m-d')." 08:00:00"); + $dateDimanche->modify('+6 day'); + $dateDimanche->modify('+7 hours'); + $listeMalade = gestionUtilisateur::getListeCongeeParNomEtDeuxCode($this->user["login"], $code1, $code2); + $periode = []; + foreach ($listeMalade as $malade) { + if ($malade && ($this->dateLundi->format("Ymd") <= (new DateTime($malade["date_fin"]))->format("Ymd") && (new DateTime($malade["date_debut"]))->format("Ymd") <= $dateDimanche->format("Ymd"))) { + if ( (new DateTime($malade["date_fin"]))->format("Ymd") >= $dateDimanche->format("Ymd")) { + $malade["date_fin"] = $dateDimanche->format("Y-m-d H:i:s"); + } + if ((new DateTime($malade["date_debut"]))->format("Ymd") <= $this->dateLundi->format("Ymd")) { + $malade["date_debut"] = $this->dateLundi->format("Y-m-d H:i:s"); + } + $periode[(new DateTime($malade["date_debut"]))->format("Y-m-d H:i:s")] = new gestionPeriode(new DateTime($malade["date_debut"]), new DateTime($malade["date_fin"])); + } + } + $retour = new GestionSemaine($couleur); + foreach ($periode as $key=>$malade) { + if ((new DateTime($key))->format("a") == "am") + $retour->setDayByNb((new DateTime($key))->format("N"), $malade->getNbDemiJournnees()); + else + $retour->setDayByNb((new DateTime($key))->format("N"), 0, $malade->getNbDemiJournnees()); + } + return $retour->toString(); + } +} \ No newline at end of file diff --git a/classe/Controleur/.htaccess b/classe/Controleur/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/classe/Controleur/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/classe/Controleur/ControleurAbsence.php b/classe/Controleur/ControleurAbsence.php new file mode 100644 index 0000000..2a2d16f --- /dev/null +++ b/classe/Controleur/ControleurAbsence.php @@ -0,0 +1,39 @@ +trans("ACMAbsenceTitre"); + $titre = " ".$titrePage; + $liste = gestionUtilisateur::getAllEmployer(); + $date = (new GestionJour())->getLundiSemaine($date); + for($x = 0; $x < 7; $x++) { $semaine[] = new DateTime($date->format("Y-m-d"));$date->modify('+1 day');} + $date->modify("-1 week"); + $mois = " ".$langs->trans("ACM".$semaine[0]->format("M")); + if ($semaine[0]->format("m") == $semaine[6]->format("m")) {$mois = "";} + if ($semaine[0]->format("Y") == $semaine[6]->format("Y")) { $anne0 = ""; + if ((new DateTime())->format("Y") == $semaine[6]->format("Y")) {$anne1 = "";} + else $anne1 = " ".$semaine[6]->format("Y"); + }else {$anne0 = " ".$semaine[0]->format("Y"); $anne1 = " ".$semaine[6]->format("Y");} + $titreSemaine = $langs->trans("ACMSemaineDu")." ".$semaine[0]->format("d")." ".$mois.$anne0." ".$langs->trans("ACMAu")." ".$semaine[6]->format("d"). " ".$langs->trans("ACM".$semaine[6]->format("M")).$anne1; + $listeDateSemaine = []; + foreach ($liste as $user) { + $gestionUser = new gestionUtilisateurSemaine($user, $date); + $listeDateSemaine[$user["login"]]["Malade"] = $gestionUser->getMaladeSemaine(); + $listeDateSemaine[$user["login"]]["Congé"] = $gestionUser->getCongeSemaine(); + $listeDateSemaine[$user["login"]]["Recupe"] = $gestionUser->getRecupeSemaine(); + } + self::afficherVue(["cheminCorpsVue"=>$chemin, "message" => $message, "titrePage"=>$titrePage, "titre"=>$titre, + "liste"=>$liste, "langs"=>$langs, "semaine"=>$semaine, "titreSemaine"=>$titreSemaine, "date"=>$date, + "listeDateSemaine"=>$listeDateSemaine]); + } +} \ No newline at end of file diff --git a/classe/Controleur/ControleurAdmin.php b/classe/Controleur/ControleurAdmin.php new file mode 100644 index 0000000..c1fbee2 --- /dev/null +++ b/classe/Controleur/ControleurAdmin.php @@ -0,0 +1,85 @@ +$chemin, "lien" => $lien]; + foreach ($variables as $key => $value) $parameters[$key] = $value; + self::afficherVue($parameters); + + } + public static function afficherSetup($message = "") { + global $langs; + $lien = "dateGestion".".php"; + $couleurs = gestionVariableCouleur::getACMCouleurs(); + $liste = gestionVariableDate::getACMFeries(); + self::afficherBase("$lien", ["liste" => $liste, "message" => $message, "listeCouleur"=>$couleurs]); + } + + public static function putActif() { + global $langs; + $nom = $_POST["nom"]; + $res = gestionVariableDate::putACMDateActif($nom); + if (!$res) $message = $langs->trans("ACMEchecConnexion"); + self::afficherSetup($message); + } + public static function putInactif() { + global $langs; + $nom = $_POST['nom']; + $res = gestionVariableDate::putACMDateInactif($nom); + if (!$res) $message = $langs->trans("ACMEchecConnexion"); + self::afficherSetup($message); + } + public static function supprimer($message = "") { + global $langs; + $nom = $_POST["nom"]; + $titre = $langs->trans("ACMClasseTitreFonction"); + $chemin = self::$lien . "suppression" . ".php"; + $titrePage = $langs->trans("ACMAdminSupprimer"); + self::afficherBase("suppression.php", ["message" => $message, "nom"=>$nom]); + } + public static function suppression() { + global $langs; + $nom = $_POST["nom"]; + $oui = $_POST["ouiNon"]; + if ($oui == "true") { + $res = gestionVariableDate::deleteACMFeries($nom); + if (!$res) $message = $langs->trans("ACMEchecSuppression"); + else $message = $langs->trans("ACMSuppressionReussite"); + self::afficherSetup($message); + } + else self::afficherSetup("ACMSuppressionAnnuler"); + + } + + public static function changerCouleur($message = "") { + global $langs; + + $ACMTitreTableau = $_POST["ACMTitreTableau"]; gestionVariableCouleur::updateACMCouleur("ACMTitreTableau", $ACMTitreTableau); + $ACMCorpsTableau = $_POST["ACMCorpsTableau"];gestionVariableCouleur::updateACMCouleur("ACMCorpsTableau", $ACMCorpsTableau); + $ACMBordure = $_POST["ACMBordure"]; gestionVariableCouleur::updateACMCouleur("ACMBordure", $ACMBordure); + $ACMConge = $_POST["ACMConge"]; gestionVariableCouleur::updateACMCouleur("ACMConge", $ACMConge); + $ACMMalade = $_POST["ACMMalade"]; gestionVariableCouleur::updateACMCouleur("ACMMalade", $ACMMalade); + $ACMTravail = $_POST["ACMTravail"]; gestionVariableCouleur::updateACMCouleur("ACMTravail", $ACMTravail); + $ACMTeletravail = $_POST["ACMTeletravail"]; gestionVariableCouleur::updateACMCouleur("ACMTeletravail", $ACMTeletravail); + $ACMFontTitreTableau = $_POST["ACMFontTitreTableau"]; gestionVariableCouleur::updateACMCouleur("ACMFontTitreTableau", $ACMFontTitreTableau); + $ACMFontCorpsTableau = $_POST["ACMFontCorpsTableau"]; gestionVariableCouleur::updateACMCouleur("ACMFontCorpsTableau", $ACMFontCorpsTableau); + $ACMRecupe = $_POST["ACMRecupe"]; gestionVariableCouleur::updateACMCouleur("ACMRecupe", $ACMRecupe); + + self::afficherSetup("$ACMTitreTableau"); + } + /*public static function modele($message = "") { + global $langs; + $titre = $langs->trans("ACMClasseTitreFonction"); + $chemin = self::$lien."chemin"."php"; + $titrePage = $langs->trans("ACMAdminTitrePage"); + self::afficherVue(["titre"=>$titre, "cheminCorpsVue"=>$chemin, "message" => $message, "titrePage"=>$titrePage, + ]); + } + }*/ +} \ No newline at end of file diff --git a/classe/Controleur/ControleurGenerique.php b/classe/Controleur/ControleurGenerique.php new file mode 100644 index 0000000..fb98bff --- /dev/null +++ b/classe/Controleur/ControleurGenerique.php @@ -0,0 +1,16 @@ + "erreur.php", "messageErreur" => $messageErreur]); + } +} \ No newline at end of file diff --git a/classe/GestionBD/.htaccess b/classe/GestionBD/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/classe/GestionBD/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/classe/GestionBD/gestionCouleur.php b/classe/GestionBD/gestionCouleur.php new file mode 100644 index 0000000..2a41897 --- /dev/null +++ b/classe/GestionBD/gestionCouleur.php @@ -0,0 +1,45 @@ +query($query); + } +} \ No newline at end of file diff --git a/classe/GestionBD/gestionDate.php b/classe/GestionBD/gestionDate.php new file mode 100644 index 0000000..daf2457 --- /dev/null +++ b/classe/GestionBD/gestionDate.php @@ -0,0 +1,46 @@ +query($query); + } +} \ No newline at end of file diff --git a/classe/GestionBD/gestionUtilisateur.php b/classe/GestionBD/gestionUtilisateur.php new file mode 100644 index 0000000..3559705 --- /dev/null +++ b/classe/GestionBD/gestionUtilisateur.php @@ -0,0 +1,108 @@ +query("SET NAMES 'utf8mb4'"); + $list = []; + $sql = " SELECT rowid, entity, ref_employee, ref_ext, admin, employee, fk_establishment, login, gender, civility + , lastname, firstname, job, fk_member, fk_user, fk_user_holiday_validator, idpers1, idpers2, + idpers3, datelastlogin, dateendvalidity, statut, photo, color, barcode, fk_barcode_type, + nb_holiday, thm, tjm, salary, salaryextra, dateemployment, dateemploymentend, weeklyhours, + national_registration_number + FROM llx_user + WHERE employee = 1 + ORDER BY fk_establishment, lastname, login"; + $resql=$db->query($sql); + if ($resql) { + // Parcours des résultats avec fetch_array + while ($row = $db->fetch_array($resql)) { + // Accès aux colonnes via leur index ou alias + $list[] = ["id"=>$row['rowid'], "login"=>$row['login']]; + } + } else { return false; } + return $list; + } + + + + /** + * @param $nom string nom de l'utilisateur + * @return array|false return l'id de l'utilisateur + */ + public static function getIdParNom($nom) { + global $db; + $db->query("SET NAMES 'utf8mb4'"); + $nom = $db->escape($nom); + $sql = "SELECT rowid FROM llx_user WHERE login = '$nom'"; + $resql=$db->query($sql); + if ($resql) { + $row = $db->fetch_array($resql); + $row = $row['rowid']; + return $row; + } else { return false; } + } + + /** + * @param $nom string nom de l'utilisateur + * @param $code string type de congee de dolibarr + * @return array|false return la liste des dates congées des utilisateurs ou faux en cas d'erreur sql + */ + public static function getListeCongeeParNomEtCode(string $nom, string $code) { + $id = self::getIdParNom($nom); + global $db; + $db->query("SET NAMES 'utf8mb4'"); + $list = []; + $matin = "08:00"; $soir = "15:00"; + $id = $db->escape($id); // pour protéger contre l'injection sql + $code = $db->escape($code); + $sql = "SELECT h.date_debut, h.date_fin, t.code, h.halfday FROM llx_holiday h JOIN llx_c_holiday_types t on h.fk_type = t.rowid WHERE h.fk_user = '$id' and h.date_approval IS NOT NULL and code = '$code'"; + $resql=$db->query($sql); + if ($resql) { + while ($row = $db->fetch_array($resql)) { + $debut = $matin; + $fin = $soir; + if ($row['halfday'] == "2") {$debut = $soir;$fin = $matin;} + if ($row['halfday'] == "-1") {$debut = $soir;} + if ($row['halfday'] == "1") {$fin = $matin;} + $list[] = ["date_debut" => $row['date_debut']." ".$debut, "date_fin" => $row['date_fin']." ".$fin, "type" => $row['code']]; + } + } else { return false; } + return $list; + } + + /** + * @param $nom string nom de l'utilisateur + * @param $code1 string type de congé à recuperer + * @param $code2 string type de congé à recuperer + * @return array|false renvoie la liste des congés correspondent à au moins un des deux codes ou faux en cas d'erreur sql + */ + public static function getListeCongeeParNomEtDeuxCode(string $nom, string $code1, string $code2) { + $id = self::getIdParNom($nom); + global $db; + $db->query("SET NAMES 'utf8mb4'"); + $list = []; + $matin = "08:00"; $soir = "15:00"; + $id = $db->escape($id); // pour protéger contre l'injection sql + $code1 = $db->escape($code1); + $code2 = $db->escape($code2); + $sql = "SELECT h.date_debut, h.date_fin, t.code, h.halfday FROM llx_holiday h JOIN llx_c_holiday_types t on h.fk_type = t.rowid WHERE h.fk_user = '$id' and h.date_approval IS NOT NULL and (code = '$code1' OR code = '$code2')"; + $resql=$db->query($sql); + if ($resql) { + while ($row = $db->fetch_array($resql)) { + $debut = $matin; + $fin = $soir; + if ($row['halfday'] == "2") {$debut = $soir;$fin = $matin;} + if ($row['halfday'] == "-1") {$debut = $soir;} + if ($row['halfday'] == "1") {$fin = $matin;} + $list[] = ["date_debut" => $row['date_debut']." ".$debut, "date_fin" => $row['date_fin']." ".$fin, "type" => $row['code']]; + } + } else { return false; } + return $list; + } + +} \ No newline at end of file diff --git a/classe/GestionBD/gestionVariableCouleur.php b/classe/GestionBD/gestionVariableCouleur.php new file mode 100644 index 0000000..575902d --- /dev/null +++ b/classe/GestionBD/gestionVariableCouleur.php @@ -0,0 +1,35 @@ +query("SET NAMES 'utf8mb4'"); + $list = []; + $sql = "SELECT nom, codeHexa FROM llx_acm_couleur"; + $resql=$db->query($sql); + if ($resql) + while ($row = $db->fetch_array($resql)) + $list[$row['nom']] = $row['codeHexa']; + return $list; + } + + /** + * @param $nom string nom de la variable + * @param $codeHexa string code de la couleur en hexa + * @return bool renvoie si la modification, c'est bien effectué + */ + public static function updateACMCouleur(string $nom, string $codeHexa) { + global $db; + $db->query("SET NAMES 'utf8mb4'"); + $nom = $db->escape($nom); + $codeHexa = $db->escape($codeHexa); + $sql = "UPDATE llx_acm_couleur SET codeHexa='$codeHexa' WHERE nom='$nom'"; + $resql=$db->query($sql); + if ($resql) return true; + return false; + } +} \ No newline at end of file diff --git a/classe/GestionBD/gestionVariableDate.php b/classe/GestionBD/gestionVariableDate.php new file mode 100644 index 0000000..bda75a5 --- /dev/null +++ b/classe/GestionBD/gestionVariableDate.php @@ -0,0 +1,75 @@ +query("SET NAMES 'utf8mb4'"); + $list = []; + $sql = "SELECT nom, regle, jour, mois, actif FROM llx_acm_feries ORDER BY regle ASC, mois ASC, jour ASC"; + $resql=$db->query($sql); + if ($resql) + while ($row = $db->fetch_array($resql)) + $list[] = ["nom"=>$row['nom'],"regle"=>$row['regle'],"jour"=>$row['jour'],"mois"=>$row['mois'],"actif"=>$row['actif']]; + return $list; + } + + /** + * @param $nom string label de la date + * @return bool renvoie si la modification a été effectuer + */ + public static function putACMDateActif(string $nom) : bool { + global $db; $db->query("SET NAMES 'utf8mb4'"); + $nom = $db->escape($nom); + $sql = "UPDATE llx_acm_feries SET actif='actif' WHERE nom = '$nom';"; + $resql=$db->query($sql); + if ($resql) return true; + else return false; + } + /** + * @param $nom string label de la date + * @return bool renvoie si la modification a été effectuer + */ + public static function putACMDateInactif($nom) : bool{ + global $db; $db->query("SET NAMES 'utf8mb4'"); + $nom = $db->escape($nom); + $sql = "UPDATE llx_acm_feries SET actif='inactif' WHERE nom = '$nom';"; + $resql=$db->query($sql); + if ($resql) return true; + else return false; + } + + /** + * @param $nom string label de la date + * @param $regle string type de regle + * @param $jour string|int jour + * @param $mois string|int mois + * @param $actif string si est actif ou inactif + * @return bool renvoie la valeur d'insertion + */ + public static function addACMFeries(string $nom, string $regle, $jour, $mois, string $actif) : bool { + global $db; $db->query("SET NAMES 'utf8mb4'"); + $nom = $db->escape($nom); $regle = $db->escape($regle); + $jour = $db->escape($jour); $mois = $db->escape($mois); + $actif = $db->escape($actif); + $sql = "INSERT INTO llx_acm_feries(nom, regle, jour, mois, actif) VALUES ('$nom','$regle','$jour','$mois','$actif')"; + $resql=$db->query($sql); + if ($resql) return true; + else return false; + } + + /** + * @param $nom string label de la date + * @return bool renvoie la valeur de suppression + */ + public static function deleteACMFeries($nom) : bool { + global $db; $db->query("SET NAMES 'utf8mb4'"); + $nom = $db->escape($nom); + $sql = "DELETE FROM llx_acm_feries WHERE nom = '$nom'"; + $resql=$db->query($sql); + if ($resql) return true; + else return false; + } +} \ No newline at end of file diff --git a/core/.htaccess b/core/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/core/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/core/modules/modACM.class.php b/core/modules/modACM.class.php new file mode 100644 index 0000000..f3fbfe7 --- /dev/null +++ b/core/modules/modACM.class.php @@ -0,0 +1,128 @@ +register(); +$chargeurDeClasse->addNamespace('Module\\ACM',__DIR__ ."/../../" ); + +use Module\ACM\Classe\GestionBD\gestionVariableCongee; +use Module\ACM\Classe\GestionBD\gestionDate; +use Module\ACM\Classe\GestionBD\gestionCouleur; + +require_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; + +class modACM extends DolibarrModules{ + /** + * @param $db TraceableDB est la variable qui contient la bd de dolibarr + */ + function __construct($db) { + + /** ** ** Base de la création de module dolibarr ** ** **/ + global $langs; + $this->db = $db; + $langs->load("ACM@ACM"); + $this->numero = 340003; + $this->editor_name = "Desal"; // nom de l'éditeur + $this->family = "Desal-Tools"; // lieu où le module est retrouvable + $this->name = preg_replace('/^mod/i', '', get_class($this)); // permet de récupérer le nom du module à partir du nom du fichier + $this->description = $langs->trans("ACMDescription"); // description du module, permet une traduction grâce à la fonction traduction + $this->version = 1; // numero de version au format X.X + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // constante du nom du module + $this->special = 3; // ? + $this->picto = 'ACM.png@'.$this->name; // image nommée object_ACM.png dans le dossier img de ACM + $this->module_parts = array ( // permet la gestion et l'execution des triggers et du js + 'hooks'=>array('holidaycard', 'holidaylist', 'formObjectOptions'), + 'js'=>array() + ); + + /** Création de répertoire dans la partie documentation **/ + $this->dirs = array(); // Exemple de composent : "/templateDolibarr/temp" + $r = 0; + /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ + + /** Gestion des dépendances et des modules obligatoires **/ + $this->hidden = false; + $this->depends = array("modHRM"); // module obligatoire pour utilisation + $this->conflictwith = array(); // liste des modules conflictuelle + $this->phpmin = array(7,0); // version minimum de php demander + $this->need_dolibarr_version = array(19,0,2); // version minimum de dolibarr demander + $this->langfiles = array($this->name.'@'.$this->name); // position du fichier de langue + /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ + $csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken']; + $this->config_page_url = '../custom/ACM/admin/setup.php'; + + $this->tabs = array('objecttype:+ACMAbsences:Absences:ACM@ACM:/ACM/absences.php?id=__ID__'); + + $this->boxes = array(); // permet un affichage sur la page d'accueil + $r = 0; + + /** ** ** Gestion des permissions ** ** **/ + $this->rights = array(); + $this->rights_class = $this->name; + $r=0; + + // Exemple de permission // + $r++; + $this->rights[$r][0] = 3400031; + $this->rights[$r][1] = 'User can use the module'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'moduleutilisable'; + /** ** ** ** ** ** ** ** ** ** ** ** ** **/ + $r = 0; + + + $this->menu = array(); + $r = 0; + $r = $r+1; + // Add here entries to declare new menus + /* BEGIN MODULEBUILDER TOPMENU */ + $this->menu[$r] = array( + 'fk_menu' => 'fk_mainmenu=hrm', // Pas de parent, menu principal + 'type' => 'left', // Menu principal en haut + 'prefix' => img_picto('pictoAbsence', 'absence@ACM', 'class="pictofixedwidth paddingright em088"'), + 'titre' => " ".$langs->trans("ACMAbsenceTitre"), // Nom affiché + 'mainmenu' => 'hrm', // Menu principal pour ton module + 'leftmenu' => 'acmAbsences', // Identifiant unique pour le sous-menu + 'url' => '/acm/index.php', // Lien vers ta page + 'langs' => 'acm@acm', // Fichier de langue + 'position' => 1000+$r, // Position dans le menu + 'enabled' => '$conf->acm->enabled', // Affiche seulement si ACM est activé + ); + + $r = $r+1; + global $dolibarr_main_url_root; + $css_file = $dolibarr_main_url_root . '/custom/ACM/css/style.css'; + $this->resprints = ""; + } + + /** + * @override dolibarr + * @param $options + * @return int + */ + function init($options=''){ + global $conf, $langs; + $result = $this->_load_tables('/ACM/sql/'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + $this->remove($options); + $sql = array(); + gestionCouleur::getListeCouleur(); + gestionDate::importerDateFerier(); + return $this->_init($sql, $options); + } + + /** + * @param $options + * @return mixed + */ + function remove($options=''){ + $sql = array(); + return $this->_remove($sql, $options); + } + + + +} \ No newline at end of file diff --git a/css/StyleTableau.css.php b/css/StyleTableau.css.php new file mode 100644 index 0000000..7e65aaa --- /dev/null +++ b/css/StyleTableau.css.php @@ -0,0 +1,37 @@ + + \ No newline at end of file diff --git a/img/.htaccess b/img/.htaccess new file mode 100644 index 0000000..5d14b45 --- /dev/null +++ b/img/.htaccess @@ -0,0 +1 @@ +Require all granted \ No newline at end of file diff --git a/img/absence.png b/img/absence.png new file mode 100644 index 0000000..282f736 Binary files /dev/null and b/img/absence.png differ diff --git a/img/object_ACM.png b/img/object_ACM.png new file mode 100644 index 0000000..4a8f4d2 Binary files /dev/null and b/img/object_ACM.png differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..a93b99b --- /dev/null +++ b/index.php @@ -0,0 +1,42 @@ +register(); +$chargeurDeClasse->addNamespace('Module\\ACM',__DIR__); +$res = 0; +global $db, $hookmanager, $conf; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";} +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {$i--;$j--;} +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";} +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";} +// Try main.inc.php using relative path +if (!$res && file_exists("../../main.inc.php")) {$res = @include "../../main.inc.php";} +if (!$res && file_exists("../../../main.inc.php")) {$res = @include "../../../main.inc.php";} +if (!$res) {die("Include of main fails");} + +if (!isset($_POST['controleur'])){ + $controleur = 'ControleurAbsence'; +} else { + $controleur = $_POST['controleur']; +} + + +$nomDeClasseControleur = 'Module\ACM\Classe\Controleur\Controleur'.ucfirst($controleur); +if (class_exists($nomDeClasseControleur)){ + if (isset($_POST['action'])){ + $action = $_POST['action']; + $methodes = get_class_methods($nomDeClasseControleur); + if (in_array($action, $methodes)){ + $nomDeClasseControleur::$action(); + }else ControleurGenerique::afficherErreur("

Erreur 404

page not found

"); + }else ControleurAbsence::afficherAbsence(); +}else ControleurAbsence::afficherAbsence(); \ No newline at end of file diff --git a/js/.htaccess b/js/.htaccess new file mode 100644 index 0000000..5d14b45 --- /dev/null +++ b/js/.htaccess @@ -0,0 +1 @@ +Require all granted \ No newline at end of file diff --git a/js/envoiePost.js b/js/envoiePost.js new file mode 100644 index 0000000..2bd98a7 --- /dev/null +++ b/js/envoiePost.js @@ -0,0 +1,27 @@ +function envoyerPost(data, url, csrfToken) { + // Créer un formulaire + const form = document.createElement('form'); + form.method = 'POST'; + form.action = url; + + // Ajouter chaque clé-valeur du tableau comme champ de formulaire + for (const [key, value] of Object.entries(data)) { + const input = document.createElement('input'); + input.type = 'hidden'; + input.name = key; + input.value = value; + form.appendChild(input); + } + + // Ajouter le jeton CSRF au formulaire + const csrfInput = document.createElement('input'); + csrfInput.type = 'hidden'; + csrfInput.name = 'token'; + csrfInput.value = csrfToken; + form.appendChild(csrfInput); + + // Ajouter le formulaire au document, le soumettre et le supprimer + document.body.appendChild(form); + form.submit(); + document.body.removeChild(form); +} \ No newline at end of file diff --git a/langs/.htaccess b/langs/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/langs/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/langs/fr_FR/ACM.lang b/langs/fr_FR/ACM.lang new file mode 100644 index 0000000..563ab42 --- /dev/null +++ b/langs/fr_FR/ACM.lang @@ -0,0 +1,72 @@ +# Dolibarr language file - fr_FR - ACM +CHARSET-UTF-8 +# Générique +ACM = Absence Congé Manageur +ACMDescription = Absence Congé Manageur ou ACM est un module ayant pour but la facilitation de la gestion des congés et des absences des employers. + +# Setup +ACMSettings = Absence Congé Manageur Paramétrage et Information +ACMSetup = Paramétrage ACM +ACMSetupTitre = Paramétrage Absence Congé Manageur +ACMPasDeParamettragePossible = Pas de paramettrage possible pour ACM pour le moment +# About +ACMAbout = A propos d'ACM +ACMAboutTitre = A propos d'Absence Congé Manageur +ACMAboutIntro = Absence Congé Manageur ou ACM est un module ayant pour but la facilitation de la gestion des congés et des absences des employers. +ACMAboutP1 = La gestion des absences est faite dans la partie GRH +ACMAboutP2 = La gestion des congés n'est pas encore géré +ACMCreditLogo = Icônes créées par zero_wing - Flaticon +ACMCreditLogoAbs = Icônes créées par Deione - Flaticon + +Permission3400031 = Utilisateur peux utiliser ce module + +# Absence +ACMAbsenceTitre = Gestion des absences +ACMSemaineDu = Semaine du +ACMAu = au + +# Date +ACMNewYear = Nouvel an +ACMLaborDay = Fête du travail +ACMVictoryDay = Armistice 39 45 +ACMNationalDay = Fête nationale +ACMAssomption = 15 août +ACMToussaint = Toussaint +ACMArmistice = Armistice 14 18 +ACMChristmas = Noël +ACMEasterMonday = Pâques +ACMAscension = Ascension +ACMPentecost = Pentecôte + +# Mois +ACMJan = janvier +ACMFeb = février +ACMMar = mars +ACMApr = avril +ACMMay = mai +ACMJun = juin +ACMJul = juillet +ACMAug = août +ACMSep = septembre +ACMOct = octobre +ACMNov = novembre +ACMDec = décembre + +# Gestion Planing +ACMTitreTableau = titre tableau +ACMCorpsTableau = corp tableau +ACMBordure = bordure +ACMConge = congé +ACMAbsent = absent +ACMMalade = malade +ACMTravail = travail +ACMTeletravail = télétravail +ACMAm = matin +ACMPm = après-midi +ACMLogin = identifient +ACMFontTitreTableau = titre +ACMFontCorpsTableau = texte +ACMRecupe = récupération + +# Couleur +ACMCouleur = Couleur \ No newline at end of file diff --git a/lib/.htaccess b/lib/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/lib/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/lib/ACM.lib.php b/lib/ACM.lib.php new file mode 100644 index 0000000..a33a050 --- /dev/null +++ b/lib/ACM.lib.php @@ -0,0 +1,74 @@ +. + */ + +/** + * \file temp/lib/temp.lib.php + * \ingroup temp + * \brief Library files with common functions for Temp + */ + +/** + * Prepare admin pages header + * + * @return array + */ +function ACMAdminPrepareHead() +{ + global $langs, $conf; + + // global $db; + // $extrafields = new ExtraFields($db); + // $extrafields->fetch_name_optionals_label('myobject'); + + $langs->load("ACM@ACM"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/ACM/admin/setup.php", 1); + $head[$h][1] = $langs->trans("Settings"); + $head[$h][2] = 'settings'; + $h++; + + /* + $head[$h][0] = dol_buildpath("/temp/admin/myobject_extrafields.php", 1); + $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = is_countable($extrafields->attributes['myobject']['label']) ? count($extrafields->attributes['myobject']['label']) : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' ' . $nbExtrafields . ''; + } + $head[$h][2] = 'myobject_extrafields'; + $h++; + */ + + + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@temp:/temp/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@temp:/temp/mypage.php?id=__ID__' + //); // to remove a tab + + complete_head_from_modules($conf, $langs, null, $head, $h, 'ACM@ACM'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'ACM@ACM', 'remove'); + + return $head; +} diff --git a/lib/Psr4AutoloaderClass.php b/lib/Psr4AutoloaderClass.php new file mode 100644 index 0000000..3710f80 --- /dev/null +++ b/lib/Psr4AutoloaderClass.php @@ -0,0 +1,213 @@ +register(); + * + * // register the base directories for the namespace prefix + * $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/src'); + * $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/tests'); + * + * The following line would cause the autoloader to attempt to load the + * \Foo\Bar\Qux\Quux classe from /path/to/packages/foo-bar/src/Qux/Quux.php: + * + * debug = $debug; + } + + private function affichageDebogage(string $message) : void + { + if ($this->debug) + echo $message; + } + + /** + * An associative array where the key is a namespace prefix and the value + * is an array of base directories for classes in that namespace. + * + * @var array + */ + protected array $prefixes = array(); + + /** + * Register loader with SPL autoloader stack. + * + * @return void + */ + public function register() : void + { + spl_autoload_register(array($this, 'loadClass')); + } + + /** + * Adds a base directory for a namespace prefix. + * + * @param string $prefix The namespace prefix. + * @param string $base_dir A base directory for classe files in the + * namespace. + * @param bool $prepend If true, prepend the base directory to the stack + * instead of appending it; this causes it to be searched first rather + * than last. + * @return void + */ + public function addNamespace(string $prefix, string $base_dir, bool $prepend = false) : void + { + // normalize namespace prefix + $prefix = trim($prefix, '\\') . '\\'; + + // normalize the base directory with a trailing separator + $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/'; + + // initialize the namespace prefix array + if (isset($this->prefixes[$prefix]) === false) { + $this->prefixes[$prefix] = array(); + } + + // retain the base directory for the namespace prefix + if ($prepend) { + array_unshift($this->prefixes[$prefix], $base_dir); + } else { + array_push($this->prefixes[$prefix], $base_dir); + } + } + + /** + * Loads the classe file for a given classe name. + * + * @param string $class The fully-qualified classe name. + * @return mixed The mapped file name on success, or boolean false on + * failure. + */ + public function loadClass(string $class) + { + $this->affichageDebogage("

Chargement automatique de classe $class

"); + // the current namespace prefix + $prefix = $class; + + // work backwards through the namespace names of the fully-qualified + // classe name to find a mapped file name + while (false !== $pos = strrpos($prefix, '\\')) { + + // retain the trailing namespace separator in the prefix + $prefix = substr($class, 0, $pos + 1); + + // the rest is the relative classe name + $relative_class = substr($class, $pos + 1); + + // try to load a mapped file for the prefix and relative classe + $mapped_file = $this->loadMappedFile($prefix, $relative_class); + if ($mapped_file) { + return $mapped_file; + } + + // remove the trailing namespace separator for the next iteration + // of strrpos() + $prefix = rtrim($prefix, '\\'); + } + + // never found a mapped file + $this->affichageDebogage("

Échec !

"); + return false; + } + + /** + * Load the mapped file for a namespace prefix and relative classe. + * + * @param string $prefix The namespace prefix. + * @param string $relative_class The relative classe name. + * @return mixed Boolean false if no mapped file can be loaded, or the + * name of the mapped file that was loaded. + */ + protected function loadMappedFile(string $prefix, string $relative_class) + { + // are there any base directories for this namespace prefix? + if (isset($this->prefixes[$prefix]) === false) { + return false; + } + + // look through base directories for this namespace prefix + foreach ($this->prefixes[$prefix] as $base_dir) { + + $this->affichageDebogage("Remplacement du préfixe $prefix par $base_dir
"); + + // replace the namespace prefix with the base directory, + // replace namespace separators with directory separators + // in the relative classe name, append with .php + $file = $base_dir + . str_replace('\\', '/', $relative_class) + . '.php'; + + // if the mapped file exists, require it + if ($this->requireFile($file)) { + // yes, we're done + return $file; + } + } + + // never found it + return false; + } + + /** + * If a file exists, require it from the file system. + * + * @param string $file The file to require. + * @return bool True if the file exists, false if not. + */ + protected function requireFile(string $file) : bool + { + if (file_exists($file)) { + $this->affichageDebogage("

Réussite : fichier chargé

$file

"); + require $file; + return true; + } + $this->affichageDebogage("

Échec : fichier introuvable

$file

"); + return false; + } +} \ No newline at end of file diff --git a/sql/llx_acm_couleur.sql b/sql/llx_acm_couleur.sql new file mode 100644 index 0000000..000fc58 --- /dev/null +++ b/sql/llx_acm_couleur.sql @@ -0,0 +1,5 @@ +CREATE TABLE IF NOT EXISTS llx_acm_couleur ( + rid integer NOT NULL auto_increment PRIMARY KEY, + nom varchar(32) UNIQUE NOT NULL, + codeHexa varchar(7) NOT NULL +); diff --git a/sql/llx_acm_feries.sql b/sql/llx_acm_feries.sql new file mode 100644 index 0000000..9c99ce0 --- /dev/null +++ b/sql/llx_acm_feries.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS llx_acm_feries ( + rid integer NOT NULL auto_increment PRIMARY KEY, + nom varchar(32) NOT NULL UNIQUE, + regle varchar(32) NOT NULL DEFAULT 'fixe', + jour int NULL, + mois int NULL, + actif varchar(7) NOT NULL DEFAULT 'actif' +); diff --git a/view/.htaccess b/view/.htaccess new file mode 100644 index 0000000..a7a56f7 --- /dev/null +++ b/view/.htaccess @@ -0,0 +1 @@ +Require all denied \ No newline at end of file diff --git a/view/admin/dateGestion.php b/view/admin/dateGestion.php new file mode 100644 index 0000000..dcd6319 --- /dev/null +++ b/view/admin/dateGestion.php @@ -0,0 +1,135 @@ +loadLangs(array("admin", "ACM@ACM")); +/** @var $liste */ +/** @var $listeCouleur */ +?> + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ nom + + régle + + jour + + mois + + état + + +
+ trans($item['nom']) ?> + + + + + + + + + + + + + + + + + + + + +
+ aucune valeur dans la base de donnée +
+
+
+
+

Gestion des couleurs

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ " /> + + + " /> + + + " /> + +
+ " /> + + + " /> + + +
+ " /> + + + " /> + + + " /> + +
" />
+
+
diff --git a/view/admin/parametrageBase.php b/view/admin/parametrageBase.php new file mode 100644 index 0000000..e91012f --- /dev/null +++ b/view/admin/parametrageBase.php @@ -0,0 +1,80 @@ +loadLangs(array("admin", "ACM@ACM")); + +$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken']; +/** @var $lien */ +$page_name = "ACMSettings"; +$backtopage = GETPOST('backtopage', 'alpha'); +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); +?> + + +
+ + trans("ACMSetup")?> + trans("ACMAbout")?> +
+ + + + +
+

trans("ACMSetupTitre")?>

+ +
+ + + + \ No newline at end of file diff --git a/view/admin/suppression.php b/view/admin/suppression.php new file mode 100644 index 0000000..f612683 --- /dev/null +++ b/view/admin/suppression.php @@ -0,0 +1,34 @@ + +
+ + + + +
+ + + + + + + + + + + +
+ trans("ACMTexteDeSuppression")." ".$nom?> +
+ + + + + +
+ +
+
+
diff --git a/view/erreur.php b/view/erreur.php new file mode 100644 index 0000000..2e8baac --- /dev/null +++ b/view/erreur.php @@ -0,0 +1,9 @@ + +
+ + +
+
+ diff --git a/view/planningAbsence/acceuil.php b/view/planningAbsence/acceuil.php new file mode 100644 index 0000000..4f7b498 --- /dev/null +++ b/view/planningAbsence/acceuil.php @@ -0,0 +1,95 @@ +format('Y-m-d')); $dateSuv = new DateTime($semaine[0]->format('Y-m-d'));$datePrecMois = new DateTime($semaine[0]->format('Y-m-d')); $dateSuvMois = new DateTime($semaine[0]->format('Y-m-d')); +$datePrec->modify('-1 week'); $dateSuv->modify('+1 week');$datePrecMois->modify('-1 month'); $dateSuvMois->modify('+1 month'); +$datePrec = $datePrec->format("Y-m-d"); $dateSuv = $dateSuv->format("Y-m-d");$datePrecMois = $datePrecMois->format("Y-m-d"); $dateSuvMois = $dateSuvMois->format("Y-m-d"); + +?> + +

+ + + + + +

+ + + + + + + + + + + + + + + + + + + + + + $affichage"; + } + ?> + "; + foreach ($semaine as $jour) {?> + + "; + }?> + + +
+ trans("ACMLogin")?> + + format("d/m/Y") ?> +
+ trans("ACMAm")?> + + trans("ACMPm")?> +
+ + + + + + +
trans("ACMConge")?> trans("ACMMalade")?> trans("ACMRecupe")?>
\ No newline at end of file diff --git a/view/vueGenerale.php b/view/vueGenerale.php new file mode 100644 index 0000000..8358a02 --- /dev/null +++ b/view/vueGenerale.php @@ -0,0 +1,24 @@ +'; + + if ($message != "") print "

$message

"; + else if ($popup != "") print ''; + if (isset($cheminCorpsVue))require __DIR__ . "/{$cheminCorpsVue}"; + +print ""; +// End of page +llxFooter(); +?> +