mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-19813 upgraded calls to print_table, print_single_button, print_user_picture, print_container* and notice_yesno
This commit is contained in:
parent
3ab269ed44
commit
39e3701904
@ -195,6 +195,7 @@ class quiz_access_manager {
|
||||
*/
|
||||
public function print_start_attempt_button($canpreview, $buttontext, $unfinished) {
|
||||
/// Do we need a confirm javascript alert?
|
||||
global $OUTPUT;
|
||||
if ($unfinished) {
|
||||
$strconfirmstartattempt = '';
|
||||
} else {
|
||||
@ -206,9 +207,11 @@ class quiz_access_manager {
|
||||
if ($this->securewindow_required($canpreview)) {
|
||||
$this->_securewindowrule->print_start_attempt_button($buttontext, $strconfirmstartattempt);
|
||||
} else {
|
||||
print_single_button($this->_quizobj->start_attempt_url(),
|
||||
array('cmid' => $this->_quizobj->get_cmid(), 'sesskey' => sesskey()),
|
||||
$buttontext, 'post', '', false, '', false, $strconfirmstartattempt);
|
||||
$form = html_form::make_button($this->_quizobj->start_attempt_url(), array('cmid' => $this->_quizobj->get_cmid()), $buttontext);
|
||||
if ($strconfirmstartattempt) {
|
||||
$form->button->add_confirm_action($strconfirmstartattempt);
|
||||
}
|
||||
echo $OUTPUT->button($form);
|
||||
}
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
@ -750,11 +750,11 @@ class quiz_attempt extends quiz {
|
||||
* Print the HTML for the start new preview button.
|
||||
*/
|
||||
public function print_restart_preview_button() {
|
||||
global $CFG;
|
||||
echo '<div class="controls">';
|
||||
print_single_button($this->start_attempt_url(), array('cmid' => $this->cm->id,
|
||||
'forcenew' => true, 'sesskey' => sesskey()), get_string('startagain', 'quiz'), 'post');
|
||||
echo '</div>';
|
||||
global $CFG, $OUTPUT;
|
||||
echo $OUTPUT->container_start('controls');
|
||||
$options = array('cmid' => $this->cm->id, 'forcenew' => true);
|
||||
echo $OUTPUT->button(html_form::make_button($this->start_attempt_url(), $options, get_string('startagain', 'quiz')));
|
||||
echo $OUTPUT->container_end();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1068,11 +1068,11 @@ abstract class quiz_nav_panel_base {
|
||||
abstract protected function get_question_url($question);
|
||||
|
||||
protected function get_user_picture() {
|
||||
global $DB;
|
||||
global $DB, $OUTPUT;
|
||||
$user = $DB->get_record('user', array('id' => $this->attemptobj->get_userid()));
|
||||
$output = '';
|
||||
$output .= '<div id="user-picture" class="clearfix">';
|
||||
$output .= print_user_picture($user, $this->attemptobj->get_courseid(), NULL, 0, true, false);
|
||||
$output .= $OUTPUT->user_picture(moodle_user_picture::make($user, $this->attemptobj->get_courseid()));
|
||||
$output .= ' ' . fullname($user);
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
|
@ -602,19 +602,17 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete = true,
|
||||
echo "</div></div>";
|
||||
|
||||
if (!$reordertool && !$quiz->shufflequestions) {
|
||||
echo "<div class=\"addpage\">";
|
||||
print_single_button($pageurl->out(true),
|
||||
echo $OUTPUT->container_start('addpage');
|
||||
$form = html_form::make_button($pageurl->out(true),
|
||||
array('cmid' => $quiz->cmid,
|
||||
'courseid' => $quiz->course,
|
||||
'addpage' => $count,
|
||||
'sesskey' => sesskey()),
|
||||
get_string('addpagehere', 'quiz'),
|
||||
'get',
|
||||
'_self',
|
||||
false,
|
||||
'',
|
||||
$hasattempts);
|
||||
echo "</div>";
|
||||
'get');
|
||||
$form->button->disabled = $hasattempts;
|
||||
echo $OUTPUT->button($form);
|
||||
echo $OUTPUT->container_end();
|
||||
}
|
||||
$pageopen = false;
|
||||
$count++;
|
||||
|
@ -87,6 +87,7 @@
|
||||
$showing = 'scores'; // default
|
||||
}
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = $headings;
|
||||
$table->align = $align;
|
||||
|
||||
@ -161,7 +162,7 @@
|
||||
|
||||
// Display the table.
|
||||
echo '<br />';
|
||||
print_table($table);
|
||||
echo $OUTPUT->table($table);
|
||||
|
||||
// Finish the page
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -540,10 +540,10 @@ function quiz_grade_item_update($quiz, $grades=NULL) {
|
||||
$regrade_link = qualified_me() . '&confirm_regrade=1';
|
||||
echo $OUTPUT->box_start('generalbox', 'notice');
|
||||
echo '<p>'. $message .'</p>';
|
||||
echo '<div class="buttons">';
|
||||
print_single_button($regrade_link, null, get_string('regradeanyway', 'grades'), 'post', $CFG->framename);
|
||||
print_single_button($back_link, null, get_string('cancel'), 'post', $CFG->framename);
|
||||
echo '</div>';
|
||||
echo $OUTPUT->container_start('buttons');
|
||||
echo $OUTPUT->button(html_form::make_button($regrade_link, null, get_string('regradeanyway', 'grades')));
|
||||
echo $OUTPUT->button(html_form::make_button($back_link, null, get_string('cancel')));
|
||||
echo $OUTPUT->container_end();
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
return GRADE_UPDATE_ITEM_LOCKED;
|
||||
@ -822,7 +822,7 @@ function quiz_print_recent_mod_activity($activity, $courseid, $detail, $modnames
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" class="forum-recent">';
|
||||
|
||||
echo "<tr><td class=\"userpicture\" valign=\"top\">";
|
||||
print_user_picture($activity->user->userid, $courseid, $activity->user->picture);
|
||||
echo $OUTPUT->user_picture(moodle_user_picture::make($activity->user, $courseid));
|
||||
echo "</td><td>";
|
||||
|
||||
if ($detail) {
|
||||
|
@ -293,7 +293,7 @@ class quiz_grading_report extends quiz_default_report {
|
||||
$table->add_separator();
|
||||
foreach($attempts as $attempt) {
|
||||
|
||||
$picture = print_user_picture($attempt->userid, $quiz->course, $attempt->picture, false, true);
|
||||
$picture = $OUTPUT->user_picture(moodle_user_picture::make($attempt->userid, $quiz->course));
|
||||
|
||||
// link to student profile
|
||||
$userlink = "<a href=\"$CFG->wwwroot/user/view.php?id=$attempt->userid&course=$quiz->course\">".
|
||||
|
@ -116,14 +116,14 @@ class quiz_report_overview_table extends table_sql {
|
||||
}
|
||||
|
||||
function col_picture($attempt){
|
||||
global $COURSE;
|
||||
global $COURSE, $OUTPUT;
|
||||
$user = new object();
|
||||
$user->id = $attempt->userid;
|
||||
$user->lastname = $attempt->lastname;
|
||||
$user->firstname = $attempt->firstname;
|
||||
$user->imagealt = $attempt->imagealt;
|
||||
$user->picture = $attempt->picture;
|
||||
return print_user_picture($user, $COURSE->id, $attempt->picture, false, true);
|
||||
return $OUTPUT->user_picture(moodle_user_picture::make($user, $COURSE->id));
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,14 +71,14 @@ class quiz_report_responses_table extends table_sql {
|
||||
}
|
||||
|
||||
function col_picture($attempt){
|
||||
global $COURSE;
|
||||
global $COURSE, $OUTPUT;
|
||||
$user = new object();
|
||||
$user->id = $attempt->userid;
|
||||
$user->lastname = $attempt->lastname;
|
||||
$user->firstname = $attempt->firstname;
|
||||
$user->imagealt = $attempt->imagealt;
|
||||
$user->picture = $attempt->picture;
|
||||
return print_user_picture($user, $COURSE->id, $attempt->picture, false, true);
|
||||
return $OUTPUT->user_picture(moodle_user_picture::make($user, $COURSE->id));
|
||||
}
|
||||
|
||||
|
||||
@ -241,4 +241,4 @@ class quiz_report_responses_table extends table_sql {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -193,10 +193,10 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
if (!$this->table->is_downloading()){
|
||||
$datumfromtable = $this->table->format_row($question);
|
||||
|
||||
$questioninfotable = new object();
|
||||
$questioninfotable = new html_table();
|
||||
$questioninfotable->align = array('center', 'center');
|
||||
$questioninfotable->width = '60%';
|
||||
$questioninfotable->class = 'generaltable titlesleft';
|
||||
$questioninfotable->add_class('generaltable titlesleft');
|
||||
|
||||
$questioninfotable->data = array();
|
||||
$questioninfotable->data[] = array(get_string('modulename', 'quiz'), $quiz->name);
|
||||
@ -204,10 +204,10 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
$questioninfotable->data[] = array(get_string('questiontype', 'quiz_statistics'), $datumfromtable['icon'].' '.get_string($question->qtype,'quiz').' '.$datumfromtable['icon']);
|
||||
$questioninfotable->data[] = array(get_string('positions', 'quiz_statistics'), $question->_stats->positions);
|
||||
|
||||
$questionstatstable = new object();
|
||||
$questionstatstable = new html_table();
|
||||
$questionstatstable->align = array('center', 'center');
|
||||
$questionstatstable->width = '60%';
|
||||
$questionstatstable->class = 'generaltable titlesleft';
|
||||
$questionstatstable->add_class('generaltable titlesleft');
|
||||
|
||||
unset($datumfromtable['number']);
|
||||
unset($datumfromtable['icon']);
|
||||
@ -226,12 +226,12 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
$questionstatstable->data[] = array($labels[$item], $value);
|
||||
}
|
||||
echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics'));
|
||||
print_table($questioninfotable);
|
||||
echo $OUTPUT->table($questioninfotable);
|
||||
|
||||
echo $OUTPUT->box(format_text($question->questiontext, $question->questiontextformat).$actions, 'boxaligncenter generalbox boxwidthnormal mdl-align');
|
||||
|
||||
echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics'));
|
||||
print_table($questionstatstable);
|
||||
echo $OUTPUT->table($questionstatstable);
|
||||
|
||||
} else {
|
||||
$this->qtable->export_class_instance($this->table->export_class_instance());
|
||||
@ -349,7 +349,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
global $DB, $OUTPUT;
|
||||
// Print information on the number of existing attempts
|
||||
$quizinformationtablehtml = $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'), 2, 'main');
|
||||
$quizinformationtable = new object();
|
||||
$quizinformationtable = new html_table();
|
||||
$quizinformationtable->align = array('center', 'center');
|
||||
$quizinformationtable->width = '60%';
|
||||
$quizinformationtable->class = 'generaltable titlesleft';
|
||||
@ -410,8 +410,8 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
}
|
||||
$quizinformationtablehtml .= $OUTPUT->box_start('boxaligncenter generalbox boxwidthnormal mdl-align');
|
||||
$quizinformationtablehtml .= get_string('lastcalculated', 'quiz_statistics', $a);
|
||||
$quizinformationtablehtml .= print_single_button($reporturl->out(true), $reporturl->params()+array('recalculate'=>1),
|
||||
get_string('recalculatenow', 'quiz_statistics'), 'post', '', true);
|
||||
$quizinformationtablehtml .= $OUTPUT->button(html_form::make_button($reporturl->out(true), $reporturl->params()+array('recalculate'=>1),
|
||||
get_string('recalculatenow', 'quiz_statistics')));
|
||||
$quizinformationtablehtml .= $OUTPUT->box_end();
|
||||
}
|
||||
$downloadoptions = $this->table->get_download_menu();
|
||||
@ -425,7 +425,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
$quizinformationtablehtml .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table')));
|
||||
$quizinformationtablehtml .= '</div></form>';
|
||||
}
|
||||
$quizinformationtablehtml .= print_table($quizinformationtable, true);
|
||||
$quizinformationtablehtml .= $OUTPUT->table($quizinformationtable);
|
||||
if (!$this->table->is_downloading()){
|
||||
echo $quizinformationtablehtml;
|
||||
} elseif ($everything) {
|
||||
|
@ -131,7 +131,7 @@
|
||||
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 = print_user_picture($student, $attemptobj->get_courseid(), $student->picture, false, true);
|
||||
$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 . '&course=' . $attemptobj->get_courseid() . '">' .
|
||||
fullname($student, true) . '</a></td></tr>';
|
||||
|
@ -74,7 +74,7 @@
|
||||
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);
|
||||
$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 . '&course=' . $attemptobj->get_courseid() . '">' .
|
||||
fullname($student, true) . '</a></td></tr>';
|
||||
|
@ -68,7 +68,8 @@ if ($attemptobj->is_preview_user()) {
|
||||
echo $OUTPUT->heading($title);
|
||||
|
||||
/// Prepare the summary table header
|
||||
$table->class = 'generaltable quizsummaryofattempt boxaligncenter';
|
||||
$table = new html_table();
|
||||
$table->add_class('generaltable quizsummaryofattempt boxaligncenter');
|
||||
$table->head = array(get_string('question', 'quiz'), get_string('status', 'quiz'));
|
||||
$table->align = array('left', 'left');
|
||||
$table->size = array('', '');
|
||||
@ -100,13 +101,13 @@ foreach ($attemptobj->get_question_iterator() as $number => $question) {
|
||||
}
|
||||
|
||||
/// Print the summary table.
|
||||
print_table($table);
|
||||
echo $OUTPUT->table($table);
|
||||
|
||||
/// countdown timer
|
||||
echo $attemptobj->get_timer_html();
|
||||
|
||||
/// Finish attempt button.
|
||||
echo "<div class=\"submitbtns mdl-align\">\n";
|
||||
echo $OUTPUT->container_start('submitbtns mdl-align');
|
||||
$options = array(
|
||||
'attempt' => $attemptobj->get_attemptid(),
|
||||
'finishattempt' => 1,
|
||||
@ -114,9 +115,13 @@ $options = array(
|
||||
'questionids' => '',
|
||||
'sesskey' => sesskey(),
|
||||
);
|
||||
print_single_button(s($attemptobj->processattempt_url()), $options, get_string('finishattempt', 'quiz'),
|
||||
'post', '', false, '', false, get_string('confirmclose', 'quiz'), 'responseform');
|
||||
echo "</div>\n";
|
||||
|
||||
$form = html_form::make_button($attemptobj->processattempt_url(), $options, get_string('finishattempt', 'quiz'));
|
||||
$form->id = 'responseform';
|
||||
$form->button->add_confirm_action(get_string('confirmclose', 'quiz'));
|
||||
|
||||
echo $OUTPUT->button($form);
|
||||
echo $OUTPUT->container_end();
|
||||
|
||||
/// Finish the page
|
||||
$accessmanager->show_attempt_timer_if_needed($attemptobj->get_attempt(), time());
|
||||
|
@ -115,7 +115,7 @@
|
||||
|
||||
/// Guests can't do a quiz, so offer them a choice of logging in or going back.
|
||||
if (isguestuser()) {
|
||||
notice_yesno('<p>' . get_string('guestsno', 'quiz') . "</p>\n\n<p>" .
|
||||
echo $OUTPUT->confirm('<p>' . get_string('guestsno', 'quiz') . "</p>\n\n<p>" .
|
||||
get_string('liketologin') . "</p>\n", get_login_url(), get_referer(false));
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
@ -178,6 +178,7 @@
|
||||
$feedbackcolumn = quiz_has_feedback($quiz) && $alloptions->overallfeedback;
|
||||
|
||||
// Prepare table header
|
||||
$table = new html_table();
|
||||
$table->class = 'generaltable quizattemptsummary';
|
||||
$table->head = array();
|
||||
$table->align = array();
|
||||
@ -295,7 +296,7 @@
|
||||
$table->data[$attempt->attempt] = $row;
|
||||
}
|
||||
} // End of loop over attempts.
|
||||
print_table($table);
|
||||
echo $OUTPUT->table($table);
|
||||
}
|
||||
|
||||
/// Print information about the student's best score for this quiz if possible.
|
||||
|
Loading…
x
Reference in New Issue
Block a user