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; }
public function getList() { $list = $this->isEtu() ? $this->adapter->getAllQCMEtu($this->id) : $this->adapter->getAllQCMEns($this->id); return empty($list) ? array() : QCM::loadFromDB($list, true); }
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)); }