From 56201bcdef4e1ac7fe6d852d15c37a860617b1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Fri, 21 Oct 2016 17:10:32 +0200 Subject: [PATCH] MDL-54833 workshop: Enhance usability of switching to the next phase Many users did not realize the need to switch the phase manually. This patch adds a new explicit task to the current phase to do that. --- mod/workshop/lang/en/workshop.php | 1 + mod/workshop/locallib.php | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mod/workshop/lang/en/workshop.php b/mod/workshop/lang/en/workshop.php index 6df17289a49..43a34f4479b 100644 --- a/mod/workshop/lang/en/workshop.php +++ b/mod/workshop/lang/en/workshop.php @@ -297,6 +297,7 @@ $string['subplugintype_workshopform'] = 'Grading strategy'; $string['subplugintype_workshopform_plural'] = 'Grading strategies'; $string['switchingphase'] = 'Switching phase'; $string['switchphase'] = 'Switch phase'; +$string['switchphasenext'] = 'Switch to the next phase'; $string['switchphase10info'] = 'You are about to switch the workshop into the Setup phase. In this phase, users cannot modify their submissions or their assessments. Teachers may use this phase to change workshop settings, modify the grading strategy or tweak assessment forms.'; $string['switchphase20info'] = 'You are about to switch the workshop into the Submission phase. Students may submit their work during this phase (within the submission access control dates, if set). Teachers may allocate submissions for peer review.'; $string['switchphase30auto'] = 'Workshop will automatically switch into the assessment phase after {$a->daydatetime} ({$a->distanceday})'; diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php index 509d397642a..e63250b83d4 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -3405,10 +3405,26 @@ class workshop_user_plan implements renderable { } } - // Add phase switching actions + // Add phase switching actions. if (has_capability('mod/workshop:switchphase', $workshop->context, $userid)) { + $nextphases = array( + workshop::PHASE_SETUP => workshop::PHASE_SUBMISSION, + workshop::PHASE_SUBMISSION => workshop::PHASE_ASSESSMENT, + workshop::PHASE_ASSESSMENT => workshop::PHASE_EVALUATION, + workshop::PHASE_EVALUATION => workshop::PHASE_CLOSED, + ); foreach ($this->phases as $phasecode => $phase) { - if (! $phase->active) { + if ($phase->active) { + if (isset($nextphases[$workshop->phase])) { + $task = new stdClass(); + $task->title = get_string('switchphasenext', 'mod_workshop'); + $task->link = $workshop->switchphase_url($nextphases[$workshop->phase]); + $task->details = ''; + $task->completed = null; + $phase->tasks['switchtonextphase'] = $task; + } + + } else { $action = new stdclass(); $action->type = 'switchphase'; $action->url = $workshop->switchphase_url($phasecode);