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


PHP quiz_attempt::links_to_other_attempts方法代码示例

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


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

示例1: array

/// Print infobox
$rows = array();
/// User picture and name.
if ($attemptobj->get_userid() != $USER->id) {
    // Print user picture and name
    $student = $DB->get_record('user', array('id' => $attemptobj->get_userid()));
    $picture = print_user_picture($student, $attemptobj->get_courseid(), $student->picture, false, true);
    $rows[] = '<tr><th scope="row" class="cell">' . $picture . '</th><td class="cell"><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $student->id . '&amp;course=' . $attemptobj->get_courseid() . '">' . fullname($student, true) . '</a></td></tr>';
}
/// Quiz name.
$rows[] = '<tr><th scope="row" class="cell">' . get_string('modulename', 'quiz') . '</th><td class="cell">' . format_string($attemptobj->get_quiz_name()) . '</td></tr>';
/// Question name.
$rows[] = '<tr><th scope="row" class="cell">' . get_string('question', 'quiz') . '</th><td class="cell">' . format_string($attemptobj->get_question($questionid)->name) . '</td></tr>';
/// Other attempts at the quiz.
if ($attemptobj->has_capability('mod/quiz:viewreports')) {
    $attemptlist = $attemptobj->links_to_other_attempts($baseurl);
    if ($attemptlist) {
        $rows[] = '<tr><th scope="row" class="cell">' . get_string('attempts', 'quiz') . '</th><td class="cell">' . $attemptlist . '</td></tr>';
    }
}
/// Timestamp of this action.
$timestamp = $attemptobj->get_question_state($questionid)->timestamp;
if ($timestamp) {
    $rows[] = '<tr><th scope="row" class="cell">' . get_string('completedon', 'quiz') . '</th><td class="cell">' . userdate($timestamp) . '</td></tr>';
}
/// Now output the summary table, if there are any rows to be shown.
if (!empty($rows)) {
    echo '<table class="generaltable generalbox quizreviewsummary"><tbody>', "\n";
    echo implode("\n", $rows);
    echo "\n</tbody></table>\n";
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:reviewquestion.php

示例2: array

    }
} else {
    $timetaken = get_string('unfinished', 'quiz');
}
/// Print summary table about the whole attempt.
/// First we assemble all the rows that are appopriate to the current situation in
/// an array, then later we only output the table if there are any rows to show.
$rows = array();
if (!$attemptobj->get_quiz()->showuserpicture && $attemptobj->get_userid() != $USER->id) {
    /// If showuserpicture is true, the picture is shown elsewhere, so don't repeat it.
    $student = $DB->get_record('user', array('id' => $attemptobj->get_userid()));
    $picture = $OUTPUT->user_picture(moodle_user_picture::make($student, $attemptobj->get_courseid()));
    $rows[] = '<tr><th scope="row" class="cell">' . $picture . '</th><td class="cell"><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $student->id . '&amp;course=' . $attemptobj->get_courseid() . '">' . fullname($student, true) . '</a></td></tr>';
}
if ($attemptobj->has_capability('mod/quiz:viewreports')) {
    $attemptlist = $attemptobj->links_to_other_attempts($attemptobj->review_url(0, $page, $showall));
    if ($attemptlist) {
        $rows[] = '<tr><th scope="row" class="cell">' . get_string('attempts', 'quiz') . '</th><td class="cell">' . $attemptlist . '</td></tr>';
    }
}
/// Timing information.
$rows[] = '<tr><th scope="row" class="cell">' . get_string('startedon', 'quiz') . '</th><td class="cell">' . userdate($attempt->timestart) . '</td></tr>';
if ($attempt->timefinish) {
    $rows[] = '<tr><th scope="row" class="cell">' . get_string('completedon', 'quiz') . '</th><td class="cell">' . userdate($attempt->timefinish) . '</td></tr>';
    $rows[] = '<tr><th scope="row" class="cell">' . get_string('timetaken', 'quiz') . '</th><td class="cell">' . $timetaken . '</td></tr>';
}
if (!empty($overtime)) {
    $rows[] = '<tr><th scope="row" class="cell">' . get_string('overdue', 'quiz') . '</th><td class="cell">' . $overtime . '</td></tr>';
}
/// Show scores (if the user is allowed to see scores at the moment).
$grade = quiz_rescale_grade($attempt->sumgrades, $quiz);
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:review.php


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