public function __construct($sessionid, $includepreviews = true, $onlyfinished = false) { $where = 'rtqa.sessionid = :sessionid'; $params = array('sessionid' => $sessionid); if (!$includepreviews) { $where .= ' AND preview = 0'; } if ($onlyfinished) { $where .= ' AND state == :statefinished'; $params['statefinished'] = \mod_activequiz\activequiz_attempt::FINISHED; } parent::__construct('{activequiz_attempts} rtqa', 'rtqa.questionengid', $where, $params); }
/** * Constructor. * * This takes the same arguments as {@link quiz_get_user_attempts()}. * * @param int $quizid the quiz id. * @param int $userid the userid. * @param string $status 'all', 'finished' or 'unfinished' to control * @param bool $includepreviews defaults to false. */ public function __construct($quizid, $userid, $status = 'finished', $includepreviews = false) { $where = 'quiza.quiz = :quizaquiz AND quiza.userid = :userid'; $params = array('quizaquiz' => $quizid, 'userid' => $userid); if (!$includepreviews) { $where .= ' AND preview = 0'; } switch ($status) { case 'all': break; case 'finished': $where .= ' AND state IN (:state1, :state2)'; $params['state1'] = \quiz_attempt::FINISHED; $params['state2'] = \quiz_attempt::ABANDONED; break; case 'unfinished': $where .= ' AND state IN (:state1, :state2)'; $params['state1'] = \quiz_attempt::IN_PROGRESS; $params['state2'] = \quiz_attempt::OVERDUE; break; } parent::__construct('{quiz_attempts} quiza', 'quiza.uniqueid', $where, $params); }
public function __construct($quizid, $includepreviews = true, $onlyfinished = false) { $where = 'quiza.quiz = :quizaquiz'; $params = array('quizaquiz' => $quizid); if (!$includepreviews) { $where .= ' AND preview = 0'; } if ($onlyfinished) { $where .= ' AND state == :statefinished'; $params['statefinished'] = quiz_attempt::FINISHED; } parent::__construct('{quiz_attempts} quiza', 'quiza.uniqueid', $where, $params); }
public function __construct($quizid, $includepreviews = true, $onlyfinished = false) { $where = 'quiza.quiz = :quizaquiz'; if (!$includepreviews) { $where .= ' AND preview = 0'; } if ($onlyfinished) { $where .= ' AND timefinish <> 0'; } parent::__construct('{quiz_attempts} quiza', 'quiza.uniqueid', $where, array('quizaquiz' => $quizid)); }
public function __construct($offlinequizid, $offlinegroupid, $includepreviews = true, $onlyfinished = false) { $where = 'quiza.offlinequizid = :offlinequizid AND quiza.offlinegroupid = :offlinegroupid'; if (!$includepreviews) { $where .= ' AND preview = 0'; } if ($onlyfinished) { $where .= ' AND timefinish <> 0'; } parent::__construct('{offlinequiz_results} quiza', 'quiza.usageid', $where, array('offlinequizid' => $offlinequizid, 'offlinegroupid' => $offlinegroupid)); }