public function quizAction($params) { if(isset($params['start']) && $params['start'] == 'quiz'){ $this->createParticipant(); } if(!parent::checkToken($_SESSION['quiz'])) parent::redirect('', 'session_expire'); $displayContent = true; if(!empty($params['choice']) && parent::isAjax()){//data posted if(!$this->processStep($params, $_SESSION['quiz'])) parent::redirect('', 'session_expire'); //Increment page $_SESSION['quiz']['page'] += 1; //If end => check if there is need for extra question if($_SESSION['quiz']['page'] > 10){ $displayContent = false; if($this->goToExtraQuestion($_SESSION['quiz'])){ //Allow going to extra page $_SESSION['quiz']['extraPage'] = true; $link = 'extra'; }else{ //Allow going to form page $_SESSION['quiz']['formPage'] = true; $link = 'form'; } parent::set('link', $link); } } //Get question $question = $this->db->getQuestion($_SESSION['quiz']); parent::set('displayContent', $displayContent); parent::set('question', $question); parent::set('answers', $this->db->getAnswers($question['id'])); parent::set('page', $_SESSION['quiz']['page']); parent::set('token', $_SESSION['quiz']['token']); }
require "includes/common/forms.php"; $controller = new Controller(); if ($_REQUEST['mod'] == 'index.php') { $controller->redirect(APP_ROOT . "/dashboard"); } if ($_REQUEST['mod'] != 'login' && (!isset($_SESSION['user']) || empty($_SESSION['user']['admin_id']))) { $controller->redirect(APP_ROOT . "/login"); } $controller->module = isset($_REQUEST['mod']) && $_REQUEST['mod'] != "" && $_REQUEST['mod'] != "index.php" ? $_REQUEST['mod'] : "dashboard"; $controller->parseFile(); $action = $controller->getAction(); $breadcrumb = $controller->getBreadcrumb(); if ($action) { include $action; $page = $controller->getPage(); if ($page) { if (!is_object($view)) { $view = new View(); } $view->page = $page; if (!$controller->isAjax()) { header("Content-type: text/html; charset=UTF-8"); $template = $controller->getTemplate(); include $template; } else { include $view->page; } } exit; } $controller->redirect("notFound");