Workshop: published submissions are available at the end of the activity

This commit is contained in:
David Mudrak
2010-06-14 10:28:24 +00:00
parent 4d63c194e7
commit 00bc77eecd
4 changed files with 37 additions and 0 deletions

View File

@ -161,6 +161,7 @@ $string['phasesetup'] = 'Setup phase';
$string['phasesubmission'] = 'Submission phase'; $string['phasesubmission'] = 'Submission phase';
$string['prepareexamples'] = 'Prepare example submissions'; $string['prepareexamples'] = 'Prepare example submissions';
$string['previewassessmentform'] = 'Preview'; $string['previewassessmentform'] = 'Preview';
$string['publishedsubmissions'] = 'Published submissions';
$string['publishsubmission'] = 'Publish submission'; $string['publishsubmission'] = 'Publish submission';
$string['publishsubmission_help'] = 'Published submissions are available to the others when the workshop is closed.'; $string['publishsubmission_help'] = 'Published submissions are available to the others when the workshop is closed.';
$string['reassess'] = 'Re-assess'; $string['reassess'] = 'Re-assess';

View File

@ -556,6 +556,26 @@ class workshop {
return $DB->get_record_sql($sql, $params); return $DB->get_record_sql($sql, $params);
} }
/**
* Returns published submissions with their authors data
*
* @return array of stdclass
*/
public function get_published_submissions($orderby='finalgrade DESC') {
global $DB;
$sql = "SELECT s.id, s.authorid, s.timecreated, s.timemodified,
s.title, s.grade, s.gradeover, COALESCE(s.gradeover,s.grade) AS finalgrade,
u.lastname AS authorlastname, u.firstname AS authorfirstname, u.id AS authorid,
u.picture AS authorpicture, u.imagealt AS authorimagealt
FROM {workshop_submissions} s
INNER JOIN {user} u ON (s.authorid = u.id)
WHERE s.example = 0 AND s.workshopid = :workshopid AND s.published = 1
ORDER BY $orderby";
$params = array('workshopid' => $this->id);
return $DB->get_records_sql($sql, $params);
}
/** /**
* Returns full record of the given example submission * Returns full record of the given example submission
* *

View File

@ -1,3 +1,8 @@
.path-mod-workshop .collapsibleregioncaption {
font-weight: bold;
font-size: 120%;
}
/** /**
* Submission - one line summary display * Submission - one line summary display
*/ */

View File

@ -360,6 +360,17 @@ case workshop::PHASE_EVALUATION:
} }
break; break;
case workshop::PHASE_CLOSED: case workshop::PHASE_CLOSED:
if (has_capability('mod/workshop:viewpublishedsubmissions', $workshop->context)) {
if ($submissions = $workshop->get_published_submissions()) {
print_collapsible_region_start('', 'workshop-viewlet-publicsubmissions', get_string('publishedsubmissions', 'workshop'));
foreach ($submissions as $submission) {
echo $output->box_start('generalbox submission-summary');
echo $output->submission_summary($submission, true);
echo $output->box_end();
}
print_collapsible_region_end();
}
}
break; break;
default: default:
} }