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.
This commit is contained in:
David Mudrák
2016-10-21 17:10:32 +02:00
parent 52554b172f
commit 56201bcdef
2 changed files with 19 additions and 2 deletions
+1
View File
@@ -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 <strong>Setup phase</strong>. 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 <strong>Submission phase</strong>. 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})';
+18 -2
View File
@@ -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);