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


PHP quiz_attempt::get_attempt_number方法代码示例

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


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

示例1: redirect

$attemptobj->load_questions($questionids);
$attemptobj->load_question_states($questionids);
/// Save the flag states, if they are being changed.
if ($options->flags == QUESTION_FLAGSEDITABLE && optional_param('savingflags', false, PARAM_BOOL)) {
    confirm_sesskey();
    $formdata = data_submitted();
    question_save_flags($formdata, $attemptid, $questionids);
    redirect($attemptobj->review_url(0, $page, $showall));
}
/// 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.
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:review.php

示例2: check_attempt_results

 /**
  * Check that attempt results are as specified in $result.
  *
  * @param array        $result             row of data read from csv file.
  * @param quiz_attempt $attemptobj         the attempt object loaded from db.
  * @throws coding_exception
  */
 protected function check_attempt_results($result, $attemptobj)
 {
     foreach ($result as $fieldname => $value) {
         if ($value === '!NULL!') {
             $value = null;
         }
         switch ($fieldname) {
             case 'quizattempt':
                 break;
             case 'attemptnumber':
                 $this->assertEquals($value, $attemptobj->get_attempt_number());
                 break;
             case 'slots':
                 foreach ($value as $slotno => $slottests) {
                     foreach ($slottests as $slotfieldname => $slotvalue) {
                         switch ($slotfieldname) {
                             case 'mark':
                                 $this->assertEquals(round($slotvalue, 2), $attemptobj->get_question_mark($slotno), "Mark for slot {$slotno} of attempt {$result['quizattempt']}.");
                                 break;
                             default:
                                 throw new coding_exception('Unknown slots sub field column in csv file ' . s($slotfieldname));
                         }
                     }
                 }
                 break;
             case 'finished':
                 $this->assertEquals((bool) $value, $attemptobj->is_finished());
                 break;
             case 'summarks':
                 $this->assertEquals($value, $attemptobj->get_sum_marks(), "Sum of marks of attempt {$result['quizattempt']}.");
                 break;
             case 'quizgrade':
                 // Check quiz grades.
                 $grades = quiz_get_user_grades($attemptobj->get_quiz(), $attemptobj->get_userid());
                 $grade = array_shift($grades);
                 $this->assertEquals($value, $grade->rawgrade, "Quiz grade for attempt {$result['quizattempt']}.");
                 break;
             case 'gradebookgrade':
                 // Check grade book.
                 $gradebookgrades = grade_get_grades($attemptobj->get_courseid(), 'mod', 'quiz', $attemptobj->get_quizid(), $attemptobj->get_userid());
                 $gradebookitem = array_shift($gradebookgrades->items);
                 $gradebookgrade = array_shift($gradebookitem->grades);
                 $this->assertEquals($value, $gradebookgrade->grade, "Gradebook grade for attempt {$result['quizattempt']}.");
                 break;
             default:
                 throw new coding_exception('Unknown column in csv file ' . s($fieldname));
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:56,代码来源:attempt_walkthrough_from_csv_test.php

示例3:

/// This action used to be 'continue attempt' but the database field has only 15 characters.
add_to_log($attemptobj->get_courseid(), 'quiz', 'continue attemp', 'review.php?attempt=' . $attemptobj->get_attemptid(), $attemptobj->get_quizid(), $attemptobj->get_cmid());
/// Get the list of questions needed by this page.
$questionids = $attemptobj->get_question_ids($page);
/// Check.
if (empty($questionids)) {
    quiz_error($quiz, 'noquestionsfound');
}
/// Load those questions and the associated states.
$attemptobj->load_questions($questionids);
$attemptobj->load_question_states($questionids);
/// Print the quiz page ////////////////////////////////////////////////////////
// Print the page header
require_js(array('yui_yahoo', 'yui_event'));
require_js('mod/quiz/quiz.js');
$title = get_string('attempt', 'quiz', $attemptobj->get_attempt_number());
$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($title), '', $headtags, true, $attemptobj->update_module_button());
}
echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>';
// for overlib
if ($attemptobj->is_preview_user()) {
    /// Show the tab bar.
    $currenttab = 'preview';
    include 'tabs.php';
    /// Heading and tab bar.
    print_heading(get_string('previewquiz', 'quiz', format_string($quiz->name)));
    $attemptobj->print_restart_preview_button();
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:31,代码来源:_attempt.php


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