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


PHP quiz_access_manager::describe_rules方法代码示例

本文整理汇总了PHP中quiz_access_manager::describe_rules方法的典型用法代码示例。如果您正苦于以下问题:PHP quiz_access_manager::describe_rules方法的具体用法?PHP quiz_access_manager::describe_rules怎么用?PHP quiz_access_manager::describe_rules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在quiz_access_manager的用法示例。


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

示例1: get_quiz_access_information

 /**
  * Return access information for a given quiz.
  *
  * @param int $quizid quiz instance id
  * @return array of warnings and the access information
  * @since Moodle 3.1
  * @throws  moodle_quiz_exception
  */
 public static function get_quiz_access_information($quizid)
 {
     global $DB, $USER;
     $warnings = array();
     $params = array('quizid' => $quizid);
     $params = self::validate_parameters(self::get_quiz_access_information_parameters(), $params);
     list($quiz, $course, $cm, $context) = self::validate_quiz($params['quizid']);
     $result = array();
     // Capabilities first.
     $result['canattempt'] = has_capability('mod/quiz:attempt', $context);
     $result['canmanage'] = has_capability('mod/quiz:manage', $context);
     $result['canpreview'] = has_capability('mod/quiz:preview', $context);
     $result['canreviewmyattempts'] = has_capability('mod/quiz:reviewmyattempts', $context);
     $result['canviewreports'] = has_capability('mod/quiz:viewreports', $context);
     // Access manager now.
     $quizobj = quiz::create($cm->instance, $USER->id);
     $ignoretimelimits = has_capability('mod/quiz:ignoretimelimits', $context, null, false);
     $timenow = time();
     $accessmanager = new quiz_access_manager($quizobj, $timenow, $ignoretimelimits);
     $result['accessrules'] = $accessmanager->describe_rules();
     $result['activerulenames'] = $accessmanager->get_active_rule_names();
     $result['preventaccessreasons'] = $accessmanager->prevent_access();
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:33,代码来源:external.php

示例2: navmenu

if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
    $buttons .= '<td><form ' . $CFG->frametarget . ' method="get" action="view.php"><div>' . '<input type="hidden" name="id" value="' . $cm->id . '" />' . '<input type="hidden" name="edit" value="' . ($PAGE->user_is_editing() ? 'off' : 'on') . '" />' . '<input type="submit" value="' . get_string($PAGE->user_is_editing() ? 'blockseditoff' : 'blocksediton') . '" /></div></form></td>';
}
$buttons .= '</tr></table>';
$navigation = build_navigation(array(), $cm);
print_header($title, $course->fullname, $navigation, '', '', true, $buttons, navmenu($course, $cm), false, $bodytags);
/// Print heading and tabs (if there is more than one).
$currenttab = 'info';
include 'tabs.php';
/// Print quiz name and description
echo $OUTPUT->heading(format_string($quiz->name));
if (trim(strip_tags($quiz->intro))) {
    echo $OUTPUT->box(format_module_intro('quiz', $quiz, $cm->id), 'generalbox', 'intro');
}
/// Display information about this quiz.
$messages = $accessmanager->describe_rules();
if ($quiz->attempts != 1) {
    $messages[] = get_string('gradingmethod', 'quiz', quiz_get_grading_option_name($quiz->grademethod));
}
echo $OUTPUT->box_start('quizinfo');
$accessmanager->print_messages($messages);
echo $OUTPUT->box_end();
/// Show number of attempts summary to those who can view reports.
if (has_capability('mod/quiz:viewreports', $context)) {
    if ($strattemptnum = quiz_num_attempt_summary($quiz, $cm)) {
        echo '<div class="quizattemptcounts"><a href="report.php?mode=overview&amp;id=' . $cm->id . '">' . $strattemptnum . "</a></div>\n";
    }
}
/// Guests can't do a quiz, so offer them a choice of logging in or going back.
if (isguestuser()) {
    echo $OUTPUT->confirm('<p>' . get_string('guestsno', 'quiz') . "</p>\n\n<p>" . get_string('liketologin') . "</p>\n", get_login_url(), get_referer(false));
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:view.php


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