本文整理汇总了PHP中quiz::get_cm方法的典型用法代码示例。如果您正苦于以下问题:PHP quiz::get_cm方法的具体用法?PHP quiz::get_cm怎么用?PHP quiz::get_cm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quiz
的用法示例。
在下文中一共展示了quiz::get_cm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quiz
$id = required_param('cmid', PARAM_INT);
// Course Module ID
$forcenew = optional_param('forcenew', false, PARAM_BOOL);
// Used to force a new preview
if (!($cm = get_coursemodule_from_id('quiz', $id))) {
print_error('invalidcoursemodule');
}
if (!($course = $DB->get_record('course', array('id' => $cm->course)))) {
print_error("coursemisconf");
}
if (!($quiz = $DB->get_record('quiz', array('id' => $cm->instance)))) {
print_error('invalidcoursemodule');
}
$quizobj = new quiz($quiz, $cm, $course);
/// Check login and sesskey.
require_login($quizobj->get_courseid(), false, $quizobj->get_cm());
if (!confirm_sesskey()) {
throw new moodle_exception('confirmsesskeybad', 'error', $quizobj->view_url());
}
/// if no questions have been set up yet redirect to edit.php
if (!$quizobj->get_question_ids() && $quizobj->has_capability('mod/quiz:manage')) {
redirect($quizobj->edit_url());
}
/// Create an object to manage all the other (non-roles) access rules.
$accessmanager = $quizobj->get_access_manager(time());
if ($quizobj->is_preview_user() && $forcenew) {
$accessmanager->clear_password_access();
}
/// Check capabilites.
if (!$quizobj->is_preview_user()) {
$quizobj->require_capability('mod/quiz:attempt');
示例2: start_attempt_page
public function start_attempt_page(quiz $quizobj, mod_quiz_preflight_check_form $mform) {
$output = '';
$output .= $this->header();
$output .= $this->quiz_intro($quizobj->get_quiz(), $quizobj->get_cm());
ob_start();
$mform->display();
$output .= ob_get_clean();
$output .= $this->footer();
return $output;
}
示例3: start_attempt_page
public function start_attempt_page(quiz $quizobj, mod_quiz_preflight_check_form $mform)
{
$output = '';
$output .= $this->header();
$output .= $this->heading(format_string($quizobj->get_quiz_name(), true, array("context" => $quizobj->get_context())));
$output .= $this->quiz_intro($quizobj->get_quiz(), $quizobj->get_cm());
ob_start();
$mform->display();
$output .= ob_get_clean();
$output .= $this->footer();
return $output;
}