Module Dolibarr ACM version 1
This commit is contained in:
parent
223313bef1
commit
caa88dc0da
5
.htaccess
Normal file
5
.htaccess
Normal file
@ -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]
|
||||||
1
admin/.htaccess
Normal file
1
admin/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all granted
|
||||||
44
admin/setup.php
Normal file
44
admin/setup.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Module\ACM\Admin;
|
||||||
|
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
$res = 0;
|
||||||
|
global $db, $hookmanager, $conf;
|
||||||
|
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";}
|
||||||
|
$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";}
|
||||||
|
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 '<html><body>';
|
||||||
|
echo '<form id="redirectForm" action="' . $redirect_url . '" method="POST">';
|
||||||
|
foreach ($data as $key => $value) {echo '<input type="hidden" name="' . $key . '" value="' . htmlspecialchars($value) . '">';}
|
||||||
|
echo '</form>';
|
||||||
|
echo '<script type="text/javascript">document.getElementById("redirectForm").submit();</script>';
|
||||||
|
echo '</body></html>';
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
?>
|
||||||
1
classe/.htaccess
Normal file
1
classe/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
1
classe/Classe/.htaccess
Normal file
1
classe/Classe/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
29
classe/Classe/GestionDate/GestionPeriode.php
Normal file
29
classe/Classe/GestionDate/GestionPeriode.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Classe\GestionDate;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
|
class GestionPeriode {
|
||||||
|
private DateTime $jourDebut;
|
||||||
|
private DateTime $jourFin;
|
||||||
|
public function __construct(DateTime $jourDebut, DateTime $jourFin) {
|
||||||
|
$this->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");
|
||||||
|
}
|
||||||
|
}
|
||||||
77
classe/Classe/GestionDate/GestionSemaine.php
Normal file
77
classe/Classe/GestionDate/GestionSemaine.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Classe\GestionDate;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
|
class GestionSemaine {
|
||||||
|
private string $nom;
|
||||||
|
private array $jours;
|
||||||
|
private static array $joursSemaine = ["lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche"];
|
||||||
|
|
||||||
|
public function __construct(string $nomClasse) {
|
||||||
|
$this->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></td><td></td>";
|
||||||
|
$td -= 2;
|
||||||
|
}else {
|
||||||
|
if ($this->jours[$jour][0] != 0) {$x = $this->jours[$jour][0];
|
||||||
|
$texte = $texte . "<td class='$this->nom tailleDiv' colspan='". ($this->jours[$jour][0]) ."'><div>o</div></td>";
|
||||||
|
$td -= $this->jours[$jour][0];
|
||||||
|
}
|
||||||
|
elseif ($this->jours[$jour][1] != 0) {
|
||||||
|
$texte = $texte . "<td></td>";
|
||||||
|
$texte = $texte . "<td class='$this->nom tailleDiv' colspan='".($this->jours[$jour][1])."'><div>o</div></td>";
|
||||||
|
$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 . "<td></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
classe/Classe/GestionDate/gestionJour.php
Normal file
27
classe/Classe/GestionDate/gestionJour.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Classe\GestionDate;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
|
/** Permet la verification de la conformité des dates et des jours*/
|
||||||
|
class GestionJour {
|
||||||
|
public function jourEstDansLaPeriode(GestionPeriode $periode, DateTime $date) : bool {
|
||||||
|
return $periode->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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Classe\GestionPlanning;
|
||||||
|
|
||||||
|
/** gestion des plannings de façon générique */
|
||||||
|
abstract class GestionPlanningGeneriqueSemaine {
|
||||||
|
|
||||||
|
}
|
||||||
54
classe/Classe/gestionJourFerier.php
Normal file
54
classe/Classe/gestionJourFerier.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Classe;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use Module\ACM\Classe\GestionBD\gestionVariableDate;
|
||||||
|
class gestionJourFerier {
|
||||||
|
private array $listeJourFerier;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$listeJour = gestionVariableDate::getACMFeries();
|
||||||
|
foreach ($listeJour as $jour) {
|
||||||
|
if ($jour['regle'] == "fixe"){
|
||||||
|
$this->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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
classe/Classe/gestionTexte.php
Normal file
16
classe/Classe/gestionTexte.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Classe;
|
||||||
|
class gestionTexte {
|
||||||
|
public static function tronquerXChar(string $texte, int $nbChar) : string {
|
||||||
|
return substr($texte, $nbChar);
|
||||||
|
}
|
||||||
|
public static function tronquerParentheses($texte, $parametre = "") : string {
|
||||||
|
return preg_replace('/\(.*?\)/', $parametre, $texte);
|
||||||
|
}
|
||||||
|
public static function tronquerAccolade($texte, $parametre = "") : string {
|
||||||
|
return preg_replace('/\{.*?\}/', $parametre, $texte);
|
||||||
|
}
|
||||||
|
public static function tronquerCrochee($texte, $parametre = "") : string {
|
||||||
|
return preg_replace('/\[.*?\]/', $parametre, $texte);
|
||||||
|
}
|
||||||
|
}
|
||||||
84
classe/Classe/gestionUtilisateurSemaine.php
Normal file
84
classe/Classe/gestionUtilisateurSemaine.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Classe;
|
||||||
|
use DateTime;
|
||||||
|
use Module\ACM\Classe\Classe\GestionDate\GestionPeriode;
|
||||||
|
use Module\ACM\Classe\Classe\GestionDate\GestionSemaine;
|
||||||
|
use Module\ACM\Classe\GestionBD\gestionUtilisateur;
|
||||||
|
|
||||||
|
class gestionUtilisateurSemaine {
|
||||||
|
private $user;
|
||||||
|
private DateTime $dateLundi;
|
||||||
|
|
||||||
|
public function __construct($user, DateTime $dateLundi) {
|
||||||
|
$this->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();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
classe/Controleur/.htaccess
Normal file
1
classe/Controleur/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
39
classe/Controleur/ControleurAbsence.php
Normal file
39
classe/Controleur/ControleurAbsence.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Controleur;
|
||||||
|
use DateTime;
|
||||||
|
use Module\ACM\Classe\Classe\gestionUtilisateurSemaine;
|
||||||
|
use Module\ACM\Classe\Classe\GestionDate\GestionJour;
|
||||||
|
use Module\ACM\Classe\GestionBD\gestionUtilisateur;
|
||||||
|
|
||||||
|
class ControleurAbsence extends ControleurGenerique {
|
||||||
|
protected static string $lien = "/planningAbsence/";
|
||||||
|
|
||||||
|
public static function afficherAbsence($message = "") {
|
||||||
|
global $langs;
|
||||||
|
$date = new DateTime($_POST["date"]);
|
||||||
|
$chemin = self::$lien.""."acceuil".".php";
|
||||||
|
$titrePage = $langs->trans("ACMAbsenceTitre");
|
||||||
|
$titre = "<img class='pictotitle widthpictotitle' src='img\absence.png'> ".$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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
85
classe/Controleur/ControleurAdmin.php
Normal file
85
classe/Controleur/ControleurAdmin.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Controleur;
|
||||||
|
use Module\ACM\Classe\GestionBD\gestionVariableCouleur;
|
||||||
|
use Module\ACM\Classe\GestionBD\gestionVariableDate;
|
||||||
|
class ControleurAdmin extends ControleurGenerique {
|
||||||
|
protected static string $lien = "/admin/";
|
||||||
|
|
||||||
|
private static function afficherBase($lien, $variables=[]) {
|
||||||
|
global $langs;
|
||||||
|
$chemin = self::$lien."parametrageBase".".php";
|
||||||
|
$parameters = ["cheminCorpsVue"=>$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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
16
classe/Controleur/ControleurGenerique.php
Normal file
16
classe/Controleur/ControleurGenerique.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\Controleur;
|
||||||
|
|
||||||
|
class ControleurGenerique
|
||||||
|
{
|
||||||
|
protected static function afficherVue(array $parametres = []): void {
|
||||||
|
extract($parametres);
|
||||||
|
require_once "view/vueGenerale.php"; // Charge la vue
|
||||||
|
}
|
||||||
|
public static function afficherErreur(string $messageErreur = "") : void {
|
||||||
|
if ($messageErreur == ""){
|
||||||
|
$messageErreur = "Problème inconue";
|
||||||
|
}
|
||||||
|
self::afficherVue(["cheminCorpsVue" => "erreur.php", "messageErreur" => $messageErreur]);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
classe/GestionBD/.htaccess
Normal file
1
classe/GestionBD/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
45
classe/GestionBD/gestionCouleur.php
Normal file
45
classe/GestionBD/gestionCouleur.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\GestionBD;
|
||||||
|
class GestionCouleur {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void fait l'insertion de toute les variables avec des couleurs par default
|
||||||
|
*/
|
||||||
|
public static function getListeCouleur() {
|
||||||
|
global $db;
|
||||||
|
$sqls = [
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMTitreTableau', '#c43316'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMTitreTableau')",
|
||||||
|
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMCorpsTableau', '#ffffff'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMCorpsTableau')",
|
||||||
|
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMBordure', '#ac0c0c'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMBordure')",
|
||||||
|
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMConge', '#ead815'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMConge')",
|
||||||
|
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMMalade', '#f6b42b'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMMalade')",
|
||||||
|
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMFontTitreTableau', '#ffffff'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMFontTitreTableau')",
|
||||||
|
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMFontCorpsTableau', '#000000'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMFontCorpsTableau')",
|
||||||
|
|
||||||
|
"INSERT INTO llx_acm_couleur (nom, codeHexa)
|
||||||
|
SELECT 'ACMRecupe', '#cccccc'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_couleur WHERE nom = 'ACMRecupe')"
|
||||||
|
];
|
||||||
|
foreach ($sqls as $query) $db->query($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
46
classe/GestionBD/gestionDate.php
Normal file
46
classe/GestionBD/gestionDate.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\GestionBD;
|
||||||
|
class gestionDate {
|
||||||
|
/**
|
||||||
|
* @return void fait l'insertion de toutes les dates de jour férié
|
||||||
|
*/
|
||||||
|
public static function importerDateFerier() {
|
||||||
|
global $db;
|
||||||
|
$sqls = [
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMNewYear','fixe','1','1','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMNewYear' )",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMLaborDay','fixe','1','5','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMLaborDay' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMVictoryDay','fixe','8','5','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMVictoryDay' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMNationalDay','fixe','14','7','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMNationalDay' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMAssomption','fixe','15','8','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMAssomption' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMToussaint','fixe','1','11','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMToussaint' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMArmistice','fixe','11','11','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMArmistice' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, mois, actif)
|
||||||
|
SELECT 'ACMChristmas','fixe','25','12','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMChristmas');",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, actif)
|
||||||
|
SELECT 'ACMEasterMonday','paque','1','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMEasterMonday' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, actif)
|
||||||
|
SELECT 'ACMAscension','paque','39','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMAscension' );",
|
||||||
|
"INSERT INTO llx_acm_feries (nom, regle, jour, actif)
|
||||||
|
SELECT 'ACMPentecost','paque','49','actif'
|
||||||
|
WHERE NOT EXISTS ( SELECT 1 FROM llx_acm_feries WHERE nom = 'ACMPentecost' );",
|
||||||
|
];
|
||||||
|
foreach ($sqls as $query) $db->query($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
108
classe/GestionBD/gestionUtilisateur.php
Normal file
108
classe/GestionBD/gestionUtilisateur.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\GestionBD;
|
||||||
|
class gestionUtilisateur {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array|false renvoie tous les employés ou faux en cas d'erreur sql
|
||||||
|
*/
|
||||||
|
public static function getAllEmployer(){
|
||||||
|
global $db;
|
||||||
|
$db->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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
35
classe/GestionBD/gestionVariableCouleur.php
Normal file
35
classe/GestionBD/gestionVariableCouleur.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\GestionBD;
|
||||||
|
class gestionVariableCouleur {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array renvoie le dictionnaire des couleurs pour le module
|
||||||
|
*/
|
||||||
|
public static function getACMCouleurs() : array {
|
||||||
|
global $db;
|
||||||
|
$db->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
75
classe/GestionBD/gestionVariableDate.php
Normal file
75
classe/GestionBD/gestionVariableDate.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\ACM\Classe\GestionBD;
|
||||||
|
class gestionVariableDate {
|
||||||
|
/**
|
||||||
|
* @return array renvoie toutes les dates férié sous forme de liste de dictionnaire
|
||||||
|
*/
|
||||||
|
public static function getACMFeries() : array{
|
||||||
|
global $db;
|
||||||
|
$db->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
core/.htaccess
Normal file
1
core/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
128
core/modules/modACM.class.php
Normal file
128
core/modules/modACM.class.php
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
use Module\ACM\Lib\Psr4AutoloaderClass;
|
||||||
|
require_once __DIR__ . '/../../lib/Psr4AutoloaderClass.php';
|
||||||
|
$chargeurDeClasse = new Psr4AutoloaderClass();
|
||||||
|
$chargeurDeClasse->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 = "<link rel='stylesheet' type='text/css' href='$css_file'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
37
css/StyleTableau.css.php
Normal file
37
css/StyleTableau.css.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
use Module\ACM\Classe\GestionBD\gestionVariableCouleur;
|
||||||
|
$couleur = gestionVariableCouleur::getACMCouleurs();
|
||||||
|
$fondTheadCouleur = $couleur["ACMTitreTableau"];
|
||||||
|
$fondTbodyCouleur = $couleur["ACMCorpsTableau"];
|
||||||
|
$fontTheadCouleur = $couleur["ACMFontTitreTableau"];
|
||||||
|
$fontTbodyCouleur = $couleur["ACMFontCorpsTableau"];
|
||||||
|
$couleurBordure = $couleur["ACMBordure"];
|
||||||
|
$couleurCongee = $couleur["ACMConge"];
|
||||||
|
$couleurMalade = $couleur["ACMMalade"];
|
||||||
|
$couleurRecupe = $couleur["ACMRecupe"];
|
||||||
|
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
#rhTable *{ padding: 0; margin: 0; border: 0;}
|
||||||
|
#rhTable {width: 100%; border-collapse: collapse}
|
||||||
|
#rhTable thead {background: <?= $fondTheadCouleur ?>; color:<?=$fontTheadCouleur?>}
|
||||||
|
#rhTable tbody {background: <?= $fondTbodyCouleur ?>; color:<?=$fontTbodyCouleur?>}
|
||||||
|
|
||||||
|
|
||||||
|
#rhTable thead * {border: <?=$couleurBordure?> 2px solid}
|
||||||
|
#rhTable td {align-items: center; align-content: center; text-align: center;}
|
||||||
|
#rhTable tbody .ligne_semaine {border-bottom: <?=$couleurBordure?> 2px solid}
|
||||||
|
#rhTable tbody tr {border-right: <?=$couleurBordure?> 2px solid}
|
||||||
|
#rhTable tbody th {width: 12.5%; border: <?=$couleurBordure?> 2px solid}
|
||||||
|
#rhTable tbody td {width: 6.25%; border-left: <?=$couleurBordure?> 1px solid;}
|
||||||
|
|
||||||
|
/*** *** *** *** GESTION DES COULEUR POUR LES LIGNES *** *** *** ***/
|
||||||
|
.couleurCongee {color: <?= $couleurCongee ?>;}
|
||||||
|
.couleurCongee div { background-color: <?= $couleurCongee ?>;}
|
||||||
|
.couleurMalade {color: <?= $couleurMalade ?>;}
|
||||||
|
.couleurMalade div { background-color: <?= $couleurMalade ?>;}
|
||||||
|
.couleurRecupe {color: <?= $couleurRecupe ?>;}
|
||||||
|
.couleurRecupe div {background-color: <?= $couleurRecupe?>;}
|
||||||
|
.tailleDiv div {width: 100%; border-radius: 10px; height: 90%; display: inline-block}
|
||||||
|
.puce:hover{text-decoration: none; color: <?= $fondTheadCouleur ?>}
|
||||||
|
</style>
|
||||||
1
img/.htaccess
Normal file
1
img/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all granted
|
||||||
BIN
img/absence.png
Normal file
BIN
img/absence.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
img/object_ACM.png
Normal file
BIN
img/object_ACM.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
42
index.php
Normal file
42
index.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Module\ACM\Classe\Controleur\ControleurGenerique;
|
||||||
|
use Module\ACM\Classe\Controleur\ControleurAbsence;
|
||||||
|
use Module\ACM\Lib\Psr4AutoloaderClass;
|
||||||
|
use Module\ACM\Classe\GestionBD\gestionVariableCongee;
|
||||||
|
require_once __DIR__ . '/lib/Psr4AutoloaderClass.php';
|
||||||
|
use Module\ACM\Classe\Controleur\ControleurAdmin;
|
||||||
|
$chargeurDeClasse = new Psr4AutoloaderClass();
|
||||||
|
$chargeurDeClasse->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("<tr><th><h1>Erreur 404</h1></th></tr> <tr><th><p>page not found</p></th></tr>");
|
||||||
|
}else ControleurAbsence::afficherAbsence();
|
||||||
|
}else ControleurAbsence::afficherAbsence();
|
||||||
1
js/.htaccess
Normal file
1
js/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all granted
|
||||||
27
js/envoiePost.js
Normal file
27
js/envoiePost.js
Normal file
@ -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);
|
||||||
|
}
|
||||||
1
langs/.htaccess
Normal file
1
langs/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
72
langs/fr_FR/ACM.lang
Normal file
72
langs/fr_FR/ACM.lang
Normal file
@ -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
|
||||||
1
lib/.htaccess
Normal file
1
lib/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
74
lib/ACM.lib.php
Normal file
74
lib/ACM.lib.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2025 SuperAdmin
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \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] .= ' <span classe="badge">' . $nbExtrafields . '</span>';
|
||||||
|
}
|
||||||
|
$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;
|
||||||
|
}
|
||||||
213
lib/Psr4AutoloaderClass.php
Normal file
213
lib/Psr4AutoloaderClass.php
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
PSR-4 autoloader example implementations given by
|
||||||
|
https://www.php-fig.org/psr/psr-4/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Module\ACM\Lib;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An example of a general-purpose implementation that includes the optional
|
||||||
|
* functionality of allowing multiple base directories for a single namespace
|
||||||
|
* prefix.
|
||||||
|
*
|
||||||
|
* Given a foo-bar package of classes in the file system at the following
|
||||||
|
* paths ...
|
||||||
|
*
|
||||||
|
* /path/to/packages/foo-bar/
|
||||||
|
* src/
|
||||||
|
* Baz.php # Foo\Bar\Baz
|
||||||
|
* Qux/
|
||||||
|
* Quux.php # Foo\Bar\Qux\Quux
|
||||||
|
* tests/
|
||||||
|
* BazTest.php # Foo\Bar\BazTest
|
||||||
|
* Qux/
|
||||||
|
* QuuxTest.php # Foo\Bar\Qux\QuuxTest
|
||||||
|
*
|
||||||
|
* ... add the path to the classe files for the \Foo\Bar\ namespace prefix
|
||||||
|
* as follows:
|
||||||
|
*
|
||||||
|
* <?php
|
||||||
|
* // instantiate the loader
|
||||||
|
* $loader = new \Example\Psr4AutoloaderClass;
|
||||||
|
*
|
||||||
|
* // register the autoloader
|
||||||
|
* $loader->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:
|
||||||
|
*
|
||||||
|
* <?php
|
||||||
|
* new \Foo\Bar\Qux\Quux;
|
||||||
|
*
|
||||||
|
* The following line would cause the autoloader to attempt to load the
|
||||||
|
* \Foo\Bar\Qux\QuuxTest classe from /path/to/packages/foo-bar/tests/Qux/QuuxTest.php:
|
||||||
|
*
|
||||||
|
* <?php
|
||||||
|
* new \Foo\Bar\Qux\QuuxTest;
|
||||||
|
*/
|
||||||
|
class Psr4AutoloaderClass
|
||||||
|
{
|
||||||
|
|
||||||
|
private bool $debug;
|
||||||
|
|
||||||
|
public function __construct(bool $debug=false)
|
||||||
|
{
|
||||||
|
$this->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("<h3>Chargement automatique de classe $class </h3>");
|
||||||
|
// 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("<h3 style=\"color:red;font-weight: bold;\">Échec !</h3>");
|
||||||
|
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<br>");
|
||||||
|
|
||||||
|
// 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("<p><span style=\"color:green;font-weight: bold;\">Réussite</span> : fichier chargé <pre>$file</pre></p>");
|
||||||
|
require $file;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$this->affichageDebogage("<p><span style=\"color:red;font-weight: bold;\">Échec</span> : fichier introuvable <pre>$file</pre></p>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
5
sql/llx_acm_couleur.sql
Normal file
5
sql/llx_acm_couleur.sql
Normal file
@ -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
|
||||||
|
);
|
||||||
8
sql/llx_acm_feries.sql
Normal file
8
sql/llx_acm_feries.sql
Normal file
@ -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'
|
||||||
|
);
|
||||||
1
view/.htaccess
Normal file
1
view/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
135
view/admin/dateGestion.php
Normal file
135
view/admin/dateGestion.php
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<?php global $langs;
|
||||||
|
$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken'];
|
||||||
|
$langs->loadLangs(array("admin", "ACM@ACM"));
|
||||||
|
/** @var $liste */
|
||||||
|
/** @var $listeCouleur */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script src="<?php echo DOL_URL_ROOT; ?>/custom/ACM/js/envoiePost.js"></script>
|
||||||
|
|
||||||
|
<div class="div-table-responsive">
|
||||||
|
<table class="noborder centpercent">
|
||||||
|
<tbody>
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<th class="wrapcolumntitle liste_titre nowrap center">
|
||||||
|
nom
|
||||||
|
</th>
|
||||||
|
<th class="wrapcolumntitle liste_titre nowrap center">
|
||||||
|
régle
|
||||||
|
</th>
|
||||||
|
<th class="wrapcolumntitle liste_titre nowrap center">
|
||||||
|
jour
|
||||||
|
</th>
|
||||||
|
<th class="wrapcolumntitle liste_titre nowrap center">
|
||||||
|
mois
|
||||||
|
</th>
|
||||||
|
<th class="wrapcolumntitle liste_titre nowrap center">
|
||||||
|
état
|
||||||
|
</th>
|
||||||
|
<th class="wrapcolumntitle liste_titre nowrap center">
|
||||||
|
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php if ($liste != []) {
|
||||||
|
foreach ($liste as $item) { ?>
|
||||||
|
<tr class="oddeven">
|
||||||
|
<td class="tddict nowrap center">
|
||||||
|
<?= $langs->trans($item['nom']) ?>
|
||||||
|
</td>
|
||||||
|
<td class="tddict nowrap center">
|
||||||
|
<?= $item['regle'] ?>
|
||||||
|
</td>
|
||||||
|
<td class="tddict nowrap center">
|
||||||
|
<?= $item['jour'] ?>
|
||||||
|
</td>
|
||||||
|
<td class="tddict nowrap center">
|
||||||
|
<?= $item['mois'] ?>
|
||||||
|
</td>
|
||||||
|
<td class="tddict nowrap center">
|
||||||
|
<?php if ($item['actif'] != "actif") {?>
|
||||||
|
<a href="#" onclick="envoyerPost({action:'putActif', controleur:'admin', nom:'<?=$item['nom']?>'}, 'index.php', '<?=$csrfToken?>')">
|
||||||
|
<span class="fas fa-toggle-off size15x" style=" color: #999;" title="Désactivé"></span>
|
||||||
|
</a>
|
||||||
|
<?php } else {?>
|
||||||
|
<a href="#" onclick="envoyerPost({action:'putInactif', controleur:'admin', nom:'<?=$item['nom']?>'}, 'index.php', '<?=$csrfToken?>')">
|
||||||
|
<span class="fas fa-toggle-on font-status4 size15x" style="" title="Activé"></span>
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
|
<td class="tddict nowrap center">
|
||||||
|
<a href="#" onclick="envoyerPost({action:'supprimer', controleur:'admin', nom:'<?=$item['nom']?>'}, 'index.php', '<?=$csrfToken?>')">
|
||||||
|
<span class="fas fa-trash pictodelete" style="" title="Supprimer"></span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } else {?>
|
||||||
|
<tr class="oddeven">
|
||||||
|
<td class="tddict nowrap center" colspan="6">
|
||||||
|
aucune valeur dans la base de donnée
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="div-table-responsive">
|
||||||
|
<h2> Gestion des couleurs </h2>
|
||||||
|
<form method="post">
|
||||||
|
<input type="hidden" name="controleur" value="admin">
|
||||||
|
<input type="hidden" name="action" value="changerCouleur">
|
||||||
|
<input type="hidden" name="token" value="<?=$csrfToken?>">
|
||||||
|
<table class="noborder centpercent">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMTitreTableau" name="ACMTitreTableau" value="<?=$listeCouleur["ACMTitreTableau"]?>" />
|
||||||
|
<label for="ACMTitreTableau"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMTitreTableau")?></label>
|
||||||
|
</th>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMCorpsTableau" name="ACMCorpsTableau" value="<?=$listeCouleur["ACMCorpsTableau"]?>" />
|
||||||
|
<label for="ACMCorpsTableau"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMCorpsTableau")?></label>
|
||||||
|
</th>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMBordure" name="ACMBordure" value="<?=$listeCouleur["ACMBordure"]?>" />
|
||||||
|
<label for="ACMBordure"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMBordure")?></label>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMFontTitreTableau" name="ACMFontTitreTableau" value="<?=$listeCouleur["ACMFontTitreTableau"]?>" />
|
||||||
|
<label for="ACMFontTitreTableau"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMFontTitreTableau")?></label>
|
||||||
|
</th>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMFontCorpsTableau" name="ACMFontCorpsTableau" value="<?=$listeCouleur["ACMFontCorpsTableau"]?>" />
|
||||||
|
<label for="ACMFontCorpsTableau"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMFontCorpsTableau")?></label>
|
||||||
|
</th>
|
||||||
|
<th class="left">
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr><th class="left"></th><th class="left"></th><th class="left"></th></tr>
|
||||||
|
<tr>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMConge" name="ACMConge" value="<?=$listeCouleur["ACMConge"]?>" />
|
||||||
|
<label for="ACMConge"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMConge")?></label>
|
||||||
|
</th>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMMalade" name="ACMMalade" value="<?=$listeCouleur["ACMMalade"]?>" />
|
||||||
|
<label for="ACMMalade"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMMalade")?></label>
|
||||||
|
</th>
|
||||||
|
<th class="left">
|
||||||
|
<input type="color" id="ACMRecupe" name="ACMRecupe" value="<?=$listeCouleur["ACMRecupe"]?>" />
|
||||||
|
<label for="ACMRecupe"><?=$langs->trans("ACMCouleur")." ".$langs->trans("ACMRecupe")?></label>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="left"></th>
|
||||||
|
<th class="left"></th>
|
||||||
|
<th class="left"><input type="submit" value="<?=$langs->trans("ACMEnvoie")?>" /></th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
80
view/admin/parametrageBase.php
Normal file
80
view/admin/parametrageBase.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
global $langs;
|
||||||
|
$langs->loadLangs(array("admin", "ACM@ACM"));
|
||||||
|
|
||||||
|
$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken'];
|
||||||
|
/** @var $lien */
|
||||||
|
$page_name = "ACMSettings";
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
/* Ajout d'une ligne de séparation en dessous des onglets */
|
||||||
|
.tabBarContainer {
|
||||||
|
border-bottom: 1px solid #ccc; /* Ligne grise sous les onglets */
|
||||||
|
padding-bottom: 12px;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
max-height: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="tabBarContainer">
|
||||||
|
<img class="icon" src="img/object_ACM.png">
|
||||||
|
<a href="#" class="tab tabactive" data-target="settings"><?=$langs->trans("ACMSetup")?></a>
|
||||||
|
<a href="#" class="tab" data-target="about"><?=$langs->trans("ACMAbout")?></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Contenu des onglets -->
|
||||||
|
|
||||||
|
<div id="settings" class="tab-content">
|
||||||
|
<h2><?=$langs->trans("ACMSetupTitre")?></h2>
|
||||||
|
<?php include_once $lien ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="about" class="tab-content" style="display:none;">
|
||||||
|
<h2><?=$langs->trans("ACMAboutTitre")?></h2>
|
||||||
|
<p><?=$langs->trans("ACMAboutIntro")?></p>
|
||||||
|
<p><?=$langs->trans("ACMAboutP1")?></p>
|
||||||
|
<p><?=$langs->trans("ACMAboutP2")?></p>
|
||||||
|
|
||||||
|
<table class="centpercent">
|
||||||
|
<tr>
|
||||||
|
<td class="left col-left" style="width: 30%">
|
||||||
|
<p><a href="https://www.flaticon.com/fr/icones-gratuites/sujet" title="sujet icônes"><img src="img/object_ACM.png" class="pictofixedwidth"> <?=$langs->trans("ACMCreditLogo")?></a></p>
|
||||||
|
</td>
|
||||||
|
<td class="center col-center" style="width: 30%">
|
||||||
|
<p><a href="https://www.flaticon.com/fr/icones-gratuites/absence" title="absence icônes"><img src="img/absence.png" class="pictofixedwidth"> <?=$langs->trans("ACMCreditLogoAbs")?></a></p>
|
||||||
|
</td>
|
||||||
|
<td class="right col-right" style="width: 30%"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Sélection des onglets et des contenus
|
||||||
|
const tabs = document.querySelectorAll('.tab');
|
||||||
|
const contents = document.querySelectorAll('.tab-content');
|
||||||
|
|
||||||
|
tabs.forEach(tab => {
|
||||||
|
tab.addEventListener('click', (e) => {
|
||||||
|
e.preventDefault(); // Empêche le rechargement de la page
|
||||||
|
|
||||||
|
// Retirer la classe tabactive de tous les onglets
|
||||||
|
tabs.forEach(t => t.classList.remove('tabactive'));
|
||||||
|
|
||||||
|
// Masquer tous les contenus
|
||||||
|
contents.forEach(c => c.style.display = 'none');
|
||||||
|
|
||||||
|
// Activer l'onglet cliqué
|
||||||
|
tab.classList.add('tabactive');
|
||||||
|
|
||||||
|
// Afficher le contenu correspondant
|
||||||
|
const target = document.getElementById(tab.getAttribute('data-target'));
|
||||||
|
target.style.display = 'block';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
34
view/admin/suppression.php
Normal file
34
view/admin/suppression.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken'];
|
||||||
|
/** @var $nom */ /** @var $langs */
|
||||||
|
?>
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type='hidden' name='controleur' value='admin'>
|
||||||
|
<input type='hidden' name='action' value='suppression'>
|
||||||
|
<input type='hidden' name='nom' value='<?=$nom?>'>
|
||||||
|
<input type='hidden' name='token' value='<?=$csrfToken?>'>
|
||||||
|
<fieldset>
|
||||||
|
<table class="centpercent">
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<legend> <?=$langs->trans("ACMTexteDeSuppression")." ".$nom?></legend>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="true" name="ouiNon" value="true" />
|
||||||
|
<label for="true"><?=$langs->trans("ACMOui")?></label>
|
||||||
|
</th>
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="" name="ouiNon" value="" checked/>
|
||||||
|
<label for=""><?=$langs->trans("ACMNon")?></label>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<button class="centpercent" type="submit"><?=$langs->trans("ACMEnvoie")?></button>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
9
view/erreur.php
Normal file
9
view/erreur.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
/** @var string $messageErreur **/
|
||||||
|
?>
|
||||||
|
<div class="centpercent div-table-responsive">
|
||||||
|
<table>
|
||||||
|
<?= $messageErreur ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
95
view/planningAbsence/acceuil.php
Normal file
95
view/planningAbsence/acceuil.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Module\ACM\Classe\Classe\gestionAbsence;
|
||||||
|
use Module\ACM\Classe\Classe\gestionDate;
|
||||||
|
use Module\ACM\Classe\Classe\gestionUtilisateurSemaine;
|
||||||
|
include_once "css/StyleTableau.css.php";
|
||||||
|
/** @var $liste */
|
||||||
|
/** @var $listeDateSemaine */
|
||||||
|
/** @var array $semaine */
|
||||||
|
/** @var $titreSemaine */
|
||||||
|
/** @var DateTime $date */
|
||||||
|
/** @var $langs */
|
||||||
|
|
||||||
|
$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken'];
|
||||||
|
$datePrec = new DateTime($semaine[0]->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");
|
||||||
|
|
||||||
|
?>
|
||||||
|
<script src="<?=DOL_URL_ROOT;?>/custom/ACM/js/envoiePost.js"></script>
|
||||||
|
<h2>
|
||||||
|
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$datePrecMois?>'}, 'index.php', '<?=$csrfToken?>')">≪</a>
|
||||||
|
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$datePrec?>'}, 'index.php', '<?=$csrfToken?>')">◄</a>
|
||||||
|
<?=$titreSemaine?>
|
||||||
|
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$dateSuv?>'}, 'index.php', '<?=$csrfToken?>')">►</a>
|
||||||
|
<a class="puce" href="#" onclick="envoyerPost({action:'afficherAbsence', controleur:'absence', date:'<?=$dateSuvMois?>'}, 'index.php', '<?=$csrfToken?>')">≫</a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<table id="rhTable" class="centpercent">
|
||||||
|
<thead >
|
||||||
|
<tr>
|
||||||
|
<th rowspan="2">
|
||||||
|
<?=$langs->trans("ACMLogin")?>
|
||||||
|
</th>
|
||||||
|
<?php foreach ($semaine as $jour) { ?>
|
||||||
|
<th colspan="2">
|
||||||
|
<?= $jour->format("d/m/Y") ?>
|
||||||
|
</th>
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($semaine as $jour) {?>
|
||||||
|
<td>
|
||||||
|
<?=$langs->trans("ACMAm")?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?=$langs->trans("ACMPm")?>
|
||||||
|
</td >
|
||||||
|
<?php } ?>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($liste as $user) {
|
||||||
|
$pasVide = $listeDateSemaine[$user["login"]]["Congé"] != "" || $listeDateSemaine[$user["login"]]["Malade"] != ""
|
||||||
|
|| $listeDateSemaine[$user["login"]]["Recupe"] != "";
|
||||||
|
if ($pasVide){
|
||||||
|
$rowspan = 1;
|
||||||
|
$listeFonctionnel = [];
|
||||||
|
if ($listeDateSemaine[$user["login"]]["Congé"] != ""){$rowspan++;$listeFonctionnel[] = $listeDateSemaine[$user["login"]]["Congé"];}
|
||||||
|
if ($listeDateSemaine[$user["login"]]["Malade"] != ""){$rowspan++;$listeFonctionnel[] = $listeDateSemaine[$user["login"]]["Malade"];}
|
||||||
|
if ($listeDateSemaine[$user["login"]]["Recupe"] != ""){$rowspan++;$listeFonctionnel[] = $listeDateSemaine[$user["login"]]["Recupe"];}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$rowspan = 2;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<tr class="ligne_semaine">
|
||||||
|
<th rowspan="<?=$rowspan?>"><?=$user["login"]?></th>
|
||||||
|
</tr>
|
||||||
|
<?php if ($pasVide) {
|
||||||
|
$x=1;
|
||||||
|
$class = "";
|
||||||
|
foreach ($listeFonctionnel as $affichage) {
|
||||||
|
$x++;
|
||||||
|
if ($x == $rowspan) $class = "class=\"ligne_semaine\"";
|
||||||
|
echo "<tr $class> $affichage</tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php } else {
|
||||||
|
echo "<tr class=\"ligne_semaine\">";
|
||||||
|
foreach ($semaine as $jour) {?>
|
||||||
|
<td></td><td></td>
|
||||||
|
<?php } echo "</tr>";
|
||||||
|
}?>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<table id="lexique" class="centpercent">
|
||||||
|
<tr>
|
||||||
|
<th><font class="couleurCongee">■</font> <?=$langs->trans("ACMConge")?></th>
|
||||||
|
<th><font class="couleurMalade">■</font> <?=$langs->trans("ACMMalade")?></th>
|
||||||
|
<th><font class="couleurRecupe">■</font> <?=$langs->trans("ACMRecupe")?></th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
24
view/vueGenerale.php
Normal file
24
view/vueGenerale.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
/** @var string $titrePage */
|
||||||
|
/** @var string $cheminCorpsVue */
|
||||||
|
/** @var string $message */
|
||||||
|
/** @var $popup */
|
||||||
|
/** @var string $titre */
|
||||||
|
if (!isset($titre) || $titre == "") {$titre = $titrePage;}
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
llxHeader("", $titrePage, '', '', 0, 0, '', '', '', 'mod-acm page-index');
|
||||||
|
|
||||||
|
print load_fiche_titre($titre, '', 'acm.png@acm');
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
|
if ($message != "") print "<p>$message</p>";
|
||||||
|
else if ($popup != "") print '<script type="text/javascript">window.alert("' . $popup . '");</script>';
|
||||||
|
if (isset($cheminCorpsVue))require __DIR__ . "/{$cheminCorpsVue}";
|
||||||
|
|
||||||
|
print "</div>";
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
?>
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user