Example #1
0
$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";
            }
            if ($listReport[$i][$key] == "#555") {
                $listReport[$i][$key] = "Good";
            }
        }
Example #2
0
     # 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);
             }
         }
     }
     $_SESSION['page'] = "Guard tours";
     break;
 case 'tours':
     # code...
     $list = $model->_list("tours", "*");
     $_SESSION['page'] = "Tours";
     break;
 case 'users':
     # code...
Example #3
0
         } else {
             $message = $form->register("guard", $_POST);
         }
     }
     include "../vue/register_guard.php";
     break;
 case 'Guard tours':
     # code...
     $dataUpdate = $update && $data['page'] == 'Guard tours' ? $data : "";
     if (isset($_POST['register'])) {
         $limit = $_POST['intervale_limit'] < 10 ? "0" . $_POST['intervale_limit'] : $_POST['intervale_limit'];
         $limit = "00:" . $limit . ":00";
         $uid = explode("|", $_POST['guard_id']);
         $adress = explode("|", $_POST['poste_id']);
         $_POST['intervale_limit'] = $limit;
         $_POST['guard_id'] = $model->getBy('guard', 'id', 'uid', $uid[0]);
         $_POST['poste_id'] = $model->getBy('poste', 'id', 'adress', $adress[0]);
         if ($update && $data['page'] == 'Guard tours') {
             $message = $form->update("guardtours", $_POST, $dataUpdate['id']);
             if ($message === 1) {
                 header("Location: post.php?page=guardTours");
             }
         } else {
             $message = $form->register("guardtours", $_POST);
         }
     }
     $guardId = GuardToursForm::listDataFK()['guard_id'];
     $postId = GuardToursForm::listDataFK()['poste_id'];
     include "../vue/register_guardTours.php";
     break;
     // case 'Tours':