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


PHP quiz_attempt::get_course方法代码示例

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


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

示例1: quiz_send_overdue_message

/**
 * Send the notification message when a quiz attempt becomes overdue.
 *
 * @param quiz_attempt $attemptobj all the data about the quiz attempt.
 */
function quiz_send_overdue_message($attemptobj)
{
    global $CFG, $DB;
    $submitter = $DB->get_record('user', array('id' => $attemptobj->get_userid()), '*', MUST_EXIST);
    if (!$attemptobj->has_capability('mod/quiz:emailwarnoverdue', $submitter->id, false)) {
        return;
        // Message not required.
    }
    if (!$attemptobj->has_response_to_at_least_one_graded_question()) {
        return;
        // Message not required.
    }
    // Prepare lots of useful information that admins might want to include in
    // the email message.
    $quizname = format_string($attemptobj->get_quiz_name());
    $deadlines = array();
    if ($attemptobj->get_quiz()->timelimit) {
        $deadlines[] = $attemptobj->get_attempt()->timestart + $attemptobj->get_quiz()->timelimit;
    }
    if ($attemptobj->get_quiz()->timeclose) {
        $deadlines[] = $attemptobj->get_quiz()->timeclose;
    }
    $duedate = min($deadlines);
    $graceend = $duedate + $attemptobj->get_quiz()->graceperiod;
    $a = new stdClass();
    // Course info.
    $a->coursename = format_string($attemptobj->get_course()->fullname);
    $a->courseshortname = format_string($attemptobj->get_course()->shortname);
    // Quiz info.
    $a->quizname = $quizname;
    $a->quizurl = $attemptobj->view_url();
    $a->quizlink = '<a href="' . $a->quizurl . '">' . $quizname . '</a>';
    // Attempt info.
    $a->attemptduedate = userdate($duedate);
    $a->attemptgraceend = userdate($graceend);
    $a->attemptsummaryurl = $attemptobj->summary_url()->out(false);
    $a->attemptsummarylink = '<a href="' . $a->attemptsummaryurl . '">' . $quizname . ' review</a>';
    // Student's info.
    $a->studentidnumber = $submitter->idnumber;
    $a->studentname = fullname($submitter);
    $a->studentusername = $submitter->username;
    // Prepare the message.
    $eventdata = new stdClass();
    $eventdata->component = 'mod_quiz';
    $eventdata->name = 'attempt_overdue';
    $eventdata->notification = 1;
    $eventdata->userfrom = core_user::get_noreply_user();
    $eventdata->userto = $submitter;
    $eventdata->subject = get_string('emailoverduesubject', 'quiz', $a);
    $eventdata->fullmessage = get_string('emailoverduebody', 'quiz', $a);
    $eventdata->fullmessageformat = FORMAT_PLAIN;
    $eventdata->fullmessagehtml = '';
    $eventdata->smallmessage = get_string('emailoverduesmall', 'quiz', $a);
    $eventdata->contexturl = $a->quizurl;
    $eventdata->contexturlname = $a->quizname;
    // Send the message.
    return message_send($eventdata);
}
开发者ID:aleph-n,项目名称:lms.aaenl,代码行数:63,代码来源:locallib.php

示例2:

$accessmanager = $attemptobj->get_access_manager(time());
$messages = $accessmanager->prevent_access();
if (!$attemptobj->is_preview_user() && $messages) {
    print_error('attempterror', 'quiz', $attemptobj->view_url(), $accessmanager->print_messages($messages, true));
}
$accessmanager->do_password_check($attemptobj->is_preview_user());
/// Log this page view.
add_to_log($attemptobj->get_courseid(), 'quiz', 'view summary', 'summary.php?attempt=' . $attemptobj->get_attemptid(), $attemptobj->get_quizid(), $attemptobj->get_cmid());
/// Load the questions and states.
$attemptobj->load_questions();
$attemptobj->load_question_states();
/// Print the page header
require_js('mod/quiz/quiz.js');
$title = get_string('summaryofattempt', 'quiz');
if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) {
    $accessmanager->setup_secure_page($attemptobj->get_course()->shortname . ': ' . format_string($attemptobj->get_quiz_name()), '');
} else {
    print_header_simple(format_string($attemptobj->get_quiz_name()), '', $attemptobj->navigation($title), '', '', true, $attemptobj->update_module_button());
}
/// Print tabs if they should be there.
if ($attemptobj->is_preview_user()) {
    $currenttab = 'preview';
    include 'tabs.php';
}
/// Print heading.
print_heading(format_string($attemptobj->get_quiz_name()));
if ($attemptobj->is_preview_user()) {
    $attemptobj->print_restart_preview_button();
}
print_heading($title);
/// Prepare the summary table header
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:summary.php

示例3: reset

/// Log this review.
add_to_log($attemptobj->get_courseid(), 'quiz', 'review', 'review.php?attempt=' . $attemptobj->get_attemptid(), $attemptobj->get_quizid(), $attemptobj->get_cmid());
/// Work out appropriate title.
if ($attemptobj->is_preview_user() && $attemptobj->is_own_attempt()) {
    $strreviewtitle = get_string('reviewofpreview', 'quiz');
} else {
    $strreviewtitle = get_string('reviewofattempt', 'quiz', $attemptobj->get_attempt_number());
}
/// Arrange for the navigation to be displayed.
$navbc = $attemptobj->get_navigation_panel('quiz_review_nav_panel', $page, $showall);
$firstregion = reset($PAGE->blocks->get_regions());
$PAGE->blocks->add_pretend_block($navbc, $firstregion);
/// Print the page header
$headtags = $attemptobj->get_html_head_contributions($page);
if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) {
    $accessmanager->setup_secure_page($attemptobj->get_course()->shortname . ': ' . format_string($attemptobj->get_quiz_name()), $headtags);
} else {
    print_header_simple(format_string($attemptobj->get_quiz_name()), '', $attemptobj->navigation($strreviewtitle), '', $headtags, true, $attemptobj->update_module_button());
}
echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>';
// for overlib
/// Print tabs if they should be there.
if ($attemptobj->is_preview_user()) {
    if ($attemptobj->is_own_attempt()) {
        $currenttab = 'preview';
    } else {
        $currenttab = 'reports';
        $mode = '';
    }
    include 'tabs.php';
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:review.php


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