本文整理汇总了PHP中quiz_attempt::get_question_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP quiz_attempt::get_question_ids方法的具体用法?PHP quiz_attempt::get_question_ids怎么用?PHP quiz_attempt::get_question_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quiz_attempt
的用法示例。
在下文中一共展示了quiz_attempt::get_question_ids方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
print_heading($title);
/// Prepare the summary table header
$table->class = 'generaltable quizsummaryofattempt';
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
$table->align = array('left', 'left');
$table->size = array('', '');
$scorescolumn = $attemptobj->get_review_options()->scores;
if ($scorescolumn) {
$table->head[] = get_string('marks', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
}
$table->data = array();
/// Get the summary info for each question.
$questionids = $attemptobj->get_question_ids();
foreach ($attemptobj->get_question_iterator() as $number => $question) {
if ($question->length == 0) {
continue;
}
$flag = '';
if ($attemptobj->is_question_flagged($question->id)) {
$flag = ' <img src="' . $CFG->pixpath . '/i/flagged.png" alt="' . get_string('flagged', 'question') . '" class="questionflag" />';
}
$row = array('<a href="' . $attemptobj->attempt_url($question->id) . '">' . $number . $flag . '</a>', get_string($attemptobj->get_question_status($question->id), 'quiz'));
if ($scorescolumn) {
$row[] = $attemptobj->get_question_score($question->id);
}
$table->data[] = $row;
}
/// Print the summary table.
示例2: redirect
/// Can't review other users' attempts.
if (!$attemptobj->is_own_attempt()) {
quiz_error($attemptobj->get_quiz(), 'notyourattempt');
}
/// Can't review during the attempt - send them back to the attempt page.
if (!$attemptobj->is_finished()) {
redirect($attemptobj->attempt_url(0, $page));
}
/// Can't review unless Students may review -> Responses option is turned on.
if (!$options->responses) {
$accessmanager->back_to_view_page($attemptobj->is_preview_user(), $accessmanager->cannot_review_message($options));
}
}
/// Load the questions and states needed by this page.
if ($showall) {
$questionids = $attemptobj->get_question_ids();
} else {
$questionids = $attemptobj->get_question_ids($page);
}
$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.
示例3: __construct
/**
* Constructor. Normally, you don't want to call this directly. Instead call
* quiz_attempt::get_question_iterator
*
* @param quiz_attempt $attemptobj the quiz_attempt object we will be providing access to.
* @param mixed $page as for @see{quiz_attempt::get_question_iterator}.
*/
public function __construct(quiz_attempt $attemptobj, $page = 'all')
{
$this->attemptobj = $attemptobj;
$this->questionids = $attemptobj->get_question_ids($page);
}
示例4: redirect
}
/// If the attempt is already closed, send them to the review page.
if ($attemptobj->is_finished()) {
redirect($attemptobj->review_url(0, $page));
}
/// Check the access rules.
$accessmanager = $attemptobj->get_access_manager(time());
$messages = $accessmanager->prevent_access();
if (!$attemptobj->is_preview_user() && $messages) {
print_error('attempterror', 'quiz', $quizobj->view_url(), $accessmanager->print_messages($messages, true));
}
$accessmanager->do_password_check($attemptobj->is_preview_user());
/// 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);