本文整理汇总了PHP中quiz_get_flag_option函数的典型用法代码示例。如果您正苦于以下问题:PHP quiz_get_flag_option函数的具体用法?PHP quiz_get_flag_option怎么用?PHP quiz_get_flag_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quiz_get_flag_option函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_display_options
/**
* Wrapper that the correct mod_quiz_display_options for this quiz at the
* moment.
*
* @return question_display_options the render options for this user on this attempt.
*/
public function get_display_options($reviewing)
{
if ($reviewing) {
if (is_null($this->reviewoptions)) {
$this->reviewoptions = quiz_get_review_options($this->get_quiz(), $this->attempt, $this->quizobj->get_context());
if ($this->is_own_preview()) {
// It should always be possible for a teacher to review their
// own preview irrespective of the review options settings.
$this->reviewoptions->attempt = true;
}
}
return $this->reviewoptions;
} else {
$options = mod_quiz_display_options::make_from_quiz($this->get_quiz(), mod_quiz_display_options::DURING);
$options->flags = quiz_get_flag_option($this->attempt, $this->quizobj->get_context());
return $options;
}
}
示例2: quiz_get_review_options
/**
* The the appropraite mod_quiz_display_options object for this attempt at this
* quiz right now.
*
* @param object $quiz the quiz instance.
* @param object $attempt the attempt in question.
* @param $context the quiz context.
*
* @return mod_quiz_display_options
*/
function quiz_get_review_options($quiz, $attempt, $context) {
$options = mod_quiz_display_options::make_from_quiz($quiz, quiz_attempt_state($quiz, $attempt));
$options->readonly = true;
$options->flags = quiz_get_flag_option($attempt, $context);
if (!empty($attempt->id)) {
$options->questionreviewlink = new moodle_url('/mod/quiz/reviewquestion.php',
array('attempt' => $attempt->id));
}
// Show a link to the comment box only for closed attempts.
if (!empty($attempt->id) && $attempt->state == quiz_attempt::FINISHED && !$attempt->preview &&
!is_null($context) && has_capability('mod/quiz:grade', $context)) {
$options->manualcomment = question_display_options::VISIBLE;
$options->manualcommentlink = new moodle_url('/mod/quiz/comment.php',
array('attempt' => $attempt->id));
}
if (!is_null($context) && !$attempt->preview &&
has_capability('mod/quiz:viewreports', $context) &&
has_capability('moodle/grade:viewhidden', $context)) {
// People who can see reports and hidden grades should be shown everything,
// except during preview when teachers want to see what students see.
$options->attempt = question_display_options::VISIBLE;
$options->correctness = question_display_options::VISIBLE;
$options->marks = question_display_options::MARK_AND_MAX;
$options->feedback = question_display_options::VISIBLE;
$options->numpartscorrect = question_display_options::VISIBLE;
$options->generalfeedback = question_display_options::VISIBLE;
$options->rightanswer = question_display_options::VISIBLE;
$options->overallfeedback = question_display_options::VISIBLE;
$options->history = question_display_options::VISIBLE;
}
return $options;
}
示例3: get_display_options
/**
* Wrapper that the correct mod_quiz_display_options for this quiz at the
* moment.
*
* @return question_display_options the render options for this user on this attempt.
*/
public function get_display_options($reviewing)
{
if ($reviewing) {
if (is_null($this->reviewoptions)) {
$this->reviewoptions = quiz_get_review_options($this->get_quiz(), $this->attempt, $this->quizobj->get_context());
}
return $this->reviewoptions;
} else {
$options = mod_quiz_display_options::make_from_quiz($this->get_quiz(), mod_quiz_display_options::DURING);
$options->flags = quiz_get_flag_option($this->attempt, $this->quizobj->get_context());
return $options;
}
}
示例4: quiz_get_reviewoptions
/**
* Determine review options
*
* @param object $quiz the quiz instance.
* @param object $attempt the attempt in question.
* @param $context the quiz module context.
*
* @return object an object with boolean fields responses, scores, feedback,
* correct_responses, solutions and general feedback
*/
function quiz_get_reviewoptions($quiz, $attempt, $context)
{
global $USER;
$options = new stdClass();
$options->readonly = true;
$options->flags = quiz_get_flag_option($attempt, $context);
// Provide the links to the question review and comment script
if (!empty($attempt->id)) {
$options->questionreviewlink = '/mod/quiz/reviewquestion.php?attempt=' . $attempt->id;
}
// Show a link to the comment box only for closed attempts
if ($attempt->timefinish && has_capability('mod/quiz:grade', $context)) {
$options->questioncommentlink = '/mod/quiz/comment.php';
}
// Whether to display a response history.
$canviewreports = has_capability('mod/quiz:viewreports', $context);
$options->history = $canviewreports && !$attempt->preview ? 'all' : 'graded';
if ($canviewreports && has_capability('moodle/grade:viewhidden', $context) && !$attempt->preview) {
// People who can see reports and hidden grades should be shown everything,
// except during preview when teachers want to see what students see.
$options->responses = true;
$options->scores = true;
$options->feedback = true;
$options->correct_responses = true;
$options->solutions = false;
$options->generalfeedback = true;
$options->overallfeedback = true;
$options->quizstate = QUIZ_STATE_TEACHERACCESS;
} else {
// Work out the state of the attempt ...
if (time() - $attempt->timefinish < 120 || $attempt->timefinish == 0) {
$quiz_state_mask = QUIZ_REVIEW_IMMEDIATELY;
$options->quizstate = QUIZ_STATE_IMMEDIATELY;
} else {
if (!$quiz->timeclose or time() < $quiz->timeclose) {
$quiz_state_mask = QUIZ_REVIEW_OPEN;
$options->quizstate = QUIZ_STATE_OPEN;
} else {
$quiz_state_mask = QUIZ_REVIEW_CLOSED;
$options->quizstate = QUIZ_STATE_CLOSED;
}
}
// ... and hence extract the appropriate review options.
$options->responses = $quiz->review & $quiz_state_mask & QUIZ_REVIEW_RESPONSES ? 1 : 0;
$options->scores = $quiz->review & $quiz_state_mask & QUIZ_REVIEW_SCORES ? 1 : 0;
$options->feedback = $quiz->review & $quiz_state_mask & QUIZ_REVIEW_FEEDBACK ? 1 : 0;
$options->correct_responses = $quiz->review & $quiz_state_mask & QUIZ_REVIEW_ANSWERS ? 1 : 0;
$options->solutions = $quiz->review & $quiz_state_mask & QUIZ_REVIEW_SOLUTIONS ? 1 : 0;
$options->generalfeedback = $quiz->review & $quiz_state_mask & QUIZ_REVIEW_GENERALFEEDBACK ? 1 : 0;
$options->overallfeedback = $attempt->timefinish && $quiz->review & $quiz_state_mask & QUIZ_REVIEW_OVERALLFEEDBACK;
}
return $options;
}