Beispiel #1
0
 public function saveReponse(QCM $qcm, $user_id)
 {
     try {
         $req = $this->pdo->prepare('INSERT INTO mp_user_qcm (user_id, qcm_id, reponse) VALUE (:user_id, :qcm_id, :reponse);');
         $req->bindParam(':qcm_id', $qcm->getId());
         $req->bindParam(':user_id', $user_id, PDO::PARAM_INT);
         $req->execute();
         $qcm_id = $this->pdo->lastInsertId();
     } catch (PDOException $ex) {
         echo $ex->getMessage();
     }
     return $qcm_id;
 }
Beispiel #2
0
 public function getList()
 {
     $list = $this->isEtu() ? $this->adapter->getAllQCMEtu($this->id) : $this->adapter->getAllQCMEns($this->id);
     return empty($list) ? array() : QCM::loadFromDB($list, true);
 }
Beispiel #3
0
 public static function post($id)
 {
     //        if(!$_SESSION['user']->isAllowed($id)) return new View('/errors/404.php');
     $qcm = QCM::getById($id);
     return new View(is_null($qcm) ? '/errors/404.php' : '/qcm/qcm.php', array('qcm' => $qcm));
 }