diff --git a/mod/workshop/exsubmission.php b/mod/workshop/exsubmission.php index 486c27814ee..3a29bdf3b03 100644 --- a/mod/workshop/exsubmission.php +++ b/mod/workshop/exsubmission.php @@ -46,6 +46,14 @@ $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_ $workshop = new workshop($workshop, $cm, $course); $PAGE->set_url($workshop->exsubmission_url($id), array('edit' => $edit)); +$PAGE->set_title($workshop->name); +$PAGE->set_heading($course->fullname); +if ($edit) { + $PAGE->navbar->add(get_string('exampleediting', 'workshop')); +} else { + $PAGE->navbar->add(get_string('example', 'workshop')); +} +$output = $PAGE->get_renderer('mod_workshop'); if ($id) { // example is specified $example = $workshop->get_example_by_id($id); @@ -95,6 +103,15 @@ if ($id and $assess and $canassess) { if (!$asid) { $asid = $workshop->add_allocation($example, $USER->id, 0); } + if ($asid == workshop::ALLOCATION_EXISTS) { + // the training assessment of the example was not found but the allocation already + // exists. this probably means that the user is the author of the reference assessment. + echo $output->header(); + echo $output->box(get_string('assessmentreferenceconflict', 'workshop')); + echo $output->continue_button($workshop->view_url()); + echo $output->footer(); + die(); + } redirect($workshop->exassess_url($asid)); } @@ -167,16 +184,7 @@ if ($edit and $canmanage) { } } -$PAGE->set_title($workshop->name); -$PAGE->set_heading($course->fullname); -if ($edit) { - $PAGE->navbar->add(get_string('exampleediting', 'workshop')); -} else { - $PAGE->navbar->add(get_string('example', 'workshop')); -} - // Output starts here -$output = $PAGE->get_renderer('mod_workshop'); echo $output->header(); echo $output->heading(format_string($workshop->name), 2); diff --git a/mod/workshop/lang/en/workshop.php b/mod/workshop/lang/en/workshop.php index 2302ebb18f9..f51361fc875 100644 --- a/mod/workshop/lang/en/workshop.php +++ b/mod/workshop/lang/en/workshop.php @@ -53,6 +53,7 @@ $string['assessmentenddatetime'] = 'Assessment deadline: {$a->daydatetime} ({$a- $string['assessmentform'] = 'Assessment form'; $string['assessmentofsubmission'] = 'Assessment of {$a->submissiontitle}'; $string['assessmentreference'] = 'Reference assessment'; +$string['assessmentreferenceconflict'] = 'It is not possible to assess an example submission for which you provided a reference assessment.'; $string['assessmentreferenceneeded'] = 'You have to assess this example submission to provide a reference assessment. Click \'Continue\' button to assess the submission.'; $string['assessmentsettings'] = 'Assessment settings'; $string['assessmentstart'] = 'Open for assessment from';