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('confirmsubmissionheading', 'assign'), 3);
183 $cancelurl = new moodle_url('/mod/assign/view.php', array('id' => $page->coursemoduleid
));
184 if (count($page->notifications
)) {
185 // At least one of the submission plugins is not ready for submission.
187 $o .= $this->output
->heading(get_string('submissionnotready', 'assign'), 4);
189 foreach ($page->notifications
as $notification) {
190 $o .= $this->output
->notification($notification);
193 $o .= $this->output
->continue_button($cancelurl);
195 // All submission plugins ready - show the confirmation form.
196 $o .= $this->moodleform($page->confirmform
);
198 $o .= $this->output
->container_end();
204 * Page is done - render the footer.
208 public function render_footer() {
209 return $this->output
->footer();
215 * @param assign_header $header
218 public function render_assign_header(assign_header
$header) {
221 if ($header->subpage
) {
222 $this->page
->navbar
->add($header->subpage
);
225 $this->page
->set_title(get_string('pluginname', 'assign'));
226 $this->page
->set_heading($this->page
->course
->fullname
);
228 $o .= $this->output
->header();
229 $heading = format_string($header->assign
->name
, false, array('context' => $header->context
));
230 $o .= $this->output
->heading($heading);
231 if ($header->preface
) {
232 $o .= $header->preface
;
235 if ($header->showintro
) {
236 $o .= $this->output
->box_start('generalbox boxaligncenter', 'intro');
237 $o .= format_module_intro('assign', $header->assign
, $header->coursemoduleid
);
238 $o .= $header->postfix
;
239 $o .= $this->output
->box_end();
246 * Render the header for an individual plugin.
248 * @param assign_plugin_header $header
251 public function render_assign_plugin_header(assign_plugin_header
$header) {
252 $o = $header->plugin
->view_header();
257 * Render a table containing the current status of the grading process.
259 * @param assign_grading_summary $summary
262 public function render_assign_grading_summary(assign_grading_summary
$summary) {
263 // Create a table for the data.
265 $o .= $this->output
->container_start('gradingsummary');
266 $o .= $this->output
->heading(get_string('gradingsummary', 'assign'), 3);
267 $o .= $this->output
->box_start('boxaligncenter gradingsummarytable');
268 $t = new html_table();
270 // Visibility Status.
271 $this->add_table_row_tuple($t, get_string('hiddenfromstudents'),
272 (!$summary->isvisible
) ?
get_string('yes') : get_string('no'));
275 if ($summary->teamsubmission
) {
276 if ($summary->warnofungroupedusers
) {
277 $o .= $this->output
->notification(get_string('ungroupedusers', 'assign'));
280 $this->add_table_row_tuple($t, get_string('numberofteams', 'assign'),
281 $summary->participantcount
);
283 $this->add_table_row_tuple($t, get_string('numberofparticipants', 'assign'),
284 $summary->participantcount
);
287 // Drafts count and dont show drafts count when using offline assignment.
288 if ($summary->submissiondraftsenabled
&& $summary->submissionsenabled
) {
289 $this->add_table_row_tuple($t, get_string('numberofdraftsubmissions', 'assign'),
290 $summary->submissiondraftscount
);
293 // Submitted for grading.
294 if ($summary->submissionsenabled
) {
295 $this->add_table_row_tuple($t, get_string('numberofsubmittedassignments', 'assign'),
296 $summary->submissionssubmittedcount
);
297 if (!$summary->teamsubmission
) {
298 $this->add_table_row_tuple($t, get_string('numberofsubmissionsneedgrading', 'assign'),
299 $summary->submissionsneedgradingcount
);
304 if ($summary->duedate
) {
306 $duedate = $summary->duedate
;
307 $this->add_table_row_tuple($t, get_string('duedate', 'assign'),
312 if ($duedate - $time <= 0) {
313 $due = get_string('assignmentisdue', 'assign');
315 $due = format_time($duedate - $time);
317 $this->add_table_row_tuple($t, get_string('timeremaining', 'assign'), $due);
319 if ($duedate < $time) {
320 $cutoffdate = $summary->cutoffdate
;
322 if ($cutoffdate > $time) {
323 $late = get_string('latesubmissionsaccepted', 'assign', userdate($summary->cutoffdate
));
325 $late = get_string('nomoresubmissionsaccepted', 'assign');
327 $this->add_table_row_tuple($t, get_string('latesubmissions', 'assign'), $late);
333 // All done - write the table.
334 $o .= html_writer
::table($t);
335 $o .= $this->output
->box_end();
337 // Link to the grading page.
339 $o .= $this->output
->container_start('submissionlinks');
340 $urlparams = array('id' => $summary->coursemoduleid
, 'action' => 'grading');
341 $url = new moodle_url('/mod/assign/view.php', $urlparams);
342 $o .= '<a href="' . $url . '" class="btn btn-secondary">' . get_string('viewgrading', 'mod_assign') . '</a> ';
343 if ($summary->cangrade
) {
344 $urlparams = array('id' => $summary->coursemoduleid
, 'action' => 'grader');
345 $url = new moodle_url('/mod/assign/view.php', $urlparams);
346 $o .= '<a href="' . $url . '" class="btn btn-primary">' . get_string('grade') . '</a>';
348 $o .= $this->output
->container_end();
350 // Close the container and insert a spacer.
351 $o .= $this->output
->container_end();
358 * Render a table containing all the current grades and feedback.
360 * @param assign_feedback_status $status
363 public function render_assign_feedback_status(assign_feedback_status
$status) {
367 $o .= $this->output
->container_start('feedback');
368 $o .= $this->output
->heading(get_string('feedback', 'assign'), 3);
369 $o .= $this->output
->box_start('boxaligncenter feedbacktable');
370 $t = new html_table();
373 if (isset($status->gradefordisplay
)) {
374 $row = new html_table_row();
375 $cell1 = new html_table_cell(get_string('grade'));
376 $cell2 = new html_table_cell($status->gradefordisplay
);
377 $row->cells
= array($cell1, $cell2);
381 $row = new html_table_row();
382 $cell1 = new html_table_cell(get_string('gradedon', 'assign'));
383 $cell2 = new html_table_cell(userdate($status->gradeddate
));
384 $row->cells
= array($cell1, $cell2);
388 if ($status->grader
) {
390 $row = new html_table_row();
391 $cell1 = new html_table_cell(get_string('gradedby', 'assign'));
392 $userdescription = $this->output
->user_picture($status->grader
) .
393 $this->output
->spacer(array('width'=>30)) .
394 fullname($status->grader
, $status->canviewfullnames
);
395 $cell2 = new html_table_cell($userdescription);
396 $row->cells
= array($cell1, $cell2);
400 foreach ($status->feedbackplugins
as $plugin) {
401 if ($plugin->is_enabled() &&
402 $plugin->is_visible() &&
403 $plugin->has_user_summary() &&
404 !empty($status->grade
) &&
405 !$plugin->is_empty($status->grade
)) {
407 $row = new html_table_row();
408 $cell1 = new html_table_cell($plugin->get_name());
409 $displaymode = assign_feedback_plugin_feedback
::SUMMARY
;
410 $pluginfeedback = new assign_feedback_plugin_feedback($plugin,
413 $status->coursemoduleid
,
414 $status->returnaction
,
415 $status->returnparams
);
416 $cell2 = new html_table_cell($this->render($pluginfeedback));
417 $row->cells
= array($cell1, $cell2);
422 $o .= html_writer
::table($t);
423 $o .= $this->output
->box_end();
425 $o .= $this->output
->container_end();
430 * Render a compact view of the current status of the submission.
432 * @param assign_submission_status_compact $status
435 public function render_assign_submission_status_compact(assign_submission_status_compact
$status) {
437 $o .= $this->output
->container_start('submissionstatustable');
438 $o .= $this->output
->heading(get_string('submission', 'assign'), 3);
441 if ($status->teamsubmissionenabled
) {
442 $group = $status->submissiongroup
;
444 $team = format_string($group->name
, false, $status->context
);
445 } else if ($status->preventsubmissionnotingroup
) {
446 if (count($status->usergroups
) == 0) {
447 $team = '<span class="alert alert-error">' . get_string('noteam', 'assign') . '</span>';
448 } else if (count($status->usergroups
) > 1) {
449 $team = '<span class="alert alert-error">' . get_string('multipleteams', 'assign') . '</span>';
452 $team = get_string('defaultteam', 'assign');
454 $o .= $this->output
->container(get_string('teamname', 'assign', $team), 'teamname');
457 if (!$status->teamsubmissionenabled
) {
458 if ($status->submission
&& $status->submission
->status
!= ASSIGN_SUBMISSION_STATUS_NEW
) {
459 $statusstr = get_string('submissionstatus_' . $status->submission
->status
, 'assign');
460 $o .= $this->output
->container($statusstr, 'submissionstatus' . $status->submission
->status
);
462 if (!$status->submissionsenabled
) {
463 $o .= $this->output
->container(get_string('noonlinesubmissions', 'assign'), 'submissionstatus');
465 $o .= $this->output
->container(get_string('noattempt', 'assign'), 'submissionstatus');
469 $group = $status->submissiongroup
;
470 if (!$group && $status->preventsubmissionnotingroup
) {
471 $o .= $this->output
->container(get_string('nosubmission', 'assign'), 'submissionstatus');
472 } else if ($status->teamsubmission
&& $status->teamsubmission
->status
!= ASSIGN_SUBMISSION_STATUS_NEW
) {
473 $teamstatus = $status->teamsubmission
->status
;
474 $submissionsummary = get_string('submissionstatus_' . $teamstatus, 'assign');
476 if ($status->submissiongroup
) {
477 $groupid = $status->submissiongroup
->id
;
480 $members = $status->submissiongroupmemberswhoneedtosubmit
;
481 $userslist = array();
482 foreach ($members as $member) {
483 $urlparams = array('id' => $member->id
, 'course' => $status->courseid
);
484 $url = new moodle_url('/user/view.php', $urlparams);
485 if ($status->view
== assign_submission_status
::GRADER_VIEW
&& $status->blindmarking
) {
486 $userslist[] = $member->alias
;
488 $fullname = fullname($member, $status->canviewfullnames
);
489 $userslist[] = $this->output
->action_link($url, $fullname);
492 if (count($userslist) > 0) {
493 $userstr = join(', ', $userslist);
494 $formatteduserstr = get_string('userswhoneedtosubmit', 'assign', $userstr);
495 $submissionsummary .= $this->output
->container($formatteduserstr);
497 $o .= $this->output
->container($submissionsummary, 'submissionstatus' . $status->teamsubmission
->status
);
499 if (!$status->submissionsenabled
) {
500 $o .= $this->output
->container(get_string('noonlinesubmissions', 'assign'), 'submissionstatus');
502 $o .= $this->output
->container(get_string('nosubmission', 'assign'), 'submissionstatus');
508 if ($status->locked
) {
509 $o .= $this->output
->container(get_string('submissionslocked', 'assign'), 'submissionlocked');
514 $classname = 'gradingstatus';
515 if ($status->gradingstatus
== ASSIGN_GRADING_STATUS_GRADED ||
516 $status->gradingstatus
== ASSIGN_GRADING_STATUS_NOT_GRADED
) {
517 $statusstr = get_string($status->gradingstatus
, 'assign');
519 $gradingstatus = 'markingworkflowstate' . $status->gradingstatus
;
520 $statusstr = get_string($gradingstatus, 'assign');
522 if ($status->gradingstatus
== ASSIGN_GRADING_STATUS_GRADED ||
523 $status->gradingstatus
== ASSIGN_MARKING_WORKFLOW_STATE_RELEASED
) {
524 $classname = 'submissiongraded';
526 $classname = 'submissionnotgraded';
528 $o .= $this->output
->container($statusstr, $classname);
530 $submission = $status->teamsubmission ?
$status->teamsubmission
: $status->submission
;
531 $duedate = $status->duedate
;
534 if ($status->extensionduedate
) {
536 $duedate = $status->extensionduedate
;
540 $classname = 'timeremaining';
541 if ($duedate - $time <= 0) {
543 $submission->status
!= ASSIGN_SUBMISSION_STATUS_SUBMITTED
) {
544 if ($status->submissionsenabled
) {
545 $remaining = get_string('overdue', 'assign', format_time($time - $duedate));
546 $classname = 'overdue';
548 $remaining = get_string('duedatereached', 'assign');
551 if ($submission->timemodified
> $duedate) {
552 $remaining = get_string('submittedlate',
554 format_time($submission->timemodified
- $duedate));
555 $classname = 'latesubmission';
557 $remaining = get_string('submittedearly',
559 format_time($submission->timemodified
- $duedate));
560 $classname = 'earlysubmission';
564 $remaining = get_string('paramtimeremaining', 'assign', format_time($duedate - $time));
566 $o .= $this->output
->container($remaining, $classname);
569 // Show graders whether this submission is editable by students.
570 if ($status->view
== assign_submission_status
::GRADER_VIEW
) {
571 if ($status->canedit
) {
572 $o .= $this->output
->container(get_string('submissioneditable', 'assign'), 'submissioneditable');
574 $o .= $this->output
->container(get_string('submissionnoteditable', 'assign'), 'submissionnoteditable');
578 // Grading criteria preview.
579 if (!empty($status->gradingcontrollerpreview
)) {
580 $o .= $this->output
->container($status->gradingcontrollerpreview
, 'gradingmethodpreview');
585 if (!$status->teamsubmission ||
$status->submissiongroup
!= false ||
!$status->preventsubmissionnotingroup
) {
586 foreach ($status->submissionplugins
as $plugin) {
587 $pluginshowsummary = !$plugin->is_empty($submission) ||
!$plugin->allow_submissions();
588 if ($plugin->is_enabled() &&
589 $plugin->is_visible() &&
590 $plugin->has_user_summary() &&
594 $displaymode = assign_submission_plugin_submission
::SUMMARY
;
595 $pluginsubmission = new assign_submission_plugin_submission($plugin,
598 $status->coursemoduleid
,
599 $status->returnaction
,
600 $status->returnparams
);
601 $plugincomponent = $plugin->get_subtype() . '_' . $plugin->get_type();
602 $o .= $this->output
->container($this->render($pluginsubmission), 'assignsubmission ' . $plugincomponent);
608 $o .= $this->output
->container_end();
613 * Render a table containing the current status of the submission.
615 * @param assign_submission_status $status
618 public function render_assign_submission_status(assign_submission_status
$status) {
620 $o .= $this->output
->container_start('submissionstatustable');
621 $o .= $this->output
->heading(get_string('submissionstatusheading', 'assign'), 3);
624 if ($status->allowsubmissionsfromdate
&&
625 $time <= $status->allowsubmissionsfromdate
) {
626 $o .= $this->output
->box_start('generalbox boxaligncenter submissionsalloweddates');
627 if ($status->alwaysshowdescription
) {
628 $date = userdate($status->allowsubmissionsfromdate
);
629 $o .= get_string('allowsubmissionsfromdatesummary', 'assign', $date);
631 $date = userdate($status->allowsubmissionsfromdate
);
632 $o .= get_string('allowsubmissionsanddescriptionfromdatesummary', 'assign', $date);
634 $o .= $this->output
->box_end();
636 $o .= $this->output
->box_start('boxaligncenter submissionsummarytable');
638 $t = new html_table();
641 if ($status->teamsubmissionenabled
) {
642 $row = new html_table_row();
643 $cell1 = new html_table_cell(get_string('submissionteam', 'assign'));
644 $group = $status->submissiongroup
;
646 $cell2 = new html_table_cell(format_string($group->name
, false, $status->context
));
647 } else if ($status->preventsubmissionnotingroup
) {
648 if (count($status->usergroups
) == 0) {
649 $notification = new \core\output\notification
(get_string('noteam', 'assign'), 'error');
650 $notification->set_show_closebutton(false);
651 $cell2 = new html_table_cell(
652 $this->output
->render($notification)
654 $warningmsg = $this->output
->notification(get_string('noteam_desc', 'assign'), 'error');
655 } else if (count($status->usergroups
) > 1) {
656 $notification = new \core\output\notification
(get_string('multipleteams', 'assign'), 'error');
657 $notification->set_show_closebutton(false);
658 $cell2 = new html_table_cell(
659 $this->output
->render($notification)
661 $warningmsg = $this->output
->notification(get_string('multipleteams_desc', 'assign'), 'error');
664 $cell2 = new html_table_cell(get_string('defaultteam', 'assign'));
666 $row->cells
= array($cell1, $cell2);
670 if ($status->attemptreopenmethod
!= ASSIGN_ATTEMPT_REOPEN_METHOD_NONE
) {
672 if (!$status->teamsubmissionenabled
) {
673 if ($status->submission
) {
674 $currentattempt = $status->submission
->attemptnumber +
1;
677 if ($status->teamsubmission
) {
678 $currentattempt = $status->teamsubmission
->attemptnumber +
1;
682 $row = new html_table_row();
683 $cell1 = new html_table_cell(get_string('attemptnumber', 'assign'));
684 $maxattempts = $status->maxattempts
;
685 if ($maxattempts == ASSIGN_UNLIMITED_ATTEMPTS
) {
686 $message = get_string('currentattempt', 'assign', $currentattempt);
688 $message = get_string('currentattemptof', 'assign', array('attemptnumber'=>$currentattempt,
689 'maxattempts'=>$maxattempts));
691 $cell2 = new html_table_cell($message);
692 $row->cells
= array($cell1, $cell2);
696 $row = new html_table_row();
697 $cell1 = new html_table_cell(get_string('submissionstatus', 'assign'));
698 if (!$status->teamsubmissionenabled
) {
699 if ($status->submission
&& $status->submission
->status
!= ASSIGN_SUBMISSION_STATUS_NEW
) {
700 $statusstr = get_string('submissionstatus_' . $status->submission
->status
, 'assign');
701 $cell2 = new html_table_cell($statusstr);
702 $cell2->attributes
= array('class'=>'submissionstatus' . $status->submission
->status
);
704 if (!$status->submissionsenabled
) {
705 $cell2 = new html_table_cell(get_string('noonlinesubmissions', 'assign'));
707 $cell2 = new html_table_cell(get_string('noattempt', 'assign'));
710 $row->cells
= array($cell1, $cell2);
713 $row = new html_table_row();
714 $cell1 = new html_table_cell(get_string('submissionstatus', 'assign'));
715 $group = $status->submissiongroup
;
716 if (!$group && $status->preventsubmissionnotingroup
) {
717 $cell2 = new html_table_cell(get_string('nosubmission', 'assign'));
718 } else if ($status->teamsubmission
&& $status->teamsubmission
->status
!= ASSIGN_SUBMISSION_STATUS_NEW
) {
719 $teamstatus = $status->teamsubmission
->status
;
720 $submissionsummary = get_string('submissionstatus_' . $teamstatus, 'assign');
722 if ($status->submissiongroup
) {
723 $groupid = $status->submissiongroup
->id
;
726 $members = $status->submissiongroupmemberswhoneedtosubmit
;
727 $userslist = array();
728 foreach ($members as $member) {
729 $urlparams = array('id' => $member->id
, 'course'=>$status->courseid
);
730 $url = new moodle_url('/user/view.php', $urlparams);
731 if ($status->view
== assign_submission_status
::GRADER_VIEW
&& $status->blindmarking
) {
732 $userslist[] = $member->alias
;
734 $fullname = fullname($member, $status->canviewfullnames
);
735 $userslist[] = $this->output
->action_link($url, $fullname);
738 if (count($userslist) > 0) {
739 $userstr = join(', ', $userslist);
740 $formatteduserstr = get_string('userswhoneedtosubmit', 'assign', $userstr);
741 $submissionsummary .= $this->output
->container($formatteduserstr);
744 $cell2 = new html_table_cell($submissionsummary);
745 $cell2->attributes
= array('class'=>'submissionstatus' . $status->teamsubmission
->status
);
747 $cell2 = new html_table_cell(get_string('nosubmission', 'assign'));
748 if (!$status->submissionsenabled
) {
749 $cell2 = new html_table_cell(get_string('noonlinesubmissions', 'assign'));
751 $cell2 = new html_table_cell(get_string('nosubmission', 'assign'));
754 $row->cells
= array($cell1, $cell2);
759 if ($status->locked
) {
760 $row = new html_table_row();
761 $cell1 = new html_table_cell();
762 $cell2 = new html_table_cell(get_string('submissionslocked', 'assign'));
763 $cell2->attributes
= array('class'=>'submissionlocked');
764 $row->cells
= array($cell1, $cell2);
769 $row = new html_table_row();
770 $cell1 = new html_table_cell(get_string('gradingstatus', 'assign'));
772 if ($status->gradingstatus
== ASSIGN_GRADING_STATUS_GRADED ||
773 $status->gradingstatus
== ASSIGN_GRADING_STATUS_NOT_GRADED
) {
774 $cell2 = new html_table_cell(get_string($status->gradingstatus
, 'assign'));
776 $gradingstatus = 'markingworkflowstate' . $status->gradingstatus
;
777 $cell2 = new html_table_cell(get_string($gradingstatus, 'assign'));
779 if ($status->gradingstatus
== ASSIGN_GRADING_STATUS_GRADED ||
780 $status->gradingstatus
== ASSIGN_MARKING_WORKFLOW_STATE_RELEASED
) {
781 $cell2->attributes
= array('class' => 'submissiongraded');
783 $cell2->attributes
= array('class' => 'submissionnotgraded');
785 $row->cells
= array($cell1, $cell2);
788 $submission = $status->teamsubmission ?
$status->teamsubmission
: $status->submission
;
789 $duedate = $status->duedate
;
792 $row = new html_table_row();
793 $cell1 = new html_table_cell(get_string('duedate', 'assign'));
794 $cell2 = new html_table_cell(userdate($duedate));
795 $row->cells
= array($cell1, $cell2);
798 if ($status->view
== assign_submission_status
::GRADER_VIEW
) {
799 if ($status->cutoffdate
) {
801 $row = new html_table_row();
802 $cell1 = new html_table_cell(get_string('cutoffdate', 'assign'));
803 $cell2 = new html_table_cell(userdate($status->cutoffdate
));
804 $row->cells
= array($cell1, $cell2);
809 if ($status->extensionduedate
) {
811 $row = new html_table_row();
812 $cell1 = new html_table_cell(get_string('extensionduedate', 'assign'));
813 $cell2 = new html_table_cell(userdate($status->extensionduedate
));
814 $row->cells
= array($cell1, $cell2);
816 $duedate = $status->extensionduedate
;
820 $row = new html_table_row();
821 $cell1 = new html_table_cell(get_string('timeremaining', 'assign'));
822 if ($duedate - $time <= 0) {
824 $submission->status
!= ASSIGN_SUBMISSION_STATUS_SUBMITTED
) {
825 if ($status->submissionsenabled
) {
826 $overduestr = get_string('overdue', 'assign', format_time($time - $duedate));
827 $cell2 = new html_table_cell($overduestr);
828 $cell2->attributes
= array('class'=>'overdue');
830 $cell2 = new html_table_cell(get_string('duedatereached', 'assign'));
833 if ($submission->timemodified
> $duedate) {
834 $latestr = get_string('submittedlate',
836 format_time($submission->timemodified
- $duedate));
837 $cell2 = new html_table_cell($latestr);
838 $cell2->attributes
= array('class'=>'latesubmission');
840 $earlystr = get_string('submittedearly',
842 format_time($submission->timemodified
- $duedate));
843 $cell2 = new html_table_cell($earlystr);
844 $cell2->attributes
= array('class'=>'earlysubmission');
848 $cell2 = new html_table_cell(format_time($duedate - $time));
850 $row->cells
= array($cell1, $cell2);
854 // Show graders whether this submission is editable by students.
855 if ($status->view
== assign_submission_status
::GRADER_VIEW
) {
856 $row = new html_table_row();
857 $cell1 = new html_table_cell(get_string('editingstatus', 'assign'));
858 if ($status->canedit
) {
859 $cell2 = new html_table_cell(get_string('submissioneditable', 'assign'));
860 $cell2->attributes
= array('class'=>'submissioneditable');
862 $cell2 = new html_table_cell(get_string('submissionnoteditable', 'assign'));
863 $cell2->attributes
= array('class'=>'submissionnoteditable');
865 $row->cells
= array($cell1, $cell2);
869 // Grading criteria preview.
870 if (!empty($status->gradingcontrollerpreview
)) {
871 $row = new html_table_row();
872 $cell1 = new html_table_cell(get_string('gradingmethodpreview', 'assign'));
873 $cell2 = new html_table_cell($status->gradingcontrollerpreview
);
874 $row->cells
= array($cell1, $cell2);
880 $row = new html_table_row();
881 $cell1 = new html_table_cell(get_string('timemodified', 'assign'));
883 if ($submission->status
!= ASSIGN_SUBMISSION_STATUS_NEW
) {
884 $cell2 = new html_table_cell(userdate($submission->timemodified
));
886 $cell2 = new html_table_cell('-');
889 $row->cells
= array($cell1, $cell2);
892 if (!$status->teamsubmission ||
$status->submissiongroup
!= false ||
!$status->preventsubmissionnotingroup
) {
893 foreach ($status->submissionplugins
as $plugin) {
894 $pluginshowsummary = !$plugin->is_empty($submission) ||
!$plugin->allow_submissions();
895 if ($plugin->is_enabled() &&
896 $plugin->is_visible() &&
897 $plugin->has_user_summary() &&
901 $row = new html_table_row();
902 $cell1 = new html_table_cell($plugin->get_name());
903 $displaymode = assign_submission_plugin_submission
::SUMMARY
;
904 $pluginsubmission = new assign_submission_plugin_submission($plugin,
907 $status->coursemoduleid
,
908 $status->returnaction
,
909 $status->returnparams
);
910 $cell2 = new html_table_cell($this->render($pluginsubmission));
911 $row->cells
= array($cell1, $cell2);
919 $o .= html_writer
::table($t);
920 $o .= $this->output
->box_end();
923 if ($status->view
== assign_submission_status
::STUDENT_VIEW
) {
924 if ($status->canedit
) {
925 if (!$submission ||
$submission->status
== ASSIGN_SUBMISSION_STATUS_NEW
) {
926 $o .= $this->output
->box_start('generalbox submissionaction');
927 $urlparams = array('id' => $status->coursemoduleid
, 'action' => 'editsubmission');
928 $o .= $this->output
->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
929 get_string('addsubmission', 'assign'), 'get');
930 $o .= $this->output
->box_start('boxaligncenter submithelp');
931 $o .= get_string('addsubmission_help', 'assign');
932 $o .= $this->output
->box_end();
933 $o .= $this->output
->box_end();
934 } else if ($submission->status
== ASSIGN_SUBMISSION_STATUS_REOPENED
) {
935 $o .= $this->output
->box_start('generalbox submissionaction');
936 $urlparams = array('id' => $status->coursemoduleid
,
937 'action' => 'editprevioussubmission',
938 'sesskey'=>sesskey());
939 $o .= $this->output
->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
940 get_string('addnewattemptfromprevious', 'assign'), 'get');
941 $o .= $this->output
->box_start('boxaligncenter submithelp');
942 $o .= get_string('addnewattemptfromprevious_help', 'assign');
943 $o .= $this->output
->box_end();
944 $o .= $this->output
->box_end();
945 $o .= $this->output
->box_start('generalbox submissionaction');
946 $urlparams = array('id' => $status->coursemoduleid
, 'action' => 'editsubmission');
947 $o .= $this->output
->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
948 get_string('addnewattempt', 'assign'), 'get');
949 $o .= $this->output
->box_start('boxaligncenter submithelp');
950 $o .= get_string('addnewattempt_help', 'assign');
951 $o .= $this->output
->box_end();
952 $o .= $this->output
->box_end();
954 $o .= $this->output
->box_start('generalbox submissionaction');
955 $urlparams = array('id' => $status->coursemoduleid
, 'action' => 'editsubmission');
956 $o .= $this->output
->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
957 get_string('editsubmission', 'assign'), 'get');
958 $o .= $this->output
->box_start('boxaligncenter submithelp');
959 $o .= get_string('editsubmission_help', 'assign');
960 $o .= $this->output
->box_end();
961 $o .= $this->output
->box_end();
965 if ($status->cansubmit
) {
966 $urlparams = array('id' => $status->coursemoduleid
, 'action'=>'submit');
967 $o .= $this->output
->box_start('generalbox submissionaction');
968 $o .= $this->output
->single_button(new moodle_url('/mod/assign/view.php', $urlparams),
969 get_string('submitassignment', 'assign'), 'get');
970 $o .= $this->output
->box_start('boxaligncenter submithelp');
971 $o .= get_string('submitassignment_help', 'assign');
972 $o .= $this->output
->box_end();
973 $o .= $this->output
->box_end();
977 $o .= $this->output
->container_end();
982 * Output the attempt history chooser for this assignment
984 * @param assign_attempt_history_chooser $history
987 public function render_assign_attempt_history_chooser(assign_attempt_history_chooser
$history) {
990 $context = $history->export_for_template($this);
991 $o .= $this->render_from_template('mod_assign/attempt_history_chooser', $context);
997 * Output the attempt history for this assignment
999 * @param assign_attempt_history $history
1002 public function render_assign_attempt_history(assign_attempt_history
$history) {
1005 $submittedstr = get_string('submitted', 'assign');
1006 $gradestr = get_string('grade');
1007 $gradedonstr = get_string('gradedon', 'assign');
1008 $gradedbystr = get_string('gradedby', 'assign');
1010 // Don't show the last one because it is the current submission.
1011 array_pop($history->submissions
);
1013 // Show newest to oldest.
1014 $history->submissions
= array_reverse($history->submissions
);
1016 if (empty($history->submissions
)) {
1020 $containerid = 'attempthistory' . uniqid();
1021 $o .= $this->output
->heading(get_string('attempthistory', 'assign'), 3);
1022 $o .= $this->box_start('attempthistory', $containerid);
1024 foreach ($history->submissions
as $i => $submission) {
1026 foreach ($history->grades
as $onegrade) {
1027 if ($onegrade->attemptnumber
== $submission->attemptnumber
) {
1036 $submissionsummary = userdate($submission->timemodified
);
1038 $submissionsummary = get_string('nosubmission', 'assign');
1041 $attemptsummaryparams = array('attemptnumber'=>$submission->attemptnumber+
1,
1042 'submissionsummary'=>$submissionsummary);
1043 $o .= $this->heading(get_string('attemptheading', 'assign', $attemptsummaryparams), 4);
1045 $t = new html_table();
1048 $cell1 = new html_table_cell(get_string('submissionstatus', 'assign'));
1049 $cell2 = new html_table_cell(get_string('submissionstatus_' . $submission->status
, 'assign'));
1050 $t->data
[] = new html_table_row(array($cell1, $cell2));
1052 foreach ($history->submissionplugins
as $plugin) {
1053 $pluginshowsummary = !$plugin->is_empty($submission) ||
!$plugin->allow_submissions();
1054 if ($plugin->is_enabled() &&
1055 $plugin->is_visible() &&
1056 $plugin->has_user_summary() &&
1057 $pluginshowsummary) {
1059 $cell1 = new html_table_cell($plugin->get_name());
1060 $pluginsubmission = new assign_submission_plugin_submission($plugin,
1062 assign_submission_plugin_submission
::SUMMARY
,
1063 $history->coursemoduleid
,
1064 $history->returnaction
,
1065 $history->returnparams
);
1066 $cell2 = new html_table_cell($this->render($pluginsubmission));
1068 $t->data
[] = new html_table_row(array($cell1, $cell2));
1074 // Heading 'feedback'.
1075 $title = get_string('feedback', 'assign', $i);
1076 $title .= $this->output
->spacer(array('width'=>10));
1077 if ($history->cangrade
) {
1078 // Edit previous feedback.
1079 $returnparams = http_build_query($history->returnparams
);
1080 $urlparams = array('id' => $history->coursemoduleid
,
1081 'rownum'=>$history->rownum
,
1082 'useridlistid'=>$history->useridlistid
,
1083 'attemptnumber'=>$grade->attemptnumber
,
1085 'returnaction'=>$history->returnaction
,
1086 'returnparams'=>$returnparams);
1087 $url = new moodle_url('/mod/assign/view.php', $urlparams);
1088 $icon = new pix_icon('gradefeedback',
1089 get_string('editattemptfeedback', 'assign', $grade->attemptnumber+
1),
1091 $title .= $this->output
->action_icon($url, $icon);
1093 $cell = new html_table_cell($title);
1094 $cell->attributes
['class'] = 'feedbacktitle';
1096 $t->data
[] = new html_table_row(array($cell));
1099 $cell1 = new html_table_cell($gradestr);
1100 $cell2 = $grade->gradefordisplay
;
1101 $t->data
[] = new html_table_row(array($cell1, $cell2));
1104 $cell1 = new html_table_cell($gradedonstr);
1105 $cell2 = new html_table_cell(userdate($grade->timemodified
));
1106 $t->data
[] = new html_table_row(array($cell1, $cell2));
1109 $cell1 = new html_table_cell($gradedbystr);
1110 $cell2 = new html_table_cell($this->output
->user_picture($grade->grader
) .
1111 $this->output
->spacer(array('width'=>30)) . fullname($grade->grader
));
1112 $t->data
[] = new html_table_row(array($cell1, $cell2));
1114 // Feedback from plugins.
1115 foreach ($history->feedbackplugins
as $plugin) {
1116 if ($plugin->is_enabled() &&
1117 $plugin->is_visible() &&
1118 $plugin->has_user_summary() &&
1119 !$plugin->is_empty($grade)) {
1121 $cell1 = new html_table_cell($plugin->get_name());
1122 $pluginfeedback = new assign_feedback_plugin_feedback(
1123 $plugin, $grade, assign_feedback_plugin_feedback
::SUMMARY
, $history->coursemoduleid
,
1124 $history->returnaction
, $history->returnparams
1126 $cell2 = new html_table_cell($this->render($pluginfeedback));
1127 $t->data
[] = new html_table_row(array($cell1, $cell2));
1134 $o .= html_writer
::table($t);
1136 $o .= $this->box_end();
1137 $jsparams = array($containerid);
1139 $this->page
->requires
->yui_module('moodle-mod_assign-history', 'Y.one("#' . $containerid . '").history');
1145 * Render a submission plugin submission
1147 * @param assign_submission_plugin_submission $submissionplugin
1150 public function render_assign_submission_plugin_submission(assign_submission_plugin_submission
$submissionplugin) {
1153 if ($submissionplugin->view
== assign_submission_plugin_submission
::SUMMARY
) {
1154 $showviewlink = false;
1155 $summary = $submissionplugin->plugin
->view_summary($submissionplugin->submission
,
1158 $classsuffix = $submissionplugin->plugin
->get_subtype() .
1160 $submissionplugin->plugin
->get_type() .
1162 $submissionplugin->submission
->id
;
1164 $o .= $this->output
->box_start('boxaligncenter plugincontentsummary summary_' . $classsuffix);
1167 if ($showviewlink) {
1168 $previewstr = get_string('viewsubmission', 'assign');
1169 $icon = $this->output
->pix_icon('t/preview', $previewstr);
1171 $expandstr = get_string('viewfull', 'assign');
1172 $options = array('class'=>'expandsummaryicon expand_' . $classsuffix);
1173 $o .= $this->output
->pix_icon('t/switch_plus', $expandstr, null, $options);
1175 $jsparams = array($submissionplugin->plugin
->get_subtype(),
1176 $submissionplugin->plugin
->get_type(),
1177 $submissionplugin->submission
->id
);
1179 $this->page
->requires
->js_init_call('M.mod_assign.init_plugin_summary', $jsparams);
1181 $action = 'viewplugin' . $submissionplugin->plugin
->get_subtype();
1182 $returnparams = http_build_query($submissionplugin->returnparams
);
1183 $link .= '<noscript>';
1184 $urlparams = array('id' => $submissionplugin->coursemoduleid
,
1185 'sid'=>$submissionplugin->submission
->id
,
1186 'plugin'=>$submissionplugin->plugin
->get_type(),
1188 'returnaction'=>$submissionplugin->returnaction
,
1189 'returnparams'=>$returnparams);
1190 $url = new moodle_url('/mod/assign/view.php', $urlparams);
1191 $link .= $this->output
->action_link($url, $icon);
1192 $link .= '</noscript>';
1194 $link .= $this->output
->spacer(array('width'=>15));
1197 $o .= $link . $summary;
1198 $o .= $this->output
->box_end();
1199 if ($showviewlink) {
1200 $o .= $this->output
->box_start('boxaligncenter hidefull full_' . $classsuffix);
1201 $classes = 'expandsummaryicon contract_' . $classsuffix;
1202 $o .= $this->output
->pix_icon('t/switch_minus',
1203 get_string('viewsummary', 'assign'),
1205 array('class'=>$classes));
1206 $o .= $submissionplugin->plugin
->view($submissionplugin->submission
);
1207 $o .= $this->output
->box_end();
1209 } else if ($submissionplugin->view
== assign_submission_plugin_submission
::FULL
) {
1210 $o .= $this->output
->box_start('boxaligncenter submissionfull');
1211 $o .= $submissionplugin->plugin
->view($submissionplugin->submission
);
1212 $o .= $this->output
->box_end();
1219 * Render the grading table.
1221 * @param assign_grading_table $table
1224 public function render_assign_grading_table(assign_grading_table
$table) {
1226 $o .= $this->output
->box_start('boxaligncenter gradingtable');
1228 $this->page
->requires
->js_init_call('M.mod_assign.init_grading_table', array());
1229 $this->page
->requires
->string_for_js('nousersselected', 'assign');
1230 $this->page
->requires
->string_for_js('batchoperationconfirmgrantextension', 'assign');
1231 $this->page
->requires
->string_for_js('batchoperationconfirmlock', 'assign');
1232 $this->page
->requires
->string_for_js('batchoperationconfirmreverttodraft', 'assign');
1233 $this->page
->requires
->string_for_js('batchoperationconfirmunlock', 'assign');
1234 $this->page
->requires
->string_for_js('batchoperationconfirmaddattempt', 'assign');
1235 $this->page
->requires
->string_for_js('batchoperationconfirmdownloadselected', 'assign');
1236 $this->page
->requires
->string_for_js('batchoperationconfirmsetmarkingworkflowstate', 'assign');
1237 $this->page
->requires
->string_for_js('batchoperationconfirmsetmarkingallocation', 'assign');
1238 $this->page
->requires
->string_for_js('editaction', 'assign');
1239 foreach ($table->plugingradingbatchoperations
as $plugin => $operations) {
1240 foreach ($operations as $operation => $description) {
1241 $this->page
->requires
->string_for_js('batchoperationconfirm' . $operation,
1242 'assignfeedback_' . $plugin);
1245 $o .= $this->flexible_table($table, $table->get_rows_per_page(), true);
1246 $o .= $this->output
->box_end();
1252 * Render a feedback plugin feedback
1254 * @param assign_feedback_plugin_feedback $feedbackplugin
1257 public function render_assign_feedback_plugin_feedback(assign_feedback_plugin_feedback
$feedbackplugin) {
1260 if ($feedbackplugin->view
== assign_feedback_plugin_feedback
::SUMMARY
) {
1261 $showviewlink = false;
1262 $summary = $feedbackplugin->plugin
->view_summary($feedbackplugin->grade
, $showviewlink);
1264 $classsuffix = $feedbackplugin->plugin
->get_subtype() .
1266 $feedbackplugin->plugin
->get_type() .
1268 $feedbackplugin->grade
->id
;
1269 $o .= $this->output
->box_start('boxaligncenter plugincontentsummary summary_' . $classsuffix);
1272 if ($showviewlink) {
1273 $previewstr = get_string('viewfeedback', 'assign');
1274 $icon = $this->output
->pix_icon('t/preview', $previewstr);
1276 $expandstr = get_string('viewfull', 'assign');
1277 $options = array('class'=>'expandsummaryicon expand_' . $classsuffix);
1278 $o .= $this->output
->pix_icon('t/switch_plus', $expandstr, null, $options);
1280 $jsparams = array($feedbackplugin->plugin
->get_subtype(),
1281 $feedbackplugin->plugin
->get_type(),
1282 $feedbackplugin->grade
->id
);
1283 $this->page
->requires
->js_init_call('M.mod_assign.init_plugin_summary', $jsparams);
1285 $urlparams = array('id' => $feedbackplugin->coursemoduleid
,
1286 'gid'=>$feedbackplugin->grade
->id
,
1287 'plugin'=>$feedbackplugin->plugin
->get_type(),
1288 'action'=>'viewplugin' . $feedbackplugin->plugin
->get_subtype(),
1289 'returnaction'=>$feedbackplugin->returnaction
,
1290 'returnparams'=>http_build_query($feedbackplugin->returnparams
));
1291 $url = new moodle_url('/mod/assign/view.php', $urlparams);
1292 $link .= '<noscript>';
1293 $link .= $this->output
->action_link($url, $icon);
1294 $link .= '</noscript>';
1296 $link .= $this->output
->spacer(array('width'=>15));
1299 $o .= $link . $summary;
1300 $o .= $this->output
->box_end();
1301 if ($showviewlink) {
1302 $o .= $this->output
->box_start('boxaligncenter hidefull full_' . $classsuffix);
1303 $classes = 'expandsummaryicon contract_' . $classsuffix;
1304 $o .= $this->output
->pix_icon('t/switch_minus',
1305 get_string('viewsummary', 'assign'),
1307 array('class'=>$classes));
1308 $o .= $feedbackplugin->plugin
->view($feedbackplugin->grade
);
1309 $o .= $this->output
->box_end();
1311 } else if ($feedbackplugin->view
== assign_feedback_plugin_feedback
::FULL
) {
1312 $o .= $this->output
->box_start('boxaligncenter feedbackfull');
1313 $o .= $feedbackplugin->plugin
->view($feedbackplugin->grade
);
1314 $o .= $this->output
->box_end();
1321 * Render a course index summary
1323 * @param assign_course_index_summary $indexsummary
1326 public function render_assign_course_index_summary(assign_course_index_summary
$indexsummary) {
1329 $strplural = get_string('modulenameplural', 'assign');
1330 $strsectionname = $indexsummary->courseformatname
;
1331 $strduedate = get_string('duedate', 'assign');
1332 $strsubmission = get_string('submission', 'assign');
1333 $strgrade = get_string('grade');
1335 $table = new html_table();
1336 if ($indexsummary->usesections
) {
1337 $table->head
= array ($strsectionname, $strplural, $strduedate, $strsubmission, $strgrade);
1338 $table->align
= array ('left', 'left', 'center', 'right', 'right');
1340 $table->head
= array ($strplural, $strduedate, $strsubmission, $strgrade);
1341 $table->align
= array ('left', 'left', 'center', 'right');
1343 $table->data
= array();
1345 $currentsection = '';
1346 foreach ($indexsummary->assignments
as $info) {
1347 $params = array('id' => $info['cmid']);
1348 $link = html_writer
::link(new moodle_url('/mod/assign/view.php', $params),
1350 $due = $info['timedue'] ?
userdate($info['timedue']) : '-';
1353 if ($indexsummary->usesections
) {
1354 if ($info['sectionname'] !== $currentsection) {
1355 if ($info['sectionname']) {
1356 $printsection = $info['sectionname'];
1358 if ($currentsection !== '') {
1359 $table->data
[] = 'hr';
1361 $currentsection = $info['sectionname'];
1365 if ($indexsummary->usesections
) {
1366 $row = array($printsection, $link, $due, $info['submissioninfo'], $info['gradeinfo']);
1368 $row = array($link, $due, $info['submissioninfo'], $info['gradeinfo']);
1370 $table->data
[] = $row;
1373 $o .= html_writer
::table($table);
1381 * Internal function - creates htmls structure suitable for YUI tree.
1383 * @param assign_files $tree
1387 protected function htmllize_tree(assign_files
$tree, $dir) {
1389 $yuiconfig = array();
1390 $yuiconfig['type'] = 'html';
1392 if (empty($dir['subdirs']) and empty($dir['files'])) {
1397 foreach ($dir['subdirs'] as $subdir) {
1398 $image = $this->output
->pix_icon(file_folder_icon(),
1401 array('class'=>'icon'));
1402 $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'>' .
1403 '<div>' . $image . ' ' . s($subdir['dirname']) . '</div> ' .
1404 $this->htmllize_tree($tree, $subdir) .
1408 foreach ($dir['files'] as $file) {
1409 $filename = $file->get_filename();
1410 if ($CFG->enableplagiarism
) {
1411 require_once($CFG->libdir
.'/plagiarismlib.php');
1412 $plagiarismlinks = plagiarism_get_links(array('userid'=>$file->get_userid(),
1414 'cmid'=>$tree->cm
->id
,
1415 'course'=>$tree->course
));
1417 $plagiarismlinks = '';
1419 $image = $this->output
->pix_icon(file_file_icon($file),
1422 array('class'=>'icon'));
1423 $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'>' .
1425 '<div class="fileuploadsubmission">' . $image . ' ' .
1426 $file->fileurl
. ' ' .
1427 $plagiarismlinks . ' ' .
1428 $file->portfoliobutton
. ' ' .
1430 '<div class="fileuploadsubmissiontime">' . $file->timemodified
. '</div>' .
1441 * Helper method dealing with the fact we can not just fetch the output of flexible_table
1443 * @param flexible_table $table The table to render
1444 * @param int $rowsperpage How many assignments to render in a page
1445 * @param bool $displaylinks - Whether to render links in the table
1446 * (e.g. downloads would not enable this)
1447 * @return string HTML
1449 protected function flexible_table(flexible_table
$table, $rowsperpage, $displaylinks) {
1453 $table->out($rowsperpage, $displaylinks);
1454 $o = ob_get_contents();
1461 * Helper method dealing with the fact we can not just fetch the output of moodleforms
1463 * @param moodleform $mform
1464 * @return string HTML
1466 protected function moodleform(moodleform
$mform) {
1471 $o = ob_get_contents();
1478 * Defer to template..
1480 * @param grading_app $app - All the data to render the grading app.
1482 public function render_grading_app(grading_app
$app) {
1483 $context = $app->export_for_template($this);
1484 return $this->render_from_template('mod_assign/grading_app', $context);