Skip to content

Commit

Permalink
MDL-26099 workshop planner tool displays info about the automatic pha…
Browse files Browse the repository at this point in the history
…se switching
  • Loading branch information
mudrd8mz committed Apr 13, 2012
1 parent 40ff3ce commit 3fe6d62
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@
$string['resultvoid'] = 'No submissions were allocated';
$string['resultvoiddeadline'] = 'Not after the submissions deadline yet';
$string['resultvoidexecuted'] = 'The allocation has been already executed';
$string['setup'] = 'Set up scheduled allocation';
1 change: 1 addition & 0 deletions mod/workshop/lang/en/workshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
$string['switchphase'] = 'Switch 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 of 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})';
$string['switchphase30info'] = 'You are about to switch the workshop into the <strong>Assessment phase</strong>. In this phase, reviewers may assess the submissions they have been allocated (within the assessment access control dates, if set).';
$string['switchphase40info'] = 'You are about to switch the workshop into the <strong>Grading evaluation phase</strong>. In this phase, users cannot modify their submissions or their assessments. Teachers may use the grading evaluation tools to calculate final grades and provide feedback for reviewers.';
$string['switchphase50info'] = 'You are about to close the workshop. This will result in the calculated grades appearing in the gradebook. Students may view their submissions and their submission assessments.';
Expand Down
24 changes: 24 additions & 0 deletions mod/workshop/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2283,6 +2283,22 @@ public function __construct(workshop $workshop, $userid) {
$phase->tasks['submit'] = $task;
}
if (has_capability('mod/workshop:allocate', $workshop->context, $userid)) {
if ($workshop->phaseswitchassessment) {
$task = new stdClass();
$allocator = $DB->get_record('workshopallocation_scheduled', array('workshopid' => $workshop->id));
if (empty($allocator)) {
$task->completed = false;
} else if ($allocator->enabled and is_null($allocator->resultstatus)) {
$task->completed = true;
} else if ($workshop->submissionend > time()) {
$task->completed = null;
} else {
$task->completed = false;
}
$task->title = get_string('setup', 'workshopallocation_scheduled');
$task->link = $workshop->allocation_url('scheduled');
$phase->tasks['allocatescheduled'] = $task;
}
$task = new stdclass();
$task->title = get_string('allocate', 'workshop');
$task->link = $workshop->allocation_url();
Expand Down Expand Up @@ -2318,6 +2334,7 @@ public function __construct(workshop $workshop, $userid) {
$task->completed = 'info';
$phase->tasks['allocateinfo'] = $task;
}

}
if ($workshop->submissionstart) {
$task = new stdclass();
Expand Down Expand Up @@ -2354,6 +2371,13 @@ public function __construct(workshop $workshop, $userid) {
$phase->title = get_string('phaseassessment', 'workshop');
$phase->tasks = array();
$phase->isreviewer = has_capability('mod/workshop:peerassess', $workshop->context, $userid);
if ($workshop->phase == workshop::PHASE_SUBMISSION and $workshop->phaseswitchassessment
and has_capability('mod/workshop:switchphase', $workshop->context, $userid)) {
$task = new stdClass();
$task->title = get_string('switchphase30auto', 'mod_workshop', workshop::timestamp_formats($workshop->submissionend));
$task->completed = 'info';
$phase->tasks['autoswitchinfo'] = $task;
}
if ($workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_ASSESSMENT
and $phase->isreviewer and !has_capability('mod/workshop:manageexamples', $workshop->context, $userid)) {
$task = new stdclass();
Expand Down
8 changes: 7 additions & 1 deletion mod/workshop/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,13 @@ protected function render_workshop_user_plan(workshop_user_plan $plan) {
foreach ($phase->actions as $action) {
switch ($action->type) {
case 'switchphase':
$actions .= $this->output->action_icon($action->url, new pix_icon('i/marker', get_string('switchphase', 'workshop')));
$icon = 'i/marker';
if ($phasecode == workshop::PHASE_ASSESSMENT
and $plan->workshop->phase == workshop::PHASE_SUBMISSION
and $plan->workshop->phaseswitchassessment) {
$icon = 'i/scheduled';
}
$actions .= $this->output->action_icon($action->url, new pix_icon($icon, get_string('switchphase', 'workshop')));
break;
}
}
Expand Down

0 comments on commit 3fe6d62

Please sign in to comment.