示例#1
0
 public function update($table, $value, $id)
 {
     $message = $this->validationForm($table, $value);
     if ($message['error'] === 1) {
         $message['error'] = '<span class="alert alert-danger">Something is wrong!</span>';
         return $message;
     }
     $listkey = Constants::getListKey()[$table];
     if (!empty($this->listToAdd($listkey, $value))) {
         $listToAdd = $this->listToAdd($listkey, $value);
     } else {
         return '<span class="alert alert-danger">Something is wrong</span>';
     }
     if ($this->model->update($table, $listToAdd, "id=" . $id)) {
         if (isset($_SESSION['data'])) {
             unset($_SESSION['data']);
         }
         return 1;
     }
 }
示例#2
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";