Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-37806 Display 'Save and show next' button when assessing workshop…

… submissions

The button is displayed only when there is a pending (that is not
assessed yet) submission to assess.

AMOS BEGIN
 CPY [savenext,mod_assign],[saveandshownext,mod_workshop]
AMOS END
  • Loading branch information...
commit 1df3bc143c9f8c2706a7127e18d5f34548ff6805 1 parent 0001eea
@mudrd8mz mudrd8mz authored
View
15 mod/workshop/assessment.php
@@ -128,9 +128,15 @@
if (is_null($assessment->grade) and !$assessmenteditable) {
$mform = null;
} else {
+ // Are there any other pending assessments to do but this one?
+ if ($assessmenteditable) {
+ $pending = $workshop->get_pending_assessments_by_reviewer($assessment->reviewerid, $assessment->id);
+ } else {
+ $pending = array();
+ }
// load the assessment form and process the submitted data eventually
$mform = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, $assessmenteditable,
- array('editableweight' => $cansetassessmentweight));
+ array('editableweight' => $cansetassessmentweight, 'pending' => !empty($pending)));
$mform->set_data(array('weight' => $assessment->weight)); // other values are set by subplugins
if ($mform->is_cancelled()) {
redirect($workshop->view_url());
@@ -146,6 +152,13 @@
}
if (!is_null($rawgrade) and isset($data->saveandclose)) {
redirect($workshop->view_url());
+ } else if (!is_null($rawgrade) and isset($data->saveandshownext)) {
+ $next = reset($pending);
+ if (!empty($next)) {
+ redirect($workshop->assess_url($next->id));
+ } else {
+ redirect($PAGE->url); // This should never happen but just in case...
+ }
} else {
// either it is not possible to calculate the $rawgrade
// or the reviewer has chosen "Save and continue"
View
5 mod/workshop/form/assessment_form.php
@@ -77,8 +77,11 @@ public function definition() {
$buttonarray[] = $mform->createElement('cancel', 'backtoeditform', get_string('backtoeditform', 'workshop'));
}
if ($this->mode == 'assessment') {
- $buttonarray[] = $mform->createElement('submit', 'saveandcontinue', get_string('saveandcontinue', 'workshop'));
+ if (!empty($this->options['pending'])) {
+ $buttonarray[] = $mform->createElement('submit', 'saveandshownext', get_string('saveandshownext', 'workshop'));
+ }
$buttonarray[] = $mform->createElement('submit', 'saveandclose', get_string('saveandclose', 'workshop'));
+ $buttonarray[] = $mform->createElement('submit', 'saveandcontinue', get_string('saveandcontinue', 'workshop'));
$buttonarray[] = $mform->createElement('cancel');
}
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
View
1  mod/workshop/lang/en/workshop.php
@@ -208,6 +208,7 @@
$string['saveandclose'] = 'Save and close';
$string['saveandcontinue'] = 'Save and continue editing';
$string['saveandpreview'] = 'Save and preview';
+$string['saveandshownext'] = 'Save and show next';
$string['selfassessmentdisabled'] = 'Self-assessment disabled';
$string['showingperpage'] = 'Showing {$a} items per page';
$string['showingperpagechange'] = 'Change ...';
Please sign in to comment.
Something went wrong with that request. Please try again.