當前位置: 首頁>>代碼示例>>PHP>>正文


PHP quiz_get_flag_option函數代碼示例

本文整理匯總了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;
     }
 }
開發者ID:elie89,項目名稱:moodle,代碼行數:24,代碼來源:attemptlib.php

示例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;
}
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:47,代碼來源:locallib.php

示例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;
     }
 }
開發者ID:eamador,項目名稱:moodle-course-custom-fields,代碼行數:19,代碼來源:attemptlib.php

示例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;
}
開發者ID:ajv,項目名稱:Offline-Caching,代碼行數:63,代碼來源:locallib.php


注:本文中的quiz_get_flag_option函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。