本文整理汇总了PHP中quiz_attempt::attempt_url方法的典型用法代码示例。如果您正苦于以下问题:PHP quiz_attempt::attempt_url方法的具体用法?PHP quiz_attempt::attempt_url怎么用?PHP quiz_attempt::attempt_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quiz_attempt
的用法示例。
在下文中一共展示了quiz_attempt::attempt_url方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: summary_page_controls
/**
* Creates any controls a the page should have.
*
* @param quiz_attempt $attemptobj
*/
public function summary_page_controls($attemptobj) {
$output = '';
// Return to place button.
if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) {
$button = new single_button(
new moodle_url($attemptobj->attempt_url(null, $attemptobj->get_currentpage())),
get_string('returnattempt', 'quiz'));
$output .= $this->container($this->container($this->render($button),
'controls'), 'submitbtns mdl-align');
}
// Finish attempt button.
$options = array(
'attempt' => $attemptobj->get_attemptid(),
'finishattempt' => 1,
'timeup' => 0,
'slots' => '',
'sesskey' => sesskey(),
);
$button = new single_button(
new moodle_url($attemptobj->processattempt_url(), $options),
get_string('submitallandfinish', 'quiz'));
$button->id = 'responseform';
if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) {
$button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null,
get_string('submitallandfinish', 'quiz')));
}
$duedate = $attemptobj->get_due_date();
$message = '';
if ($attemptobj->get_state() == quiz_attempt::OVERDUE) {
$message = get_string('overduemustbesubmittedby', 'quiz', userdate($duedate));
} else if ($duedate) {
$message = get_string('mustbesubmittedby', 'quiz', userdate($duedate));
}
$output .= $this->countdown_timer($attemptobj, time());
$output .= $this->container($message . $this->container(
$this->render($button), 'controls'), 'submitbtns mdl-align');
return $output;
}
示例2: array
$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.
print_table($table);
/// countdown timer
echo $attemptobj->get_timer_html();
/// Finish attempt button.
echo "<div class=\"submitbtns mdl-align\">\n";
$options = array('attempt' => $attemptobj->get_attemptid(), 'finishattempt' => 1, 'timeup' => 0, 'questionids' => '', 'sesskey' => sesskey());
print_single_button($attemptobj->processattempt_url(), $options, get_string('finishattempt', 'quiz'), 'post', '', false, '', false, get_string('confirmclose', 'quiz'), 'responseform');
echo "</div>\n";
/// Finish the page
示例3: summary_table
/**
* Generates the table of summarydata
*
* @param quiz_attempt $attemptobj
* @param mod_quiz_display_options $displayoptions
*/
public function summary_table($attemptobj, $displayoptions) {
// Prepare the summary table header
$table = new html_table();
$table->attributes['class'] = 'generaltable quizsummaryofattempt boxaligncenter';
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
$table->align = array('left', 'left');
$table->size = array('', '');
$markscolumn = $displayoptions->marks >= question_display_options::MARK_AND_MAX;
if ($markscolumn) {
$table->head[] = get_string('marks', 'quiz');
$table->align[] = 'left';
$table->size[] = '';
}
$table->data = array();
// Get the summary info for each question.
$slots = $attemptobj->get_slots();
foreach ($slots as $slot) {
if (!$attemptobj->is_real_question($slot)) {
continue;
}
$flag = '';
if ($attemptobj->is_question_flagged($slot)) {
$flag = html_writer::empty_tag('img', array('src' => $this->pix_url('i/flagged'),
'alt' => get_string('flagged', 'question'), 'class' => 'questionflag'));
}
$row = array(html_writer::link($attemptobj->attempt_url($slot),
$attemptobj->get_question_number($slot) . $flag),
$attemptobj->get_question_status($slot, $displayoptions->correctness));
if ($markscolumn) {
$row[] = $attemptobj->get_question_mark($slot);
}
$table->data[] = $row;
$table->rowclasses[] = $attemptobj->get_question_state_class(
$slot, $displayoptions->correctness);
}
// Print the summary table.
$output = html_writer::table($table);
return $output;
}
示例4: time
/// (so as to make sure students don't get penalized for slow processing on this page)
$timenow = time();
/// Get submitted parameters.
$attemptid = required_param('attempt', PARAM_INT);
$nextpage = optional_param('nextpage', 0, PARAM_INT);
$submittedquestionids = required_param('questionids', PARAM_SEQUENCE);
$finishattempt = optional_param('finishattempt', 0, PARAM_BOOL);
$timeup = optional_param('timeup', 0, PARAM_BOOL);
// True if form was submitted by timer.
$attemptobj = new quiz_attempt($attemptid);
/// Set $nexturl now. It will be updated if a particular question was sumbitted in
/// adaptive mode.
if ($nextpage == -1) {
$nexturl = $attemptobj->summary_url();
} else {
$nexturl = $attemptobj->attempt_url(0, $nextpage);
}
/// We treat automatically closed attempts just like normally closed attempts
if ($timeup) {
$finishattempt = 1;
}
/// Check login.
require_login($attemptobj->get_courseid(), false, $attemptobj->get_cm());
confirm_sesskey();
/// Check that this attempt belongs to this user.
if ($attemptobj->get_userid() != $USER->id) {
quiz_error($attemptobj->get_quiz(), 'notyourattempt');
}
/// Check capabilites.
if (!$attemptobj->is_preview_user()) {
$attemptobj->require_capability('mod/quiz:attempt');
示例5: redirect
$attemptobj = new quiz_attempt($attemptid);
/// Check login.
require_login($attemptobj->get_courseid(), false, $attemptobj->get_cm());
$attemptobj->check_review_capability();
/// Create an object to manage all the other (non-roles) access rules.
$accessmanager = $attemptobj->get_access_manager(time());
$options = $attemptobj->get_review_options();
/// Permissions checks for normal users who do not have quiz:viewreports capability.
if (!$attemptobj->has_capability('mod/quiz:viewreports')) {
/// 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.
示例6: summary_page_controls
/**
* Creates any controls a the page should have.
*
* @param quiz_attempt $attemptobj
*/
public function summary_page_controls($attemptobj) {
$output = '';
// countdown timer
$output .= $this->countdown_timer();
// Return to place button
$button = new single_button(
new moodle_url($attemptobj->attempt_url(null, $attemptobj->get_currentpage())), get_string('returnattempt', 'quiz'));
$output .= $this->container($this->container($this->render($button),
'controls'), 'submitbtns mdl-align');
// Finish attempt button.
$options = array(
'attempt' => $attemptobj->get_attemptid(),
'finishattempt' => 1,
'timeup' => 0,
'slots' => '',
'sesskey' => sesskey(),
);
$button = new single_button(
new moodle_url($attemptobj->processattempt_url(), $options),
get_string('submitallandfinish', 'quiz'));
$button->id = 'responseform';
$button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null,
get_string('submitallandfinish', 'quiz')));
$output .= $this->container($this->container($this->render($button),
'controls'), 'submitbtns mdl-align');
return $output;
}
示例7: skip_main_destination
color: #000;
text-align: center;
font-weight: bold;
background-image: url(../../count/back2.jpg);
vertical-align: middle;
}
-->
</style>
<?php
//echo "<SCRIPT language='JavaScript' SRC='$CFG->wwwroot/count/countdown.php?countto=1250744400'></SCRIPT>";
print_container_start();
echo skip_main_destination();
/// Print all the questions
foreach ($attemptobj->get_question_ids($page) as $id) {
$actual = $attemptobj->print_question($id, false, $attemptobj->attempt_url($id, $page));
//$actual = $attemptobj->get_actual_id($id, false, $attemptobj->attempt_url($id, $page));
saveQCAQuestions($id, $actual);
}
/// Print a link to the next page.
echo '<div class="submitbtns">';
if ($attemptobj->is_last_page($page)) {
$nextpage = -1;
$nextpageforie = 'gotosummary';
} else {
$nextpage = $page + 1;
$nextpageforie = 'gotopage' . $nextpage;
}
echo '<input type="submit" name="' . $nextpageforie . '" value="' . get_string('next') . '" />';
echo "</div>";
// Some hidden fields to trach what is going on.
示例8: foreach
echo "<caption>" . $attemptobj->get_quiz_name() . ": " . $qca->username . "</caption>";
echo "<thead>";
echo "<tr>";
echo "<th>Question</th>";
echo "<th>Answer</th>";
echo "<th>Score</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$cnt = 0;
$score = 0;
// Print Quiz Attempt Review
foreach ($attemptobj->get_question_ids($page) as $id) {
$cnt++;
$score += $attemptobj->get_question_score($id);
$actual = $attemptobj->get_actual_id($id, false, $attemptobj->attempt_url($id, $page));
$question = $DB->get_record('question', array('id' => $actual));
$responses = get_question_actual_response($attemptobj->get_question($id), $attemptobj->get_question_state($id));
echo "<tr class='odd'><td colspan='3'>Question: " . $cnt . "</td></tr>";
echo "<tr>";
// Question
echo "<td>" . replace_keywords($attemptid, $question->questiontext) . "</td>";
echo "<td>";
// Answer
foreach ($responses as $r) {
echo replace_keywords($attemptid, $r);
}
echo "</td>";
// Score
echo "<td>" . $attemptobj->get_question_score($id) . "</td>";
echo "</tr>";