Example #1
0
<?php

require_once "../model/session.php";
require_once '../model/models.php';
$controllerCalled = 1;
$tours = new Tours();
$model = new Model();
$list = "";
if (isset($_GET["page"])) {
    $page = strip_tags(htmlspecialchars($_GET["page"]));
    switch ($page) {
        case 'post':
            # code...
            $list = $model->_list("poste", "*");
            $_SESSION['page'] = "Post";
            break;
        case 'guard':
            # code...
            $_SESSION['page'] = "Guard";
            $list = $model->_list("guard", "*");
            break;
        case 'guardTours':
            # code...
            $list = $model->_list("guardtours", "*");
            for ($i = 0; $i < sizeof($list); $i++) {
                foreach ($list[$i] as $key => $value) {
                    if ($key == "poste_id") {
                        $list[$i][$key] = $model->getBy("poste", "nom", "id", $value);
                    }
                    if ($key == "guard_id") {
                        $list[$i][$key] = $model->getBy("guard", "nom", "id", $value) . " " . $model->getBy("guard", "prenom", "id", $value);
Example #2
0
<?php

require_once "../model/session.php";
require_once '../model/models.php';
$controllerCalled = 1;
$report = new Model();
$listReport = "";
if (isset($_POST['id'])) {
    $_SESSION["report-list"] = array("id" => '', "key" => '');
    $_SESSION["report-list"]['id'] = json_decode($_POST['id'], true);
    $_SESSION["report-list"]['key'] = json_decode($_POST['key'], true);
}
if (!empty($_SESSION["report-list"]['id']) && !empty($_SESSION["report-list"]['key'])) {
    $listReport = $report->dynamicSelectAll("tours", "id IN(" . implode(',', $_SESSION["report-list"]['id']) . ")", implode(',', $_SESSION["report-list"]['key']));
}
$company = $report->_list("company", "*")[0];
for ($i = 0; $i < sizeof($listReport); $i++) {
    foreach ($listReport[$i] as $key => $value) {
        if ($key == "guardtours_id") {
            $guardtours_id = $listReport[$i][$key];
            $guard_id = $report->getBy("guardtours", "guard_id", "id", $guardtours_id);
            $nom = $report->getBy("guard", "nom", "id", $guard_id);
            $prenom = $report->getBy("guard", "prenom", "id", $guard_id);
            $listReport[$i][$key] = $nom . " " . $prenom;
        }
        if ($key == "mention") {
            if ($listReport[$i][$key] == "#dd5826") {
                $listReport[$i][$key] = "Bad";
            }
            if ($listReport[$i][$key] == "#f0b518") {
                $listReport[$i][$key] = "Warning";
Example #3
0
 public static function listDataFK()
 {
     $model = new Model();
     $stmt = $model->query("SELECT poste_id FROM `guardtours` GROUP BY poste_id HAVING COUNT(poste_id)>1");
     $guardpost = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $guard_ = $model->_list("guardtours", "guard_id");
     $array = array("poste_id" => array(), "guard_id" => array());
     for ($i = 0; $i < sizeof($guardpost); $i++) {
         foreach ($guardpost[$i] as $key => $value) {
             $array[$key][] = $value;
         }
     }
     for ($i = 0; $i < sizeof($guard_); $i++) {
         foreach ($guard_[$i] as $key => $value) {
             $array[$key][] = $value;
         }
     }
     $postAdress = $model->dynamicSelectAll("poste", "id NOT IN(" . implode(',', $array['poste_id']) . ")", "adress, nom");
     $guardId = $model->dynamicSelectAll("guard", "id NOT IN(" . implode(',', $array['guard_id']) . ")", "uid, nom, prenom");
     $array['poste_id'] = $postAdress;
     $array['guard_id'] = $guardId;
     return $array;
 }
Example #4
0
<?php

require_once "../model/session.php";
require_once '../model/models.php';
define('LIMIT', 500);
$controllerCalled = 1;
$_SESSION['page'] = "report";
$report = new Model();
$tours = new Tours();
$list = $report->_list("tours", "*");
$listTours = $tours->_list("tours", "*");
// La liste des titres des colonnes de la table tours.
$toursKeys = Constants::getListKey()['tours'];
//la taille du tableau tours dans la base
$size = sizeof($list);
//On divise le table par 500 pour ne pas afficher tout les donnees.
$div = $size > LIMIT ? $size / LIMIT : 1;
$limit = LIMIT;
for ($i = 0; $i < sizeof($list); $i++) {
    foreach ($list[$i] as $key => $value) {
        if ($key == "guardtours_id") {
            $guardtours_id = $list[$i][$key];
            $guard_id = $report->getBy("guardtours", "guard_id", "id", $guardtours_id);
            $nom = $report->getBy("guard", "nom", "id", $guard_id);
            $prenom = $report->getBy("guard", "prenom", "id", $guard_id);
            $list[$i][$key] = $nom . " " . $prenom;
        }
    }
}
// $mention = $tours->getMention("09:00:00", 1);
include "../vue/report.php";