本文整理汇总了PHP中quiz_attempt::get_quizobj方法的典型用法代码示例。如果您正苦于以下问题:PHP quiz_attempt::get_quizobj方法的具体用法?PHP quiz_attempt::get_quizobj怎么用?PHP quiz_attempt::get_quizobj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quiz_attempt
的用法示例。
在下文中一共展示了quiz_attempt::get_quizobj方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_attempt_questions_data
/**
* Return questions information for a given attempt.
*
* @param quiz_attempt $attemptobj the quiz attempt object
* @param bool $review whether if we are in review mode or not
* @param mixed $page string 'all' or integer page number
* @return array array of questions including data
*/
private static function get_attempt_questions_data(quiz_attempt $attemptobj, $review, $page = 'all')
{
global $PAGE;
$questions = array();
$contextid = $attemptobj->get_quizobj()->get_context()->id;
$displayoptions = $attemptobj->get_display_options($review);
$renderer = $PAGE->get_renderer('mod_quiz');
foreach ($attemptobj->get_slots($page) as $slot) {
$question = array('slot' => $slot, 'type' => $attemptobj->get_question_type_name($slot), 'page' => $attemptobj->get_question_page($slot), 'flagged' => $attemptobj->is_question_flagged($slot), 'html' => $attemptobj->render_question($slot, $review, $renderer) . $PAGE->requires->get_end_code());
if ($attemptobj->is_real_question($slot)) {
$question['number'] = $attemptobj->get_question_number($slot);
$question['state'] = (string) $attemptobj->get_question_state($slot);
$question['status'] = $attemptobj->get_question_status($slot, $displayoptions->correctness);
}
if ($displayoptions->marks >= question_display_options::MAX_ONLY) {
$question['maxmark'] = $attemptobj->get_question_attempt($slot)->get_max_mark();
}
if ($displayoptions->marks >= question_display_options::MARK_AND_MAX) {
$question['mark'] = $attemptobj->get_question_mark($slot);
}
$questions[] = $question;
}
return $questions;
}
示例2: review_question_not_allowed
/**
* Renders the review question pop-up.
*
* @param quiz_attempt $attemptobj an instance of quiz_attempt.
* @param string $message Why the review is not allowed.
* @return string html to output.
*/
public function review_question_not_allowed(quiz_attempt $attemptobj, $message)
{
$output = '';
$output .= $this->header();
$output .= $this->heading(format_string($attemptobj->get_quiz_name(), true, array("context" => $attemptobj->get_quizobj()->get_context())));
$output .= $this->notification($message);
$output .= $this->close_window_button();
$output .= $this->footer();
return $output;
}