当前位置: 首页>>代码示例>>PHP>>正文


PHP quiz_get_combined_reviewoptions函数代码示例

本文整理汇总了PHP中quiz_get_combined_reviewoptions函数的典型用法代码示例。如果您正苦于以下问题:PHP quiz_get_combined_reviewoptions函数的具体用法?PHP quiz_get_combined_reviewoptions怎么用?PHP quiz_get_combined_reviewoptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了quiz_get_combined_reviewoptions函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mod_quiz_view_object

$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$output = $PAGE->get_renderer('mod_quiz');

/*
 * Create view object for use within renderers file
 */
$viewobj = new mod_quiz_view_object();
$viewobj->attempts = $attempts;
$viewobj->accessmanager = $accessmanager;
$viewobj->canreviewmine = $canreviewmine;

// Print table with existing attempts
if ($attempts) {
    // Work out which columns we need, taking account what data is available in each attempt.
    list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts, $context);

    $viewobj->attemptcolumn = $quiz->attempts != 1;

    $viewobj->gradecolumn = $someoptions->marks >= question_display_options::MARK_AND_MAX &&
            quiz_has_grades($quiz);
    $viewobj->markcolumn = $viewobj->gradecolumn && ($quiz->grade != $quiz->sumgrades);
    $viewobj->overallstats = $lastfinishedattempt && $alloptions->marks >= question_display_options::MARK_AND_MAX;

    $viewobj->feedbackcolumn = quiz_has_feedback($quiz) && $alloptions->overallfeedback;
} else {
    $viewobj->attemptcolumn = 1;
}

$viewobj->timenow = $timenow;
$viewobj->numattempts = $numattempts;
开发者ID:numbas,项目名称:moodle,代码行数:31,代码来源:view.php

示例2: get_combined_review_options

 /**
  * Combines the review options from a number of different quiz attempts.
  *
  * @param int $quizid quiz instance id
  * @param int $userid user id (empty for current user)
  * @return array of warnings and the review options
  * @since Moodle 3.1
  */
 public static function get_combined_review_options($quizid, $userid = 0)
 {
     global $DB, $USER;
     $warnings = array();
     $params = array('quizid' => $quizid, 'userid' => $userid);
     $params = self::validate_parameters(self::get_combined_review_options_parameters(), $params);
     list($quiz, $course, $cm, $context) = self::validate_quiz($params['quizid']);
     // Default value for userid.
     if (empty($params['userid'])) {
         $params['userid'] = $USER->id;
     }
     $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
     core_user::require_active_user($user);
     // Extra checks so only users with permissions can view other users attempts.
     if ($USER->id != $user->id) {
         require_capability('mod/quiz:viewreports', $context);
     }
     $attempts = quiz_get_user_attempts($quiz->id, $user->id, 'all', true);
     $result = array();
     $result['someoptions'] = [];
     $result['alloptions'] = [];
     list($someoptions, $alloptions) = quiz_get_combined_reviewoptions($quiz, $attempts);
     foreach (array('someoptions', 'alloptions') as $typeofoption) {
         foreach (${$typeofoption} as $key => $value) {
             $result[$typeofoption][] = array("name" => $key, "value" => !empty($value) ? $value : 0);
         }
     }
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:38,代码来源:external.php


注:本文中的quiz_get_combined_reviewoptions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。