// before any action that may take longer time to finish.
function xmldb_assignment_upgrade($oldversion) {
- global $CFG, $DB;
+ global $CFG, $DB, $OUTPUT;
$dbman = $DB->get_manager();
$result = true;
continue;
}
if (!$item->isReadable()) {
- notify(" File not readable, skipping: ".$path.$item->getFilename());
+ echo $OUTPUT->notification(" File not readable, skipping: ".$path.$item->getFilename());
continue;
}
$filename = clean_param($item->getFilename(), PARAM_FILE);
* The default implementation prints the assignment description in a box
*/
function view_intro() {
- print_simple_box_start('center', '', '', 0, 'generalbox', 'intro');
+ global $OUTPUT;
+ echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro');
echo format_module_intro('assignment', $this->assignment, $this->cm->id);
- print_simple_box_end();
+ echo $OUTPUT->box_end();
}
/**
* This will be suitable for most assignment types
*/
function view_dates() {
+ global $OUTPUT;
if (!$this->assignment->timeavailable && !$this->assignment->timedue) {
return;
}
- print_simple_box_start('center', '', '', 0, 'generalbox', 'dates');
+ echo $OUTPUT->box_start('generalbox boxaligncenter', 'dates');
echo '<table>';
if ($this->assignment->timeavailable) {
echo '<tr><td class="c0">'.get_string('availabledate','assignment').':</td>';
echo ' <td class="c1">'.userdate($this->assignment->timedue).'</td></tr>';
}
echo '</table>';
- print_simple_box_end();
+ echo $OUTPUT->box_end();
}
}
- $message = notify(get_string('changessaved'), 'notifysuccess', 'center', true);
+ $message = $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
$this->display_submissions($message);
break;
} else {
echo '<div class="format">';
echo $OUTPUT->select(html_select::make(format_text_menu(), "format", $submission->format, false));
- helpbutton("textformat", get_string("helpformatting"));
+ echo $OUTPUT->help_icon(moodle_help_icon::make("textformat", get_string("helpformatting")));
echo '</div>';
}
}
echo '<label for="mailinfo">'.get_string('enableemailnotification','assignment').'</label>';
echo '<input type="hidden" name="mailinfo" value="0" />';
echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" '.$lastmailinfo.' />';
- helpbutton('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment').'</p></div>';
+ echo $OUTPUT->help_icon(moodle_help_icon::make('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment')).'</p></div>';
echo '</div>';
echo '<div class="fastgbutton"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>';
echo '</div>';
echo '</td>';
echo '<td>';
echo '<input type="text" id="perpage" name="perpage" size="1" value="'.$perpage.'" />';
- helpbutton('pagesize', get_string('pagesize','assignment'), 'assignment');
+ echo $OUTPUT->help_icon(moodle_help_icon::make('pagesize', get_string('pagesize','assignment'), 'assignment'));
echo '</td></tr>';
echo '<tr><td>';
echo '<label for="quickgrade">'.get_string('quickgrade','assignment').'</label>';
echo '<td>';
$checked = $quickgrade ? 'checked="checked"' : '';
echo '<input type="checkbox" id="quickgrade" name="quickgrade" value="1" '.$checked.' />';
- helpbutton('quickgrade', get_string('quickgrade', 'assignment'), 'assignment').'</p></div>';
+ echo $OUTPUT->help_icon(moodle_help_icon::make('quickgrade', get_string('quickgrade', 'assignment'), 'assignment')).'</p></div>';
echo '</td></tr>';
echo '<tr><td colspan="2">';
echo '<input type="submit" value="'.get_string('savepreferences').'" />';
* @param $user object
*/
function user_complete($user) {
+ global $OUTPUT;
if ($submission = $this->get_submission($user->id)) {
$fs = get_file_storage();
}
}
- print_simple_box_start();
+ echo $OUTPUT->box_start();
echo get_string("lastmodified").": ";
echo userdate($submission->timemodified);
echo $this->display_lateness($submission->timemodified);
$this->view_feedback($submission);
}
- print_simple_box_end();
+ echo $OUTPUT->box_end();
} else {
print_string("notsubmittedyet", "assignment");
redirect('view.php?id='.$this->cm->id.'&saved=1');
} else {
// TODO: add better error message
- notify(get_string("error")); //submitting not allowed!
+ echo $OUTPUT->notification(get_string("error")); //submitting not allowed!
}
}
$this->view_dates();
if ($saved) {
- notify(get_string('submissionsaved', 'assignment'), 'notifysuccess');
+ echo $OUTPUT->notification(get_string('submissionsaved', 'assignment'), 'notifysuccess');
}
if (has_capability('mod/assignment:submit', $context)) {
* Display the assignment dates
*/
function view_dates() {
- global $USER, $CFG;
+ global $USER, $CFG, $OUTPUT;
if (!$this->assignment->timeavailable && !$this->assignment->timedue) {
return;
}
- print_simple_box_start('center', '', '', 0, 'generalbox', 'dates');
+ echo $OUTPUT->box_start('generalbox boxaligncenter', 'dates');
echo '<table>';
if ($this->assignment->timeavailable) {
echo '<tr><td class="c0">'.get_string('availabledate','assignment').':</td>';
}
}
echo '</table>';
- print_simple_box_end();
+ echo $OUTPUT->box_end();
}
function update_submission($data) {
///Stolen code from file.php
- print_simple_box_start('center', '', '', 0, 'generalbox', 'wordcount');
+ echo $OUTPUT->box_start('generalbox boxaligncenter', 'wordcount');
/// Decide what to count
if ($CFG->assignment_itemstocount == ASSIGNMENT_COUNT_WORDS) {
echo ' ('.get_string('numwords', '', count_words(format_text($submission->data1, $submission->data2))).')';
} else if ($CFG->assignment_itemstocount == ASSIGNMENT_COUNT_LETTERS) {
echo ' ('.get_string('numletters', '', count_letters(format_text($submission->data1, $submission->data2))).')';
}
- print_simple_box_end();
- print_simple_box(format_text($submission->data1, $submission->data2), 'center', '100%');
+ echo $OUTPUT->box_end();
+ echo $OUTPUT->box(format_text($submission->data1, $submission->data2), 'generalbox boxaligncenter boxwidthwide');
///End of stolen code from file.php
if ($submission = $assignmentinstance->get_submission($user->id)) {
print_header(fullname($user,true).': '.$assignment->name);
- print_simple_box_start('center', '', '', '', 'generalbox', 'dates');
+ echo $OUTPUT->box_start('generalbox boxaligcenter', 'dates');
echo '<table>';
if ($assignment->timedue) {
echo '<tr><td class="c0">'.get_string('duedate','assignment').':</td>';
echo ' ('.get_string('numletters', '', count_letters(format_text($submission->data1, $submission->data2))).')</td></tr>';
}
echo '</table>';
- print_simple_box_end();
+ echo $OUTPUT->box_end();
- print_simple_box(format_text($submission->data1, $submission->data2), 'center', '100%');
+ echo $OUTPUT->box(format_text($submission->data1, $submission->data2), 'generalbox boxaligncenter boxwidthwide');
echo $OUTPUT->close_window_button();
echo $OUTPUT->footer();
} else {
if ($this->assignment->timeavailable > time()
and !has_capability('mod/assignment:grade', $this->context) // grading user can see it anytime
and $this->assignment->var3) { // force hiding before available date
- print_simple_box_start('center', '', '', 0, 'generalbox', 'intro');
+ echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro');
print_string('notavailableyet', 'assignment');
- print_simple_box_end();
+ echo $OUTPUT->box_end();
} else {
$this->view_intro();
}
}
if ($filecount and $submission) {
- print_simple_box($this->print_user_files($USER->id, true), 'center');
+ echo $OUTPUT->box($this->print_user_files($USER->id, true), 'generalbox boxaligncenter');
} else {
if (!$this->isopen() or $this->is_finalized($submission)) {
- print_simple_box(get_string('nofiles', 'assignment'), 'center');
+ echo $OUTPUT->box(get_string('nofiles', 'assignment'), 'generalbox boxaligncenter');
} else {
- print_simple_box(get_string('nofilesyet', 'assignment'), 'center');
+ echo $OUTPUT->box(get_string('nofilesyet', 'assignment'), 'generalbox boxaligncenter');
}
}
if ($this->count_responsefiles($USER->id)) {
echo $OUTPUT->heading(get_string('responsefiles', 'assignment'), 3);
$responsefiles = $this->print_responsefiles($USER->id, true);
- print_simple_box($responsefiles, 'center');
+ echo $OUTPUT->box($responsefiles, 'generalbox boxaligncenter');
}
return;
}
}
function view_notes() {
- global $USER;
+ global $USER, $OUTPUT;
if ($submission = $this->get_submission($USER->id)
and !empty($submission->data1)) {
- print_simple_box(format_text($submission->data1, FORMAT_HTML), 'center', '630px');
+ echo $OUTPUT->box(format_text($submission->data1, FORMAT_HTML), 'generalbox boxaligncenter boxwidthwide');
} else {
- print_simple_box(get_string('notesempty', 'assignment'), 'center');
+ echo $OUTPUT->box(get_string('notesempty', 'assignment'), 'generalbox boxaligncenter');
}
if ($this->can_update_notes($submission)) {
$options = array ('id'=>$this->cm->id, 'action'=>'editnotes');
if (!$this->can_update_notes($submission)) {
$this->view_header(get_string('upload'));
- notify(get_string('uploaderror', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('uploaderror', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
$this->view_footer();
die;
}
} else {
$this->view_header(get_string('notes', 'assignment'));
- notify(get_string('notesupdateerror', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('notesupdateerror', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
$this->view_footer();
die;
}
}
}
print_header(get_string('upload'));
- notify(get_string('uploaderror', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('uploaderror', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
echo $OUTPUT->footer();
die;
}
function upload_file() {
- global $CFG, $USER, $DB;
+ global $CFG, $USER, $DB, $OUTPUT;
$returnurl = 'view.php?id='.$this->cm->id;
if (!$this->can_upload_file($submission)) {
$this->view_header(get_string('upload'));
- notify(get_string('uploaderror', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('uploaderror', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
$this->view_footer();
die;
}
}
$this->view_header(get_string('upload'));
- notify(get_string('uploaderror', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('uploaderror', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
$this->view_footer();
die;
}
$this->email_teachers($submission);
} else {
$this->view_header(get_string('submitformarking', 'assignment'));
- notify(get_string('finalizeerror', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('finalizeerror', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
$this->view_footer();
die;
}
$this->update_grade($submission);
} else {
$this->view_header(get_string('submitformarking', 'assignment'));
- notify(get_string('unfinalizeerror', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('unfinalizeerror', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
$this->view_footer();
die;
}
// print delete error
print_header(get_string('delete'));
- notify(get_string('deletefilefailed', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('deletefilefailed', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
echo $OUTPUT->footer();
die;
if (!$submission = $this->get_submission($userid) // incorrect submission
or !$this->can_delete_files($submission)) { // can not delete
$this->view_header(get_string('delete'));
- notify(get_string('cannotdeletefiles', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('cannotdeletefiles', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
$this->view_footer();
die;
}
} else {
print_header(get_string('delete'));
}
- notify(get_string('deletefilefailed', 'assignment'));
- print_continue($returnurl);
+ echo $OUTPUT->notification(get_string('deletefilefailed', 'assignment'));
+ echo $OUTPUT->continue_button($returnurl);
if (empty($mode)) {
$this->view_footer();
} else {
and !empty($submission->data1)) {
print_header(fullname($user,true).': '.$assignment->name);
echo $OUTPUT->heading(get_string('notes', 'assignment').' - '.fullname($user,true));
- print_simple_box(format_text($submission->data1, FORMAT_HTML), 'center', '100%');
+ echo $OUTPUT->box(format_text($submission->data1, FORMAT_HTML), 'generalbox boxaligncenter boxwidthwide');
if ($mode != 'single') {
echo $OUTPUT->close_window_button();
} else {
- print_continue($returnurl);
+ echo $OUTPUT->continue_button($returnurl);
}
echo $OUTPUT->footer();
} else {
print_header(fullname($user,true).': '.$assignment->name);
echo $OUTPUT->heading(get_string('notes', 'assignment').' - '.fullname($user,true));
- print_simple_box(get_string('notesempty', 'assignment'), 'center', '100%');
+ echo $OUTPUT->box(get_string('notesempty', 'assignment'), 'generalbox boxaligncenter boxwidthwide');
if ($mode != 'single') {
echo $OUTPUT->close_window_button();
} else {
- print_continue($returnurl);
+ echo $OUTPUT->continue_button($returnurl);
}
echo $OUTPUT->footer();
}
function view() {
- global $USER;
+ global $USER, $OUTPUT;
$context = get_context_instance(CONTEXT_MODULE,$this->cm->id);
require_capability('mod/assignment:view', $context);
$this->view_feedback();
}
if ($filecount) {
- print_simple_box($this->print_user_files($USER->id, true), 'center');
+ echo $OUTPUT->box($this->print_user_files($USER->id, true), 'generalbox boxaligncenter');
}
}
if ($submission = $this->get_submission($USER->id)) {
//TODO: change later to ">= 0", to prevent resubmission when graded 0
if (($submission->grade > 0) and !$this->assignment->resubmit) {
- notify(get_string('alreadygraded', 'assignment'));
+ echo $OUTPUT->notification(get_string('alreadygraded', 'assignment'));
}
}
echo $OUTPUT->heading(get_string('uploadedfile'));
redirect('view.php?id='.$this->cm->id);
} else {
- notify(get_string("uploadnotregistered", "assignment", $newfile_name) );
+ echo $OUTPUT->notification(get_string("uploadnotregistered", "assignment", $newfile_name) );
$file->delete();
}
}
}
} else {
- notify(get_string("uploaderror", "assignment")); //submitting not allowed!
+ echo $OUTPUT->notification(get_string("uploaderror", "assignment")); //submitting not allowed!
}
}
- print_continue('view.php?id='.$this->cm->id);
+ echo $OUTPUT->continue_button('view.php?id='.$this->cm->id);
$this->view_footer();
}