Skip to content

Commit

Permalink
MDL-50673 workshop: Display all participants during submission phase
Browse files Browse the repository at this point in the history
This patch adds a new report to be displayed during the submission
phase. The report displays all participants who are supposed to submit
their work into the workshop and the status of their submission.
  • Loading branch information
mkassaei authored and mudrd8mz committed Jul 16, 2015
1 parent e1d4e28 commit bfde810
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 34 deletions.
4 changes: 4 additions & 0 deletions mod/workshop/lang/en/workshop.php
Expand Up @@ -196,6 +196,7 @@
$string['notoverridden'] = 'Not overridden';
$string['noworkshops'] = 'There are no workshops in this course';
$string['noyoursubmission'] = 'You have not submitted your work yet';
$string['nothingfound'] = 'Nothing to display';
$string['nullgrade'] = '-';
$string['overallfeedback'] = 'Overall feedback';
$string['overallfeedbackfiles'] = 'Maximum number of overall feedback attachments';
Expand Down Expand Up @@ -265,11 +266,14 @@
$string['submissiongrade'] = 'Grade for submission';
$string['submissiongrade_help'] = 'This setting specifies the maximum grade that may be obtained for submitted work.';
$string['submissiongradeof'] = 'Grade for submission (of {$a})';
$string['submissionlastmodified'] = 'Last modified';
$string['submissionsettings'] = 'Submission settings';
$string['submissionstart'] = 'Open for submissions from';
$string['submissionstartevent'] = '{$a} (opens for submissions)';
$string['submissionstartdatetime'] = 'Open for submissions from {$a->daydatetime} ({$a->distanceday})';
$string['submissiontitle'] = 'Title';
$string['submissionsreport'] = 'Workshop submissions report';
$string['submittednotsubmitted'] = 'Submitted ({$a->submitted}) / not submitted ({$a->notsubmitted})';
$string['subplugintype_workshopallocation'] = 'Submissions allocation method';
$string['subplugintype_workshopallocation_plural'] = 'Submissions allocation methods';
$string['subplugintype_workshopeval'] = 'Grading evaluation method';
Expand Down
5 changes: 3 additions & 2 deletions mod/workshop/locallib.php
Expand Up @@ -1782,7 +1782,7 @@ public function prepare_grading_report_data($userid, $groupid, $page, $perpage,
return array();
}

if (!in_array($sortby, array('lastname','firstname','submissiontitle','submissiongrade','gradinggrade'))) {
if (!in_array($sortby, array('lastname','firstname','submissiontitle', 'submissionmodified','submissiongrade','gradinggrade'))) {
$sortby = 'lastname';
}

Expand Down Expand Up @@ -1813,7 +1813,8 @@ public function prepare_grading_report_data($userid, $groupid, $page, $perpage,
}
$sqlsort = implode(',', $sqlsort);
$picturefields = user_picture::fields('u', array(), 'userid');
$sql = "SELECT $picturefields, s.title AS submissiontitle, s.grade AS submissiongrade, ag.gradinggrade
$sql = "SELECT $picturefields, s.title AS submissiontitle, s.timemodified AS submissionmodified,
s.grade AS submissiongrade, ag.gradinggrade
FROM {user} u
LEFT JOIN {workshop_submissions} s ON (s.authorid = u.id AND s.workshopid = :workshopid1 AND s.example = 0)
LEFT JOIN {workshop_aggregations} ag ON (ag.userid = u.id AND ag.workshopid = :workshopid2)
Expand Down
42 changes: 30 additions & 12 deletions mod/workshop/renderer.php
Expand Up @@ -420,21 +420,29 @@ protected function render_workshop_grading_report(workshop_grading_report $gradi
$sortbyname = $sortbyfirstname . ' / ' . $sortbylastname;
}

$sortbysubmisstiontitle = $this->helper_sortable_heading(get_string('submission', 'workshop'), 'submissiontitle',
$options->sortby, $options->sorthow);
$sortbysubmisstionlastmodified = $this->helper_sortable_heading(get_string('submissionlastmodified', 'workshop'),
'submissionmodified', $options->sortby, $options->sorthow);
$sortbysubmisstion = $sortbysubmisstiontitle . ' / ' . $sortbysubmisstionlastmodified;

$table->head = array();
$table->head[] = $sortbyname;
$table->head[] = $this->helper_sortable_heading(get_string('submission', 'workshop'), 'submissiontitle',
$options->sortby, $options->sorthow);
$table->head[] = $this->helper_sortable_heading(get_string('receivedgrades', 'workshop'));
if ($options->showsubmissiongrade) {
$table->head[] = $this->helper_sortable_heading(get_string('submissiongradeof', 'workshop', $data->maxgrade),
'submissiongrade', $options->sortby, $options->sorthow);
}
$table->head[] = $this->helper_sortable_heading(get_string('givengrades', 'workshop'));
if ($options->showgradinggrade) {
$table->head[] = $this->helper_sortable_heading(get_string('gradinggradeof', 'workshop', $data->maxgradinggrade),
'gradinggrade', $options->sortby, $options->sorthow);
$table->head[] = $sortbysubmisstion;

// If we are in submission phase ignore the following headers (columns).
if ($options->workshopphase != workshop::PHASE_SUBMISSION) {
$table->head[] = $this->helper_sortable_heading(get_string('receivedgrades', 'workshop'));
if ($options->showsubmissiongrade) {
$table->head[] = $this->helper_sortable_heading(get_string('submissiongradeof', 'workshop', $data->maxgrade),
'submissiongrade', $options->sortby, $options->sorthow);
}
$table->head[] = $this->helper_sortable_heading(get_string('givengrades', 'workshop'));
if ($options->showgradinggrade) {
$table->head[] = $this->helper_sortable_heading(get_string('gradinggradeof', 'workshop', $data->maxgradinggrade),
'gradinggrade', $options->sortby, $options->sorthow);
}
}

$table->rowclasses = array();
$table->colclasses = array();
$table->data = array();
Expand Down Expand Up @@ -484,6 +492,13 @@ protected function render_workshop_grading_report(workshop_grading_report $gradi
$cell->attributes['class'] = 'submission';
$row->cells[] = $cell;
}

// If we are in submission phase ignore the following columns.
if ($options->workshopphase == workshop::PHASE_SUBMISSION) {
$table->data[] = $row;
continue;
}

// column #3 - received grades
if ($tr % $spanreceived == 0) {
$idx = intval($tr / $spanreceived);
Expand Down Expand Up @@ -997,6 +1012,9 @@ protected function helper_grading_report_submission(stdclass $participant) {
$url = new moodle_url('/mod/workshop/submission.php',
array('cmid' => $this->page->context->instanceid, 'id' => $participant->submissionid));
$out = html_writer::link($url, format_string($participant->submissiontitle), array('class'=>'title'));

$lastmodified = get_string('userdatemodified', 'workshop', userdate($participant->submissionmodified));
$out .= html_writer::tag('div', $lastmodified, array('class' => 'lastmodified'));
}

return $out;
Expand Down
9 changes: 9 additions & 0 deletions mod/workshop/styles.css
Expand Up @@ -589,4 +589,13 @@
text-align: center;
}

.path-mod-workshop .lastmodified {
line-height: 1.0em;
}

.path-mod-workshop .nothingfound {
font-size: 150%;
color: #FF4500;
}

.path-mod-workshop .workshop-risk-dataloss { vertical-align: text-bottom; }
10 changes: 6 additions & 4 deletions mod/workshop/tests/behat/workshop_assessment.feature
Expand Up @@ -64,10 +64,12 @@ Feature: Workshop submission and assessment
And I follow "TestWorkshop"
And I should see "to allocate: 3"
And I should see "There is at least one author who has not yet submitted their work"
And I should see "All submissions (3)"
And I should see "Submission1"
And I should see "Submission2"
And I should see "Submission3"
Then I should see "Workshop submissions report"
And I should see "Submitted (3) / not submitted (1)"
And I should see "Submission1" in the "Sam1 Student1" "table_row"
And I should see "Submission2" in the "Sam2 Student2" "table_row"
And I should see "Submission3" in the "Sam3 Student3" "table_row"
And I should see "No submission found for this user" in the "Sam4 Student4" "table_row"
And I allocate submissions in workshop "TestWorkshop" as:"
| Participant | Reviewer |
| Sam1 Student1 | Sam2 Student2 |
Expand Down
47 changes: 31 additions & 16 deletions mod/workshop/view.php
Expand Up @@ -224,32 +224,44 @@
}
}

$countsubmissions = $workshop->count_submissions('all', $groupid);
print_collapsible_region_start('', 'workshop-viewlet-allsubmissions', get_string('submissionsreport', 'workshop'));

$perpage = get_user_preferences('workshop_perpage', 10);
$pagingbar = new paging_bar($countsubmissions, $page, $perpage, $PAGE->url, 'page');
$data = $workshop->prepare_grading_report_data($USER->id, $groupid, $page, $perpage, $sortby, $sorthow);
if ($data) {
$countparticipants = $workshop->count_participants();
$countsubmissions = $workshop->count_submissions('all', $groupid);
$a = new stdClass();
$a->submitted = $countsubmissions;
$a->notsubmitted = $data->totalcount - $countsubmissions;

print_collapsible_region_start('', 'workshop-viewlet-allsubmissions', get_string('allsubmissions', 'workshop', $countsubmissions));
echo $output->box_start('generalbox allsubmissions');
echo $output->container(groups_print_activity_menu($workshop->cm, $PAGE->url, true), 'groupwidget');
echo html_writer::tag('div', get_string('submittednotsubmitted', 'workshop', $a));

if ($countsubmissions == 0) {
echo $output->container(get_string('nosubmissions', 'workshop'), 'nosubmissions');
echo $output->container(groups_print_activity_menu($workshop->cm, $PAGE->url, true), 'groupwidget');

// prepare paging bar
$baseurl = new moodle_url($PAGE->url, array('sortby' => $sortby, 'sorthow' => $sorthow));
$pagingbar = new paging_bar($data->totalcount, $page, $perpage, $baseurl, 'page');

// submissions report display options
$reportopts = new stdclass();
$reportopts->showauthornames = has_capability('mod/workshop:viewauthornames', $workshop->context);
$reportopts->showreviewernames = has_capability('mod/workshop:viewreviewernames', $workshop->context);
$reportopts->sortby = $sortby;
$reportopts->sorthow = $sorthow;
$reportopts->showsubmissiongrade = false;
$reportopts->showgradinggrade = false;
$reportopts->workshopphase = $workshop->phase;

} else {
$submissions = $workshop->get_submissions('all', $groupid, $page * $perpage, $perpage);
$shownames = has_capability('mod/workshop:viewauthornames', $workshop->context);
echo $output->render($pagingbar);
foreach ($submissions as $submission) {
echo $output->render($workshop->prepare_submission_summary($submission, $shownames));
}
echo $output->render(new workshop_grading_report($data, $reportopts));
echo $output->render($pagingbar);
echo $output->perpage_selector($perpage);
} else {
echo html_writer::tag('div', get_string('nothingfound', 'workshop'), array('class' => 'nothingfound'));
}

echo $output->box_end();
print_collapsible_region_end();
}

break;

case workshop::PHASE_ASSESSMENT:
Expand Down Expand Up @@ -298,6 +310,7 @@
$reportopts->sorthow = $sorthow;
$reportopts->showsubmissiongrade = false;
$reportopts->showgradinggrade = false;
$reportopts->workshopphase = $workshop->phase;

print_collapsible_region_start('', 'workshop-viewlet-gradereport', get_string('gradesreport', 'workshop'));
echo $output->box_start('generalbox gradesreport');
Expand Down Expand Up @@ -447,6 +460,7 @@
$reportopts->sorthow = $sorthow;
$reportopts->showsubmissiongrade = true;
$reportopts->showgradinggrade = true;
$reportopts->workshopphase = $workshop->phase;

print_collapsible_region_start('', 'workshop-viewlet-gradereport', get_string('gradesreport', 'workshop'));
echo $output->box_start('generalbox gradesreport');
Expand Down Expand Up @@ -565,6 +579,7 @@
$reportopts->sorthow = $sorthow;
$reportopts->showsubmissiongrade = true;
$reportopts->showgradinggrade = true;
$reportopts->workshopphase = $workshop->phase;

print_collapsible_region_start('', 'workshop-viewlet-gradereport', get_string('gradesreport', 'workshop'));
echo $output->box_start('generalbox gradesreport');
Expand Down

0 comments on commit bfde810

Please sign in to comment.