diff --git a/mod/workshop/assessment.php b/mod/workshop/assessment.php
index 590e35c6a53..666962a3eb6 100644
--- a/mod/workshop/assessment.php
+++ b/mod/workshop/assessment.php
@@ -54,7 +54,6 @@ $PAGE->set_url($workshop->assess_url($assessment->id));
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('assessingsubmission', 'workshop'));
-$currenttab = 'assessment';
$canviewallassessments = has_capability('mod/workshop:viewallassessments', $workshop->context);
$canviewallsubmissions = has_capability('mod/workshop:viewallsubmissions', $workshop->context);
diff --git a/mod/workshop/lang/en/workshop.php b/mod/workshop/lang/en/workshop.php
index 19d25645ad7..feb36b66b39 100644
--- a/mod/workshop/lang/en/workshop.php
+++ b/mod/workshop/lang/en/workshop.php
@@ -106,7 +106,7 @@ $string['formatpeergrade'] = '{$a->grade} {$a->grade} ({$a->gradinggrade} / {$a->gradinggradeover})';
$string['formatpeergradeoverweighted'] = '{$a->grade} ({$a->gradinggrade} / {$a->gradinggradeover}) @ {$a->weight}';
$string['formatpeergradeweighted'] = '{$a->grade} ({$a->gradinggrade}) @ {$a->weight}';
-$string['givengrades'] = 'Given grades';
+$string['givengrades'] = 'Grades given';
$string['gradecalculated'] = 'Calculated grade for submission';
$string['gradedecimals'] = 'Decimal places in grades';
$string['gradegivento'] = '>';
@@ -156,7 +156,7 @@ $string['phasesubmission'] = 'Submission phase';
$string['prepareexamples'] = 'Prepare example submissions';
$string['previewassessmentform'] = 'Preview';
$string['reassess'] = 'Re-assess';
-$string['receivedgrades'] = 'Received grades';
+$string['receivedgrades'] = 'Grades received';
$string['saveandclose'] = 'Save and close';
$string['saveandcontinue'] = 'Save and continue editing';
$string['saveandpreview'] = 'Save and preview';
diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php
index 23d17211140..c3592a75088 100644
--- a/mod/workshop/locallib.php
+++ b/mod/workshop/locallib.php
@@ -170,12 +170,12 @@ class workshop {
*/
public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null) {
foreach ($dbrecord as $field => $value) {
- $this->{$field} = $value;
+ if (property_exists('workshop', $field)) {
+ $this->{$field} = $value;
+ }
}
$this->cm = $cm;
- $this->course = $course; // beware - this replaces the standard course field in the instance table
- // this is intentional - IMO there should be no such field as it violates
- // 3rd normal form with no real performance gain
+ $this->course = $course;
if (is_null($context)) {
$this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
} else {
diff --git a/mod/workshop/submission.php b/mod/workshop/submission.php
index 00907bf5013..3227eb68ee4 100644
--- a/mod/workshop/submission.php
+++ b/mod/workshop/submission.php
@@ -29,6 +29,7 @@ require_once(dirname(__FILE__).'/locallib.php');
$cmid = required_param('cmid', PARAM_INT); // course module id
$id = optional_param('id', 0, PARAM_INT); // submission id
$edit = optional_param('edit', false, PARAM_BOOL); // open for editing?
+$assess = optional_param('assess', false, PARAM_BOOL); // instant assessment required
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
@@ -56,6 +57,7 @@ if ($id) { // submission is specified
$ownsubmission = $submission->authorid == $USER->id;
$canviewall = has_capability('mod/workshop:viewallsubmissions', $workshop->context);
$cansubmit = has_capability('mod/workshop:submit', $workshop->context);
+$canallocate = has_capability('mod/workshop:allocate', $workshop->context);
$canoverride = (($workshop->phase == workshop::PHASE_EVALUATION) and has_capability('mod/workshop:overridegrades', $workshop->context));
$isreviewer = $DB->record_exists('workshop_assessments', array('submissionid' => $submission->id, 'reviewerid' => $USER->id));
$editable = $workshop->submitting_allowed();
@@ -69,6 +71,12 @@ if ($submission->id and ($ownsubmission or $canviewall or $isreviewer)) {
print_error('nopermissions');
}
+if ($assess and $submission->id and !$isreviewer and $canallocate and $workshop->assessing_allowed()) {
+ require_sesskey();
+ $assessmentid = $workshop->add_allocation($submission, $USER->id);
+ redirect($workshop->assess_url($assessmentid));
+}
+
if ($edit and $ownsubmission) {
require_once(dirname(__FILE__).'/submission_form.php');
@@ -111,7 +119,7 @@ if ($edit and $ownsubmission) {
$formdata = file_postupdate_standard_filemanager($formdata, 'attachment', $attachmentopts, $workshop->context,
'workshop_submission_attachment', $formdata->id);
if (empty($formdata->attachment)) {
- // explicit cas to zero integer
+ // explicit cast to zero integer
$formdata->attachment = 0;
}
// store the updated values or re-save the new submission (re-saving needed because URLs are now rewritten)
@@ -173,6 +181,11 @@ if ($ownsubmission and $editable) {
echo $OUTPUT->single_button($url, get_string('editsubmission', 'workshop'), 'get');
}
+if ($submission->id and !$edit and !$isreviewer and $canallocate and $workshop->assessing_allowed()) {
+ $url = new moodle_url($PAGE->url, array('assess' => 1));
+ echo $OUTPUT->single_button($url, get_string('assess', 'workshop'), 'post');
+}
+
// and possibly display the submission's review(s)
$canviewallassessments = false;