2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * This file contains a renderer for the assignment class
21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') || die();
27 require_once($CFG->dirroot . '/mod/assign/locallib.php');
29 use \mod_assign\output\grading_app;
32 * A custom renderer class that extends the plugin_renderer_base and is used by the assign module.
35 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38 class mod_assign_renderer extends plugin_renderer_base {
41 * Rendering assignment files
43 * @param context $context
45 * @param string $filearea
46 * @param string $component
49 public function assign_files(context $context, $userid, $filearea, $component) {
50 return $this->render(new assign_files($context, $userid, $filearea, $component));
54 * Rendering assignment files
56 * @param assign_files $tree
59 public function render_assign_files(assign_files $tree) {
60 $this->htmlid = html_writer::random_id('assign_files_tree');
61 $this->page->requires->js_init_call('M.mod_assign.init_tree', array(true, $this->htmlid));
62 $html = '<div id="'.$this->htmlid.'">';
63 $html .= $this->htmllize_tree($tree, $tree->dir);
66 if ($tree->portfolioform) {
67 $html .= $tree->portfolioform;
73 * Utility function to add a row of data to a table with 2 columns. Modified
74 * the table param and does not return a value
76 * @param html_table $table The table to append the row of data to
77 * @param string $first The first column text
78 * @param string $second The second column text
81 private function add_table_row_tuple(html_table $table, $first, $second) {
82 $row = new html_table_row();
83 $cell1 = new html_table_cell($first);
84 $cell2 = new html_table_cell($second);
85 $row->cells = array($cell1, $cell2);
86 $table->data[] = $row;
90 * Render a grading message notification
91 * @param assign_gradingmessage $result The result to render
94 public function render_assign_gradingmessage(assign_gradingmessage $result) {
95 $urlparams = array('id' => $result->coursemoduleid, 'action'=>'grading');
96 if (!empty($result->page)) {
97 $urlparams['page'] = $result->page;
99 $url = new moodle_url('/mod/assign/view.php', $urlparams);
100 $classes = $result->gradingerror ? 'notifyproblem' : 'notifysuccess';
103 $o .= $this->output->heading($result->heading, 4);
104 $o .= $this->output->notification($result->message, $classes);
105 $o .= $this->output->continue_button($url);
110 * Render the generic form
111 * @param assign_form $form The form to render
114 public function render_assign_form(assign_form $form) {
116 if ($form->jsinitfunction) {
117 $this->page->requires->js_init_call($form->jsinitfunction, array());
119 $o .= $this->output->box_start('boxaligncenter ' . $form->classname);
120 $o .= $this->moodleform($form->form);
121 $o .= $this->output->box_end();
126 * Render the user summary
128 * @param assign_user_summary $summary The user summary to render
131 public function render_assign_user_summary(assign_user_summary $summary) {
136 if (!$summary->user) {
140 if ($summary->suspendeduser) {
141 $supendedclass = ' usersuspended';
142 $suspendedstring = get_string('userenrolmentsuspended', 'grades');
143 $suspendedicon = ' ' . $this->pix_icon('i/enrolmentsuspended', $suspendedstring);
145 $o .= $this->output->container_start('usersummary');
146 $o .= $this->output->box_start('boxaligncenter usersummarysection'.$supendedclass);
147 if ($summary->blindmarking) {
148 $o .= get_string('hiddenuser', 'assign') . $summary->uniqueidforuser.$suspendedicon;
150 $o .= $this->output->user_picture($summary->user);
151 $o .= $this->output->spacer(array('width'=>30));
152 $urlparams = array('id' => $summary->user->id, 'course'=>$summary->courseid);
153 $url = new moodle_url('/user/view.php', $urlparams);
154 $fullname = fullname($summary->user, $summary->viewfullnames);
155 $extrainfo = array();
156 foreach ($summary->extrauserfields as $extrafield) {
157 $extrainfo[] = $summary->user->$extrafield;
159 if (count($extrainfo)) {
160 $fullname .= ' (' . implode(', ', $extrainfo) . ')';
162 $fullname .= $suspendedicon;
163 $o .= $this->output->action_link($url, $fullname);
165 $o .= $this->output->box_end();
166 $o .= $this->output->container_end();
172 * Render the submit for grading page
174 * @param assign_submit_for_grading_page $page
177 public function render_assign_submit_for_grading_page($page) {
180 $o .= $this->output->container_start('submitforgrading');
181 $o .= $this->output->heading(get_string('submitassignment', 'assign'), 3);
182 $o .= $this->output->spacer(array('height'=>30));
184 $cancelurl = new moodle_url('/mod/assign/view.php', array('id' => $page->coursemoduleid));
185 if (count($page->notifications)) {
186 // At least one of the submission plugins is not ready for submission.
188 $o .= $this->output->heading(get_string('submissionnotready', 'assign'), 4);
190 foreach ($page->notifications as $notification) {
191 $o .= $this->output->notification($notification);
194 $o .= $this->output->continue_button($cancelurl);
196 // All submission plugins ready - show the confirmation form.
197 $o .= $this->output->box_start('generalbox submitconfirm');
198 $o .= $this->moodleform($page->confirmform);
199 $o .= $this->output->box_end();
201 $o .= $this->output->container_end();
207 * Page is done - render the footer.
211 public function render_footer() {
212 return $this->output->footer();
218 * @param assign_header $header
221 public function render_assign_header(assign_header $header) {
224 if ($header->subpage) {
225 $this->page->navbar->add($header->subpage);
228 $this->page->set_title(get_string('pluginname', 'assign'));
229 $this->page->set_heading($this->page->course->fullname);
231 $o .= $this->output->header();
232 $heading = format_string($header->assign->name, false, array('context' => $header->context));
233 $o .= $this->output->heading($heading);
234 if ($header->preface) {
235 $o .= $header->preface;
238 if ($header->showintro) {
239 $o .= $this->output->box_start('generalbox boxaligncenter', 'intro');
240 $o .= format_module_intro('assign', $header->assign, $header->coursemoduleid);
241 $o .= $header->postfix;
242 $o .= $this->output->box_end();
249 * Render the header for an individual plugin.
251 * @param assign_plugin_header $header
254 public function render_assign_plugin_header(assign_plugin_header $header) {
255 $o = $header->plugin->view_header();
260 * Render a table containing the current status of the grading process.
262 * @param assign_grading_summary $summary
265 public function render_assign_grading_summary(assign_grading_summary $summary) {
266 // Create a table for the data.
268 $o .= $this->output->container_start('gradingsummary');
269 $o .= $this->output->heading(get_string('gradingsummary', 'assign'), 3);
270 $o .= $this->output->box_start('boxaligncenter gradingsummarytable');
271 $t = new html_table();
274 if ($summary->teamsubmission) {
275 if ($summary->warnofungroupedusers) {
276 $o .= $this->output->notification(get_string('ungroupedusers', 'assign'));
279 $this->add_table_row_tuple($t, get_string('numberofteams', 'assign'),
280 $summary->participantcount);
282 $this->add_table_row_tuple($t, get_string('numberofparticipants', 'assign'),
283 $summary->participantcount);
286 // Drafts count and dont show drafts count when using offline assignment.
287 if ($summary->submissiondraftsenabled && $summary->submissionsenabled) {
288 $this->add_table_row_tuple($t, get_string('numberofdraftsubmissions', 'assign'),
289 $summary->submissiondraftscount);
292 // Submitted for grading.
293 if ($summary->submissionsenabled) {
294 $this->add_table_row_tuple($t, get_string('numberofsubmittedassignments', 'assign'),
295 $summary->submissionssubmittedcount);
296 if (!$summary->teamsubmission) {
297 $this->add_table_row_tuple($t, get_string('numberofsubmissionsneedgrading', 'assign'),
298 $summary->submissionsneedgradingcount);
303 if ($summary->duedate) {
305 $duedate = $summary->duedate;
306 $this->add_table_row_tuple($t, get_string('duedate', 'assign'),
311 if ($duedate - $time <= 0) {
312 $due = get_string('assignmentisdue', 'assign');
314 $due = format_time($duedate - $time);
316 $this->add_table_row_tuple($t, get_string('timeremaining', 'assign'), $due);
318 if ($duedate < $time) {
319 $cutoffdate = $summary->cutoffdate;
321 if ($cutoffdate > $time) {
322 $late = get_string('latesubmissionsaccepted', 'assign', userdate($summary->cutoffdate));
324 $late = get_string('nomoresubmissionsaccepted', 'assign');
326 $this->add_table_row_tuple($t, get_string('latesubmissions', 'assign'), $late);
332 // All done - write the table.
333 $o .= html_writer::table($t);
334 $o .= $this->output->box_end();
336 // Link to the grading page.
338 $o .= $this->output->container_start('submissionlinks');
339 $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grading');
340 $url = new moodle_url('/mod/assign/view.php', $urlparams);
341 $o .= '<a href="' . $url . '" class="btn btn-secondary">' . get_string('viewgrading', 'mod_assign') . '</a> ';
342 if ($summary->cangrade) {
343 $urlparams = array('id' => $summary->coursemoduleid, 'action' => 'grader');
344 $url = new moodle_url('/mod/assign/view.php', $urlparams);
345 $o .= '<a href="' . $url . '" class="btn btn-primary">' . get_string('grade') . '</a>';
347 $o .= $this->output->container_end();
349 // Close the container and insert a spacer.
350 $o .= $this->output->container_end();
357 * Render a table containing all the current grades and feedback.
359 * @param assign_feedback_status $status
362 public function render_assign_feedback_status(assign_feedback_status $status) {
366 $o .= $this->output->container_start('feedback');
367 $o .= $this->output->heading(get_string('feedback', 'assign'), 3);
368 $o .= $this->output->box_start('boxaligncenter feedbacktable');
369 $t = new html_table();
372 if (isset($status->gradefordisplay)) {
373 $row = new html_table_row();
374 $cell1 = new html_table_cell(get_string('grade'));
375 $cell2 = new html_table_cell($status->gradefordisplay);
376 $row->cells = array($cell1, $cell2);
380 $row = new html_table_row();
381 $cell1 = new html_table_cell(get_string('gradedon', 'assign'));
382 $cell2 = new html_table_cell(userdate($status->gradeddate));
383 $row->cells = array($cell1, $cell2);
387 if ($status->grader) {
389 $row = new html_table_row();
390 $cell1 = new html_table_cell(get_string('gradedby', 'assign'));
391 $userdescription = $this->output->user_picture($status->grader) .
392 $this->output->spacer(array('width'=>30)) .
393 fullname($status->grader, $status->canviewfullnames);
394 $cell2 = new html_table_cell($userdescription);
395 $row->cells = array($cell1, $cell2);
399 foreach ($status->feedbackplugins as $plugin) {
400 if ($plugin->is_enabled() &&
401 $plugin->is_visible() &&
402 $plugin->has_user_summary() &&
403 !empty($status->grade) &&
404 !$plugin->is_empty($status->grade)) {
406 $row = new html_table_row();
407 $cell1 = new html_table_cell($plugin->get_name());
408 $displaymode = assign_feedback_plugin_feedback::SUMMARY;
409 $pluginfeedback = new assign_feedback_plugin_feedback($plugin,
412 $status->coursemoduleid,
413 $status->returnaction,
414 $status->returnparams);
415 $cell2 = new html_table_cell($this->render($pluginfeedback));
416 $row->cells = array($cell1, $cell2);
421 $o .= html_writer::table($t);
422 $o .= $this->output->box_end();
424 $o .= $this->output->container_end();
429 * Render a compact view of the current status of the submission.
431 * @param assign_submission_status_compact $status
434 public function render_assign_submission_status_compact(assign_submission_status_compact $status) {
436 $o .= $this->output->container_start('submissionstatustable');
437 $o .= $this->output->heading(get_string('submission', 'assign'), 3);
440 if ($status->teamsubmissionenabled) {
441 $group = $status->submissiongroup;
443 $team = format_string($group->name, false, $status->context);
444 } else if ($status->preventsubmissionnotingroup) {
445 if (count($status->usergroups) == 0) {
446 $team = '<span class="alert alert-error">' . get_string('noteam', 'assign') . '</span>';
447 } else if (count($status->usergroups) > 1) {
448 $team = '<span class="alert alert-error">' . get_string('multipleteams', 'assign') . '</span>';
451 $team = get_string('defaultteam', 'assign');
453 $o .= $this->output->container(get_string('teamname', 'assign', $team), 'teamname');
456 if (!$status->teamsubmissionenabled) {
457 if ($status->submission && $status->submission->status != ASSIGN_SUBMISSION_STATUS_NEW) {
458 $statusstr = get_string('submissionstatus_' . $status->submission->status, 'assign');
459 $o .= $this->output->container($statusstr, 'submissionstatus' . $status->submission->status);
461 if (!$status->submissionsenabled) {
462 $o .= $this->output->container(get_string('noonlinesubmissions', 'assign'), 'submissionstatus');
464 $o .= $this->output->container(get_string('noattempt', 'assign'), 'submissionstatus');
468 $group = $status->submissiongroup;
469 if (!$group && $status->preventsubmissionnotingroup) {
470 $o .= $this->output->container(get_string('nosubmission', 'assign'), 'submissionstatus');
471 } else if ($status->teamsubmission && $status->teamsubmission->status != ASSIGN_SUBMISSION_STATUS_NEW) {
472 $teamstatus = $status->teamsubmission->status;
473 $submissionsummary = get_string('submissionstatus_' . $teamstatus, 'assign');
475 if ($status->submissiongroup) {
476 $groupid = $status->submissiongroup->id;
479 $members = $status->submissiongroupmemberswhoneedtosubmit;
480 $userslist = array();
481 foreach ($members as $member) {
482 $urlparams = array('id' => $member->id, 'course' => $status->courseid);
483 $url = new moodle_url('/user/view.php', $urlparams);
484 if ($status->view == assign_submission_status::GRADER_VIEW && $status->blindmarking) {
485 $userslist[] = $member->alias;
487 $fullname = fullname($member, $status->canviewfullnames);
488 $userslist[] = $this->output->action_link($url, $fullname);
491 if (count($userslist) > 0) {
492 $userstr = join(', ', $userslist);
493 $formatteduserstr = get_string('userswhoneedtosubmit', 'assign', $userstr);
494 $submissionsummary .= $this->output->container($formatteduserstr);
496 $o .= $this->output->container($submissionsummary, 'submissionstatus' . $status->teamsubmission->status);
498 if (!$status->submissionsenabled) {
499 $o .= $this->output->container(get_string('noonlinesubmissions', 'assign'), 'submissionstatus');
501 $o .= $this->output->container(get_string('nosubmission', 'assign'), 'submissionstatus');
507 if ($status->locked) {
508 $o .= $this->output->container(get_string('submissionslocked', 'assign'), 'submissionlocked');
513 $classname = 'gradingstatus';
514 if ($status->gradingstatus == ASSIGN_GRADING_STATUS_GRADED ||
515 $status->gradingstatus == ASSIGN_GRADING_STATUS_NOT_GRADED) {
516 $statusstr = get_string($status->gradingstatus, 'assign');
518 $gradingstatus = 'markingworkflowstate' . $status->gradingstatus;
519 $statusstr = get_string($gradingstatus, 'assign');
521 if ($status->gradingstatus == ASSIGN_GRADING_STATUS_GRADED ||
522 $status->gradingstatus == ASSIGN_MARKING_WORKFLOW_STATE_RELEASED) {
523 $classname = 'submissiongraded';
525 $classname = 'submissionnotgraded';
527 $o .= $this->output->container($statusstr, $classname);
529 $submission = $status->teamsubmission ? $status->teamsubmission : $status->submission;
530 $duedate = $status->duedate;
533 if ($status->extensionduedate) {
535 $duedate = $status->extensionduedate;
539 $classname = 'timeremaining';
540 if ($duedate - $time <= 0) {
542 $submission->status != ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
543 if ($status->submissionsenabled) {
544 $remaining = get_string('overdue', 'assign', format_time($time - $duedate));
545 $classname = 'overdue';
547 $remaining = get_string('duedatereached', 'assign');
550 if ($submission->timemodified > $duedate) {
551 $remaining = get_string('submittedlate',
553 format_time($submission->timemodified - $duedate));
554 $classname = 'latesubmission';
556 $remaining = get_string('submittedearly',
558 format_time($submission->timemodified - $duedate));
559 $classname = 'earlysubmission';
563 $remaining = get_string('paramtimeremaining', 'assign', format_time($duedate - $time));
565 $o .= $this->output->container($remaining, $classname);
568 // Show graders whether this submission is editable by students.
569 if ($status->view == assign_submission_status::GRADER_VIEW) {
570 if ($status->canedit) {
571 $o .= $this->output->container(get_string('submissioneditable', 'assign'), 'submissioneditable');
573 $o .= $this->output->container(get_string('submissionnoteditable', 'assign'), 'submissionnoteditable');
577 // Grading criteria preview.
578 if (!empty($status->gradingcontrollerpreview)) {
579 $o .= $this->output->container($status->gradingcontrollerpreview, 'gradingmethodpreview');
584 if (!$status->teamsubmission || $status->submissiongroup != false || !$status->preventsubmissionnotingroup) {
585 foreach ($status->submissionplugins as $plugin) {
586 $pluginshowsummary = !$plugin->is_empty($submission) || !$plugin->allow_submissions();
587 if ($plugin->is_enabled() &&
588 $plugin->is_visible() &&
589 $plugin->has_user_summary() &&
593 $displaymode = assign_submission_plugin_submission::SUMMARY;
594 $pluginsubmission = new assign_submission_plugin_submission($plugin,
597 $status->coursemoduleid,
598 $status->returnaction,
599 $status->returnparams);
600 $plugincomponent = $plugin->get_subtype() . '_' . $plugin->get_type();
601 $o .= $this->output->container($this->render($pluginsubmission), 'assignsubmission ' . $plugincomponent);
607 $o .= $this->output->container_end();
612 * Render a table containing the current status of the submission.
614 * @param assign_submission_status $status
617 public function render_assign_submission_status(assign_submission_status $status) {
619 $o .= $this->output->container_start('submissionstatustable');
620 $o .= $this->output->heading(get_string('submissionstatusheading', 'assign'), 3);
623 if ($status->allowsubmissionsfromdate &&
624 $time <= $status->allowsubmissionsfromdate) {
625 $o .= $this->output->box_start('generalbox boxaligncenter submissionsalloweddates');
626 if ($status->alwaysshowdescription) {
627 $date = userdate($status->allowsubmissionsfromdate);
628 $o .= get_string('allowsubmissionsfromdatesummary', 'assign', $date);
630 $date = userdate($status->allowsubmissionsfromdate);
631 $o .= get_string('allowsubmissionsanddescriptionfromdatesummary', 'assign', $date);
633 $o .= $this->output->box_end();
635 $o .= $this->output->box_start('boxaligncenter submissionsummarytable');
637 $t = new html_table();
640 if ($status->teamsubmissionenabled) {
641 $row = new html_table_row();
642 $cell1 = new html_table_cell(get_string('submissionteam', 'assign'));
643 $group = $status->submissiongroup;
645 $cell2 = new html_table_cell(format_string($group->name, false, $status->context));
646 } else if ($status->preventsubmissionnotingroup) {
647 if (count($status->usergroups) == 0) {
648 $notification = new \core\output\notification(get_string('noteam', 'assign'), 'error');
649 $notification->set_show_closebutton(false);
650 $cell2 = new html_table_cell(
651 $this->output->render($notification)
653 $warningmsg = $this->output->notification(get_string('noteam_desc', 'assign'), 'error');
654 } else if (count($status->usergroups) > 1) {
655 $notification = new \core\output\notification(get_string('multipleteams', 'assign'), 'error');
656 $notification->set_show_closebutton(false);
657 $cell2 = new html_table_cell(
658 $this->output->render($notification)
660 $warningmsg = $this->output->notification(get_string('multipleteams_desc', 'assign'), 'error');
663 $cell2 = new html_table_cell(get_string('defaultteam', 'assign'));
665 $row->cells = array($cell1, $cell2);
669 if ($status->attemptreopenmethod != ASSIGN_ATTEMPT_REOPEN_METHOD_NONE) {
671 if (!$status->teamsubmissionenabled) {
672 if ($status->submission) {
673 $currentattempt = $status->submission->attemptnumber + 1;
676 if ($status->teamsubmission) {
677 $currentattempt = $status->teamsubmission->attemptnumber + 1;
681 $row = new html_table_row();
682 $cell1 = new html_table_cell(get_string('attemptnumber', 'assign'));
683 $maxattempts = $status->maxattempts;
684 if ($maxattempts == ASSIGN_UNLIMITED_ATTEMPTS) {
685 $message = get_string('currentattempt', 'assign', $currentattempt);
687 $message = get_string('currentattemptof', 'assign', array('attemptnumber'=>$currentattempt,
688 'maxattempts'=>$maxattempts));
690 $cell2 = new html_table_cell($message);
691 $row->cells = array($cell1, $cell2);
695 $row = new html_table_row();
696 $cell1 = new html_table_cell(get_string('submissionstatus', 'assign'));
697 if (!$status->teamsubmissionenabled) {
698 if ($status->submission && $status->submission->status != ASSIGN_SUBMISSION_STATUS_NEW) {
699 $statusstr = get_string('submissionstatus_' . $status->submission->status, 'assign');
700 $cell2 = new html_table_cell($statusstr);
701 $cell2->attributes = array('class'=>'submissionstatus' . $status->submission->status);
703 if (!$status->submissionsenabled) {
704 $cell2 = new html_table_cell(get_string('noonlinesubmissions', 'assign'));
706 $cell2 = new html_table_cell(get_string('noattempt', 'assign'));
709 $row->cells = array($cell1, $cell2);
712 $row = new html_table_row();
713 $cell1 = new html_table_cell(get_string('submissionstatus', 'assign'));
714 $group = $status->submissiongroup;
715 if (!$group && $status->preventsubmissionnotingroup) {
716 $cell2 = new html_table_cell(get_string('nosubmission', 'assign'));
717 } else if ($status->teamsubmission && $status->teamsubmission->status != ASSIGN_SUBMISSION_STATUS_NEW) {
718 $teamstatus = $status->teamsubmission->status;
719 $submissionsummary = get_string('submissionstatus_' . $teamstatus, 'assign');
721 if ($status->submissiongroup) {
722 $groupid = $status->submissiongroup->id;
725 $members = $status->submissiongroupmemberswhoneedtosubmit;
726 $userslist = array();
727 foreach ($members as $member) {
728 $urlparams = array('id' => $member->id, 'course'=>$status->courseid);
729 $url = new moodle_url('/user/view.php', $urlparams);
730 if ($status->view == assign_submission_status::GRADER_VIEW && $status->blindmarking) {
731 $userslist[] = $member->alias;
733 $fullname = fullname($member, $status->canviewfullnames);
734 $userslist[] = $this->output->action_link($url, $fullname);
737 if (count($userslist) > 0) {
738 $userstr = join(', ', $userslist);
739 $formatteduserstr = get_string('userswhoneedtosubmit', 'assign', $userstr);
740 $submissionsummary .= $this->output->container($formatteduserstr);
743 $cell2 = new html_table_cell($submissionsummary);
744 $cell2->attributes = array('class'=>'submissionstatus' . $status->teamsubmission->status);
746 $cell2 = new html_table_cell(get_string('nosubmission', 'assign'));
747 if (!$status->submissionsenabled) {
748 $cell2 = new html_table_cell(get_string('noonlinesubmissions', 'assign'));
750 $cell2 = new html_table_cell(get_string('nosubmission', 'assign'));
753 $row->cells = array($cell1, $cell2);
758 if ($status->locked) {
759 $row = new html_table_row();
760 $cell1 = new html_table_cell();
761 $cell2 = new html_table_cell(get_string('submissionslocked', 'assign'));
762 $cell2->attributes = array('class'=>'submissionlocked');
763 $row->cells = array($cell1, $cell2);
768 $row = new html_table_row();
769 $cell1 = new html_table_cell(get_string('gradingstatus', 'assign'));
771 if ($status->gradingstatus == ASSIGN_GRADING_STATUS_GRADED ||
772 $status->gradingstatus == ASSIGN_GRADING_STATUS_NOT_GRADED) {
773 $cell2 = new html_table_cell(get_string($status->gradingstatus, 'assign'));
775 $gradingstatus = 'markingworkflowstate' . $status->gradingstatus;
776 $cell2 = new html_table_cell(get_string($gradingstatus, 'assign'));
778 if ($status->gradingstatus == ASSIGN_GRADING_STATUS_GRADED ||
779 $status->gradingstatus == ASSIGN_MARKING_WORKFLOW_STATE_RELEASED) {
780 $cell2->attributes = array('class' => 'submissiongraded');
782 $cell2->attributes = array('class' => 'submissionnotgraded');
784 $row->cells = array($cell1, $cell2);
787 $submission = $status->teamsubmission ? $status->teamsubmission : $status->submission;
788 $duedate = $status->duedate;
791 $row = new html_table_row();
792 $cell1 = new html_table_cell(get_string('duedate', 'assign'));
793 $cell2 = new html_table_cell(userdate($duedate));
794 $row->cells = array($cell1, $cell2);
797 if ($status->view == assign_submission_status::GRADER_VIEW) {
798 if ($status->cutoffdate) {
800 $row = new html_table_row();
801 $cell1 = new html_table_cell(get_string('cutoffdate', 'assign'));
802 $cell2 = new html_table_cell(userdate($status->cutoffdate));
803 $row->cells = array($cell1, $cell2);
808 if ($status->extensionduedate) {
810 $row = new html_table_row();
811 $cell1 = new html_table_cell(get_string('extensionduedate', 'assign'));
812 $cell2 = new html_table_cell(userdate($status->extensionduedate));
813 $row->cells = array($cell1, $cell2);
815 $duedate = $status->extensionduedate;
819 $row = new html_table_row();
820 $cell1 = new html_table_cell(get_string('timeremaining', 'assign'));
821 if ($duedate - $time <= 0) {
823 $submission->status != ASSIGN_SUBMISSION_STATUS_SUBMITTED) {
824 if ($status->submissionsenabled) {
825 $overduestr = get_string('overdue', 'assign', format_time($time - $duedate));
826 $cell2 = new html_table_cell($overduestr);
827 $cell2->attributes = array('class'=>'overdue');
829 $cell2 = new html_table_cell(get_string('duedatereached', 'assign'));
832 if ($submission->timemodified > $duedate) {
833 $latestr = get_string('submittedlate',
835 format_time($submission->timemodified - $duedate));
836 $cell2 = new html_table_cell($latestr);
837 $cell2->attributes = array('class'=>'latesubmission');
839 $earlystr = get_string('submittedearly',
841 format_time($submission->timemodified - $duedate));
842 $cell2 = new html_table_cell($earlystr);
843 $cell2->attributes = array('class'=>'earlysubmission');
847 $cell2 = new html_table_cell(format_time($duedate - $time));
849 $row->cells = array($cell1, $cell2);
853 // Show graders whether this submission is editable by students.
854 if ($status->view == assign_submission_status::GRADER_VIEW) {
855 $row = new html_table_row();
856 $cell1 = new html_table_cell(get_string('editingstatus', 'assign'));
857 if ($status->canedit) {
858 $cell2 = new html_table_cell(get_string('submissioneditable', 'assign'));
859 $cell2->attributes = array('class'=>'submissioneditable');
861 $cell2 = new html_table_cell(get_string('submissionnoteditable', 'assign'));
862 $cell2->attributes = array('class'=>'submissionnoteditable');
864 $row->cells = array($cell1, $cell2);
868 // Grading criteria preview.
869 if (!empty($status->gradingcontrollerpreview)) {
870 $row = new html_table_row();
871 $cell1 = new html_table_cell(get_string('gradingmethodpreview', 'assign'));
872 $cell2 = new html_table_cell($status->gradingcontrollerpreview);
873 $row->cells = array($cell1, $cell2);
879 $row = new html_table_row();
880 $cell1 = new html_table_cell(get_string('timemodified', 'assign'));
882 if ($submission->status != ASSIGN_SUBMISSION_STATUS_NEW) {
883 $cell2 = new html_table_cell(userdate($submission->timemodified));
885 $cell2 = new html_table_cell('-');
888 $row->cells = array($cell1, $cell2);
891 if (!$status->teamsubmission || $status->submissiongroup != false || !$status->preventsubmissionnotingroup) {
892 foreach ($status->submissionplugins as $plugin) {
893 $pluginshowsummary = !$plugin->is_empty($submission) || !$plugin->allow_submissions();
894 if ($plugin->is_enabled() &&
895 $plugin->is_visible() &&
896 $plugin->has_user_summary() &&
900 $row = new html_table_row();
901 $cell1 = new html_table_cell($plugin->get_name());
902 $displaymode = assign_submission_plugin_submission::SUMMARY;
903 $pluginsubmission = new assign_submission_plugin_submission($plugin,
906 $status->coursemoduleid,
907 $status->returnaction,
908 $status->returnparams);
909 $cell2 = new html_table_cell($this->render($pluginsubmission));
910 $row->cells = array($cell1, $cell2);
918 $o .= html_writer::table($t);
919 $o .= $this->output->box_end();
922 if ($status->view == assign_submission_status::STUDENT_VIEW) {
923 if ($status->canedit) {
924 if (!$submission || $submission->status == ASSIGN_SUBMISSION_STATUS_NEW) {
925 $o .= $this->output->box_start('generalbox submissionaction');
926 $urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission');
927 $o .= $this->output->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
928 get_string('addsubmission', 'assign'), 'get');
929 $o .= $this->output->box_start('boxaligncenter submithelp');
930 $o .= get_string('addsubmission_help', 'assign');
931 $o .= $this->output->box_end();
932 $o .= $this->output->box_end();
933 } else if ($submission->status == ASSIGN_SUBMISSION_STATUS_REOPENED) {
934 $o .= $this->output->box_start('generalbox submissionaction');
935 $urlparams = array('id' => $status->coursemoduleid,
936 'action' => 'editprevioussubmission',
937 'sesskey'=>sesskey());
938 $o .= $this->output->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
939 get_string('addnewattemptfromprevious', 'assign'), 'get');
940 $o .= $this->output->box_start('boxaligncenter submithelp');
941 $o .= get_string('addnewattemptfromprevious_help', 'assign');
942 $o .= $this->output->box_end();
943 $o .= $this->output->box_end();
944 $o .= $this->output->box_start('generalbox submissionaction');
945 $urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission');
946 $o .= $this->output->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
947 get_string('addnewattempt', 'assign'), 'get');
948 $o .= $this->output->box_start('boxaligncenter submithelp');
949 $o .= get_string('addnewattempt_help', 'assign');
950 $o .= $this->output->box_end();
951 $o .= $this->output->box_end();
953 $o .= $this->output->box_start('generalbox submissionaction');
954 $urlparams = array('id' => $status->coursemoduleid, 'action' => 'editsubmission');
955 $o .= $this->output->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
956 get_string('editsubmission', 'assign'), 'get');
957 $o .= $this->output->box_start('boxaligncenter submithelp');
958 $o .= get_string('editsubmission_help', 'assign');
959 $o .= $this->output->box_end();
960 $o .= $this->output->box_end();
964 if ($status->cansubmit) {
965 $urlparams = array('id' => $status->coursemoduleid, 'action'=>'submit');
966 $o .= $this->output->box_start('generalbox submissionaction');
967 $o .= $this->output->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
968 get_string('submitassignment', 'assign'), 'get');
969 $o .= $this->output->box_start('boxaligncenter submithelp');
970 $o .= get_string('submitassignment_help', 'assign');
971 $o .= $this->output->box_end();
972 $o .= $this->output->box_end();
976 $o .= $this->output->container_end();
981 * Output the attempt history chooser for this assignment
983 * @param assign_attempt_history_chooser $history
986 public function render_assign_attempt_history_chooser(assign_attempt_history_chooser $history) {
989 $context = $history->export_for_template($this);
990 $o .= $this->render_from_template('mod_assign/attempt_history_chooser', $context);
996 * Output the attempt history for this assignment
998 * @param assign_attempt_history $history
1001 public function render_assign_attempt_history(assign_attempt_history $history) {
1004 $submittedstr = get_string('submitted', 'assign');
1005 $gradestr = get_string('grade');
1006 $gradedonstr = get_string('gradedon', 'assign');
1007 $gradedbystr = get_string('gradedby', 'assign');
1009 // Don't show the last one because it is the current submission.
1010 array_pop($history->submissions);
1012 // Show newest to oldest.
1013 $history->submissions = array_reverse($history->submissions);
1015 if (empty($history->submissions)) {
1019 $containerid = 'attempthistory' . uniqid();
1020 $o .= $this->output->heading(get_string('attempthistory', 'assign'), 3);
1021 $o .= $this->box_start('attempthistory', $containerid);
1023 foreach ($history->submissions as $i => $submission) {
1025 foreach ($history->grades as $onegrade) {
1026 if ($onegrade->attemptnumber == $submission->attemptnumber) {
1035 $submissionsummary = userdate($submission->timemodified);
1037 $submissionsummary = get_string('nosubmission', 'assign');
1040 $attemptsummaryparams = array('attemptnumber'=>$submission->attemptnumber+1,
1041 'submissionsummary'=>$submissionsummary);
1042 $o .= $this->heading(get_string('attemptheading', 'assign', $attemptsummaryparams), 4);
1044 $t = new html_table();
1047 $cell1 = new html_table_cell(get_string('submissionstatus', 'assign'));
1048 $cell2 = new html_table_cell(get_string('submissionstatus_' . $submission->status, 'assign'));
1049 $t->data[] = new html_table_row(array($cell1, $cell2));
1051 foreach ($history->submissionplugins as $plugin) {
1052 $pluginshowsummary = !$plugin->is_empty($submission) || !$plugin->allow_submissions();
1053 if ($plugin->is_enabled() &&
1054 $plugin->is_visible() &&
1055 $plugin->has_user_summary() &&
1056 $pluginshowsummary) {
1058 $cell1 = new html_table_cell($plugin->get_name());
1059 $pluginsubmission = new assign_submission_plugin_submission($plugin,
1061 assign_submission_plugin_submission::SUMMARY,
1062 $history->coursemoduleid,
1063 $history->returnaction,
1064 $history->returnparams);
1065 $cell2 = new html_table_cell($this->render($pluginsubmission));
1067 $t->data[] = new html_table_row(array($cell1, $cell2));
1073 // Heading 'feedback'.
1074 $title = get_string('feedback', 'assign', $i);
1075 $title .= $this->output->spacer(array('width'=>10));
1076 if ($history->cangrade) {
1077 // Edit previous feedback.
1078 $returnparams = http_build_query($history->returnparams);
1079 $urlparams = array('id' => $history->coursemoduleid,
1080 'rownum'=>$history->rownum,
1081 'useridlistid'=>$history->useridlistid,
1082 'attemptnumber'=>$grade->attemptnumber,
1084 'returnaction'=>$history->returnaction,
1085 'returnparams'=>$returnparams);
1086 $url = new moodle_url('/mod/assign/view.php', $urlparams);
1087 $icon = new pix_icon('gradefeedback',
1088 get_string('editattemptfeedback', 'assign', $grade->attemptnumber+1),
1090 $title .= $this->output->action_icon($url, $icon);
1092 $cell = new html_table_cell($title);
1093 $cell->attributes['class'] = 'feedbacktitle';
1095 $t->data[] = new html_table_row(array($cell));
1098 $cell1 = new html_table_cell($gradestr);
1099 $cell2 = $grade->gradefordisplay;
1100 $t->data[] = new html_table_row(array($cell1, $cell2));
1103 $cell1 = new html_table_cell($gradedonstr);
1104 $cell2 = new html_table_cell(userdate($grade->timemodified));
1105 $t->data[] = new html_table_row(array($cell1, $cell2));
1108 $cell1 = new html_table_cell($gradedbystr);
1109 $cell2 = new html_table_cell($this->output->user_picture($grade->grader) .
1110 $this->output->spacer(array('width'=>30)) . fullname($grade->grader));
1111 $t->data[] = new html_table_row(array($cell1, $cell2));
1113 // Feedback from plugins.
1114 foreach ($history->feedbackplugins as $plugin) {
1115 if ($plugin->is_enabled() &&
1116 $plugin->is_visible() &&
1117 $plugin->has_user_summary() &&
1118 !$plugin->is_empty($grade)) {
1120 $cell1 = new html_table_cell($plugin->get_name());
1121 $pluginfeedback = new assign_feedback_plugin_feedback(
1122 $plugin, $grade, assign_feedback_plugin_feedback::SUMMARY, $history->coursemoduleid,
1123 $history->returnaction, $history->returnparams
1125 $cell2 = new html_table_cell($this->render($pluginfeedback));
1126 $t->data[] = new html_table_row(array($cell1, $cell2));
1133 $o .= html_writer::table($t);
1135 $o .= $this->box_end();
1136 $jsparams = array($containerid);
1138 $this->page->requires->yui_module('moodle-mod_assign-history', 'Y.one("#' . $containerid . '").history');
1144 * Render a submission plugin submission
1146 * @param assign_submission_plugin_submission $submissionplugin
1149 public function render_assign_submission_plugin_submission(assign_submission_plugin_submission $submissionplugin) {
1152 if ($submissionplugin->view == assign_submission_plugin_submission::SUMMARY) {
1153 $showviewlink = false;
1154 $summary = $submissionplugin->plugin->view_summary($submissionplugin->submission,
1157 $classsuffix = $submissionplugin->plugin->get_subtype() .
1159 $submissionplugin->plugin->get_type() .
1161 $submissionplugin->submission->id;
1163 $o .= $this->output->box_start('boxaligncenter plugincontentsummary summary_' . $classsuffix);
1166 if ($showviewlink) {
1167 $previewstr = get_string('viewsubmission', 'assign');
1168 $icon = $this->output->pix_icon('t/preview', $previewstr);
1170 $expandstr = get_string('viewfull', 'assign');
1171 $options = array('class'=>'expandsummaryicon expand_' . $classsuffix);
1172 $o .= $this->output->pix_icon('t/switch_plus', $expandstr, null, $options);
1174 $jsparams = array($submissionplugin->plugin->get_subtype(),
1175 $submissionplugin->plugin->get_type(),
1176 $submissionplugin->submission->id);
1178 $this->page->requires->js_init_call('M.mod_assign.init_plugin_summary', $jsparams);
1180 $action = 'viewplugin' . $submissionplugin->plugin->get_subtype();
1181 $returnparams = http_build_query($submissionplugin->returnparams);
1182 $link .= '<noscript>';
1183 $urlparams = array('id' => $submissionplugin->coursemoduleid,
1184 'sid'=>$submissionplugin->submission->id,
1185 'plugin'=>$submissionplugin->plugin->get_type(),
1187 'returnaction'=>$submissionplugin->returnaction,
1188 'returnparams'=>$returnparams);
1189 $url = new moodle_url('/mod/assign/view.php', $urlparams);
1190 $link .= $this->output->action_link($url, $icon);
1191 $link .= '</noscript>';
1193 $link .= $this->output->spacer(array('width'=>15));
1196 $o .= $link . $summary;
1197 $o .= $this->output->box_end();
1198 if ($showviewlink) {
1199 $o .= $this->output->box_start('boxaligncenter hidefull full_' . $classsuffix);
1200 $classes = 'expandsummaryicon contract_' . $classsuffix;
1201 $o .= $this->output->pix_icon('t/switch_minus',
1202 get_string('viewsummary', 'assign'),
1204 array('class'=>$classes));
1205 $o .= $submissionplugin->plugin->view($submissionplugin->submission);
1206 $o .= $this->output->box_end();
1208 } else if ($submissionplugin->view == assign_submission_plugin_submission::FULL) {
1209 $o .= $this->output->box_start('boxaligncenter submissionfull');
1210 $o .= $submissionplugin->plugin->view($submissionplugin->submission);
1211 $o .= $this->output->box_end();
1218 * Render the grading table.
1220 * @param assign_grading_table $table
1223 public function render_assign_grading_table(assign_grading_table $table) {
1225 $o .= $this->output->box_start('boxaligncenter gradingtable');
1227 $this->page->requires->js_init_call('M.mod_assign.init_grading_table', array());
1228 $this->page->requires->string_for_js('nousersselected', 'assign');
1229 $this->page->requires->string_for_js('batchoperationconfirmgrantextension', 'assign');
1230 $this->page->requires->string_for_js('batchoperationconfirmlock', 'assign');
1231 $this->page->requires->string_for_js('batchoperationconfirmreverttodraft', 'assign');
1232 $this->page->requires->string_for_js('batchoperationconfirmunlock', 'assign');
1233 $this->page->requires->string_for_js('batchoperationconfirmaddattempt', 'assign');
1234 $this->page->requires->string_for_js('batchoperationconfirmdownloadselected', 'assign');
1235 $this->page->requires->string_for_js('batchoperationconfirmsetmarkingworkflowstate', 'assign');
1236 $this->page->requires->string_for_js('batchoperationconfirmsetmarkingallocation', 'assign');
1237 $this->page->requires->string_for_js('editaction', 'assign');
1238 foreach ($table->plugingradingbatchoperations as $plugin => $operations) {
1239 foreach ($operations as $operation => $description) {
1240 $this->page->requires->string_for_js('batchoperationconfirm' . $operation,
1241 'assignfeedback_' . $plugin);
1244 $o .= $this->flexible_table($table, $table->get_rows_per_page(), true);
1245 $o .= $this->output->box_end();
1251 * Render a feedback plugin feedback
1253 * @param assign_feedback_plugin_feedback $feedbackplugin
1256 public function render_assign_feedback_plugin_feedback(assign_feedback_plugin_feedback $feedbackplugin) {
1259 if ($feedbackplugin->view == assign_feedback_plugin_feedback::SUMMARY) {
1260 $showviewlink = false;
1261 $summary = $feedbackplugin->plugin->view_summary($feedbackplugin->grade, $showviewlink);
1263 $classsuffix = $feedbackplugin->plugin->get_subtype() .
1265 $feedbackplugin->plugin->get_type() .
1267 $feedbackplugin->grade->id;
1268 $o .= $this->output->box_start('boxaligncenter plugincontentsummary summary_' . $classsuffix);
1271 if ($showviewlink) {
1272 $previewstr = get_string('viewfeedback', 'assign');
1273 $icon = $this->output->pix_icon('t/preview', $previewstr);
1275 $expandstr = get_string('viewfull', 'assign');
1276 $options = array('class'=>'expandsummaryicon expand_' . $classsuffix);
1277 $o .= $this->output->pix_icon('t/switch_plus', $expandstr, null, $options);
1279 $jsparams = array($feedbackplugin->plugin->get_subtype(),
1280 $feedbackplugin->plugin->get_type(),
1281 $feedbackplugin->grade->id);
1282 $this->page->requires->js_init_call('M.mod_assign.init_plugin_summary', $jsparams);
1284 $urlparams = array('id' => $feedbackplugin->coursemoduleid,
1285 'gid'=>$feedbackplugin->grade->id,
1286 'plugin'=>$feedbackplugin->plugin->get_type(),
1287 'action'=>'viewplugin' . $feedbackplugin->plugin->get_subtype(),
1288 'returnaction'=>$feedbackplugin->returnaction,
1289 'returnparams'=>http_build_query($feedbackplugin->returnparams));
1290 $url = new moodle_url('/mod/assign/view.php', $urlparams);
1291 $link .= '<noscript>';
1292 $link .= $this->output->action_link($url, $icon);
1293 $link .= '</noscript>';
1295 $link .= $this->output->spacer(array('width'=>15));
1298 $o .= $link . $summary;
1299 $o .= $this->output->box_end();
1300 if ($showviewlink) {
1301 $o .= $this->output->box_start('boxaligncenter hidefull full_' . $classsuffix);
1302 $classes = 'expandsummaryicon contract_' . $classsuffix;
1303 $o .= $this->output->pix_icon('t/switch_minus',
1304 get_string('viewsummary', 'assign'),
1306 array('class'=>$classes));
1307 $o .= $feedbackplugin->plugin->view($feedbackplugin->grade);
1308 $o .= $this->output->box_end();
1310 } else if ($feedbackplugin->view == assign_feedback_plugin_feedback::FULL) {
1311 $o .= $this->output->box_start('boxaligncenter feedbackfull');
1312 $o .= $feedbackplugin->plugin->view($feedbackplugin->grade);
1313 $o .= $this->output->box_end();
1320 * Render a course index summary
1322 * @param assign_course_index_summary $indexsummary
1325 public function render_assign_course_index_summary(assign_course_index_summary $indexsummary) {
1328 $strplural = get_string('modulenameplural', 'assign');
1329 $strsectionname = $indexsummary->courseformatname;
1330 $strduedate = get_string('duedate', 'assign');
1331 $strsubmission = get_string('submission', 'assign');
1332 $strgrade = get_string('grade');
1334 $table = new html_table();
1335 if ($indexsummary->usesections) {
1336 $table->head = array ($strsectionname, $strplural, $strduedate, $strsubmission, $strgrade);
1337 $table->align = array ('left', 'left', 'center', 'right', 'right');
1339 $table->head = array ($strplural, $strduedate, $strsubmission, $strgrade);
1340 $table->align = array ('left', 'left', 'center', 'right');
1342 $table->data = array();
1344 $currentsection = '';
1345 foreach ($indexsummary->assignments as $info) {
1346 $params = array('id' => $info['cmid']);
1347 $link = html_writer::link(new moodle_url('/mod/assign/view.php', $params),
1349 $due = $info['timedue'] ? userdate($info['timedue']) : '-';
1352 if ($indexsummary->usesections) {
1353 if ($info['sectionname'] !== $currentsection) {
1354 if ($info['sectionname']) {
1355 $printsection = $info['sectionname'];
1357 if ($currentsection !== '') {
1358 $table->data[] = 'hr';
1360 $currentsection = $info['sectionname'];
1364 if ($indexsummary->usesections) {
1365 $row = array($printsection, $link, $due, $info['submissioninfo'], $info['gradeinfo']);
1367 $row = array($link, $due, $info['submissioninfo'], $info['gradeinfo']);
1369 $table->data[] = $row;
1372 $o .= html_writer::table($table);
1380 * Internal function - creates htmls structure suitable for YUI tree.
1382 * @param assign_files $tree
1386 protected function htmllize_tree(assign_files $tree, $dir) {
1388 $yuiconfig = array();
1389 $yuiconfig['type'] = 'html';
1391 if (empty($dir['subdirs']) and empty($dir['files'])) {
1396 foreach ($dir['subdirs'] as $subdir) {
1397 $image = $this->output->pix_icon(file_folder_icon(),
1400 array('class'=>'icon'));
1401 $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'>' .
1402 '<div>' . $image . ' ' . s($subdir['dirname']) . '</div> ' .
1403 $this->htmllize_tree($tree, $subdir) .
1407 foreach ($dir['files'] as $file) {
1408 $filename = $file->get_filename();
1409 if ($CFG->enableplagiarism) {
1410 require_once($CFG->libdir.'/plagiarismlib.php');
1411 $plagiarismlinks = plagiarism_get_links(array('userid'=>$file->get_userid(),
1413 'cmid'=>$tree->cm->id,
1414 'course'=>$tree->course));
1416 $plagiarismlinks = '';
1418 $image = $this->output->pix_icon(file_file_icon($file),
1421 array('class'=>'icon'));
1422 $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'>' .
1423 '<div>' . $image . ' ' .
1424 $file->fileurl . ' ' .
1425 $plagiarismlinks . ' ' .
1426 $file->portfoliobutton . '</div>' .
1436 * Helper method dealing with the fact we can not just fetch the output of flexible_table
1438 * @param flexible_table $table The table to render
1439 * @param int $rowsperpage How many assignments to render in a page
1440 * @param bool $displaylinks - Whether to render links in the table
1441 * (e.g. downloads would not enable this)
1442 * @return string HTML
1444 protected function flexible_table(flexible_table $table, $rowsperpage, $displaylinks) {
1448 $table->out($rowsperpage, $displaylinks);
1449 $o = ob_get_contents();
1456 * Helper method dealing with the fact we can not just fetch the output of moodleforms
1458 * @param moodleform $mform
1459 * @return string HTML
1461 protected function moodleform(moodleform $mform) {
1466 $o = ob_get_contents();
1473 * Defer to template..
1475 * @param grading_app $app - All the data to render the grading app.
1477 public function render_grading_app(grading_app $app) {
1478 $context = $app->export_for_template($this);
1479 return $this->render_from_template('mod_assign/grading_app', $context);