Workshop: fixed checking of examples assessment before own assessment

This commit is contained in:
David Mudrak 2010-06-11 23:02:04 +00:00
parent 177b5480e7
commit cff28ef080
5 changed files with 291 additions and 183 deletions

View file

@ -74,6 +74,32 @@ if ($isreviewer and $workshop->assessing_allowed()) {
$assessmenteditable = false;
}
// check that all required examples have been assessed by the user
if ($assessmenteditable and $workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_ASSESSMENT
and !has_capability('mod/workshop:manageexamples', $workshop->context)) {
// the reviewer must have submitted their own submission
$reviewersubmission = $workshop->get_submission_by_author($assessment->reviewerid);
if (!$reviewersubmission) {
// no money, no love
$assessmenteditable = false;
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('exampleneedsubmission', 'workshop'), 2);
echo $OUTPUT->footer();
exit;
} else {
$examples = $workshop->get_examples_for_reviewer($assessment->reviewerid);
foreach ($examples as $exampleid => $example) {
if (is_null($example->grade)) {
$assessmenteditable = false;
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('exampleneedassessed', 'workshop'), 2);
echo $OUTPUT->footer();
exit;
}
}
}
}
// load the grading strategy logic
$strategy = $workshop->grading_strategy_instance();

View file

@ -95,6 +95,8 @@ $string['exampledeleteconfirm'] = 'Are you sure you want to delete the following
$string['exampleedit'] = 'Edit example';
$string['exampleediting'] = 'Editing example';
$string['examplegrade'] = 'Grade: {$a->received} of {$a->max}';
$string['exampleneedassessed'] = 'You have to assess all example submissions first';
$string['exampleneedsubmission'] = 'You have to submit your work and assess all example submissions first';
$string['examplesbeforeassessment'] = 'Examples are available after own submission and must be assessed before assessment phase';
$string['examplesbeforesubmission'] = 'Examples must be assessed before own submission';
$string['examplesmode'] = 'Mode of examples assessment';

View file

@ -1711,10 +1711,14 @@ class workshop {
*/
class workshop_user_plan implements renderable {
/** @var int id of the user this plan is for */
public $userid;
/** @var workshop */
public $workshop;
/** @var array of (stdclass)tasks */
public $phases = array();
/** @var null|array of example submissions to be assessed by the planner owner */
protected $examples = null;
/**
* Prepare an individual workshop plan for the given user.
@ -1726,6 +1730,7 @@ class workshop_user_plan implements renderable {
global $DB;
$this->workshop = $workshop;
$this->userid = $userid;
//---------------------------------------------------------
// * SETUP | submission | assessment | evaluation | closed
@ -1733,42 +1738,42 @@ class workshop_user_plan implements renderable {
$phase = new stdclass();
$phase->title = get_string('phasesetup', 'workshop');
$phase->tasks = array();
if (has_capability('moodle/course:manageactivities', $this->workshop->context, $userid)) {
if (has_capability('moodle/course:manageactivities', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('taskintro', 'workshop');
$task->link = $this->workshop->updatemod_url();
$task->completed = !(trim(strip_tags($this->workshop->intro)) == '');
$task->link = $workshop->updatemod_url();
$task->completed = !(trim(strip_tags($workshop->intro)) == '');
$phase->tasks['intro'] = $task;
}
if (has_capability('moodle/course:manageactivities', $this->workshop->context, $userid)) {
if (has_capability('moodle/course:manageactivities', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('taskinstructauthors', 'workshop');
$task->link = $this->workshop->updatemod_url();
$task->completed = !(trim(strip_tags($this->workshop->instructauthors)) == '');
$task->link = $workshop->updatemod_url();
$task->completed = !(trim(strip_tags($workshop->instructauthors)) == '');
$phase->tasks['instructauthors'] = $task;
}
if (has_capability('mod/workshop:editdimensions', $this->workshop->context, $userid)) {
if (has_capability('mod/workshop:editdimensions', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('editassessmentform', 'workshop');
$task->link = $this->workshop->editform_url();
if ($this->workshop->grading_strategy_instance()->form_ready()) {
$task->link = $workshop->editform_url();
if ($workshop->grading_strategy_instance()->form_ready()) {
$task->completed = true;
} elseif ($this->workshop->phase > workshop::PHASE_SETUP) {
} elseif ($workshop->phase > workshop::PHASE_SETUP) {
$task->completed = false;
}
$phase->tasks['editform'] = $task;
}
if ($this->workshop->useexamples and has_capability('mod/workshop:manageexamples', $this->workshop->context, $userid)) {
if ($workshop->useexamples and has_capability('mod/workshop:manageexamples', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('prepareexamples', 'workshop');
if ($DB->count_records('workshop_submissions', array('example' => 1, 'workshopid' => $this->workshop->id)) > 0) {
if ($DB->count_records('workshop_submissions', array('example' => 1, 'workshopid' => $workshop->id)) > 0) {
$task->completed = true;
} elseif ($this->workshop->phase > workshop::PHASE_SETUP) {
} elseif ($workshop->phase > workshop::PHASE_SETUP) {
$task->completed = false;
}
$phase->tasks['prepareexamples'] = $task;
}
if (empty($phase->tasks) and $this->workshop->phase == workshop::PHASE_SETUP) {
if (empty($phase->tasks) and $workshop->phase == workshop::PHASE_SETUP) {
// if we are in the setup phase and there is no task (typical for students), let us
// display some explanation what is going on
$task = new stdclass();
@ -1784,21 +1789,113 @@ class workshop_user_plan implements renderable {
$phase = new stdclass();
$phase->title = get_string('phasesubmission', 'workshop');
$phase->tasks = array();
if (($this->workshop->usepeerassessment or $this->workshop->useselfassessment)
and has_capability('moodle/course:manageactivities', $this->workshop->context, $userid)) {
if (($workshop->usepeerassessment or $workshop->useselfassessment)
and has_capability('moodle/course:manageactivities', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('taskinstructreviewers', 'workshop');
$task->link = $this->workshop->updatemod_url();
if (trim(strip_tags($this->workshop->instructreviewers))) {
$task->link = $workshop->updatemod_url();
if (trim(strip_tags($workshop->instructreviewers))) {
$task->completed = true;
} elseif ($this->workshop->phase >= workshop::PHASE_ASSESSMENT) {
} elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
$task->completed = false;
}
$phase->tasks['instructreviewers'] = $task;
}
if ($this->workshop->useexamples and $this->workshop->examplesmode == workshop::EXAMPLES_BEFORE_SUBMISSION
if ($workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_SUBMISSION
and has_capability('mod/workshop:submit', $workshop->context, $userid, false)
and !has_capability('mod/workshop:manageexamples', $this->workshop->context, $userid)) {
and !has_capability('mod/workshop:manageexamples', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('exampleassesstask', 'workshop');
$examples = $this->get_examples();
$a = new stdclass();
$a->expected = count($examples);
$a->assessed = 0;
foreach ($examples as $exampleid => $example) {
if (!is_null($example->grade)) {
$a->assessed++;
}
}
$task->details = get_string('exampleassesstaskdetails', 'workshop', $a);
if ($a->assessed == $a->expected) {
$task->completed = true;
} elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
$task->completed = false;
}
$phase->tasks['examples'] = $task;
}
if (has_capability('mod/workshop:submit', $workshop->context, $userid, false)) {
$task = new stdclass();
$task->title = get_string('tasksubmit', 'workshop');
$task->link = $workshop->submission_url();
if ($DB->record_exists('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0, 'authorid'=>$userid))) {
$task->completed = true;
} elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
$task->completed = false;
} else {
$task->completed = null; // still has a chance to submit
}
$phase->tasks['submit'] = $task;
}
if (has_capability('mod/workshop:allocate', $workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('allocate', 'workshop');
$task->link = $workshop->allocation_url();
$numofauthors = count(get_users_by_capability($workshop->context, 'mod/workshop:submit', 'u.id', '', '', '',
'', '', false, true));
$numofsubmissions = $DB->count_records('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0));
$sql = 'SELECT COUNT(s.id) AS nonallocated
FROM {workshop_submissions} s
LEFT JOIN {workshop_assessments} a ON (a.submissionid=s.id)
WHERE s.workshopid = :workshopid AND s.example=0 AND a.submissionid IS NULL';
$params['workshopid'] = $workshop->id;
$numnonallocated = $DB->count_records_sql($sql, $params);
if ($numofsubmissions == 0) {
$task->completed = null;
} elseif ($numnonallocated == 0) {
$task->completed = true;
} elseif ($workshop->phase > workshop::PHASE_SUBMISSION) {
$task->completed = false;
} else {
$task->completed = null; // still has a chance to allocate
}
$a = new stdclass();
$a->expected = $numofauthors;
$a->submitted = $numofsubmissions;
$a->allocate = $numnonallocated;
$task->details = get_string('allocatedetails', 'workshop', $a);
unset($a);
$phase->tasks['allocate'] = $task;
if ($numofsubmissions < $numofauthors and $workshop->phase >= workshop::PHASE_SUBMISSION) {
$task = new stdclass();
$task->title = get_string('someuserswosubmission', 'workshop');
$task->completed = 'info';
$phase->tasks['allocateinfo'] = $task;
}
}
if ($workshop->submissionstart) {
$task = new stdclass();
$task->title = get_string('submissionstartdatetime', 'workshop', workshop::timestamp_formats($workshop->submissionstart));
$task->completed = 'info';
$phase->tasks['submissionstartdatetime'] = $task;
}
if ($workshop->submissionend) {
$task = new stdclass();
$task->title = get_string('submissionenddatetime', 'workshop', workshop::timestamp_formats($workshop->submissionend));
$task->completed = 'info';
$phase->tasks['submissionenddatetime'] = $task;
}
$this->phases[workshop::PHASE_SUBMISSION] = $phase;
//---------------------------------------------------------
// setup | submission | * ASSESSMENT | evaluation | closed
//---------------------------------------------------------
$phase = new stdclass();
$phase->title = get_string('phaseassessment', 'workshop');
$phase->tasks = array();
$phase->isreviewer = has_capability('mod/workshop:peerassess', $workshop->context, $userid);
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();
$task->title = get_string('exampleassesstask', 'workshop');
$examples = $workshop->get_examples_for_reviewer($userid);
@ -1813,83 +1910,13 @@ class workshop_user_plan implements renderable {
$task->details = get_string('exampleassesstaskdetails', 'workshop', $a);
if ($a->assessed == $a->expected) {
$task->completed = true;
} elseif ($this->workshop->phase >= workshop::PHASE_ASSESSMENT) {
} elseif ($workshop->phase > workshop::PHASE_ASSESSMENT) {
$task->completed = false;
}
$phase->tasks['examples'] = $task;
}
if (has_capability('mod/workshop:submit', $this->workshop->context, $userid, false)) {
$task = new stdclass();
$task->title = get_string('tasksubmit', 'workshop');
$task->link = $this->workshop->submission_url();
if ($DB->record_exists('workshop_submissions', array('workshopid'=>$this->workshop->id, 'example'=>0, 'authorid'=>$userid))) {
$task->completed = true;
} elseif ($this->workshop->phase >= workshop::PHASE_ASSESSMENT) {
$task->completed = false;
} else {
$task->completed = null; // still has a chance to submit
}
$phase->tasks['submit'] = $task;
}
if (has_capability('mod/workshop:allocate', $this->workshop->context, $userid)) {
$task = new stdclass();
$task->title = get_string('allocate', 'workshop');
$task->link = $this->workshop->allocation_url();
$numofauthors = count(get_users_by_capability($this->workshop->context, 'mod/workshop:submit', 'u.id', '', '', '',
'', '', false, true));
$numofsubmissions = $DB->count_records('workshop_submissions', array('workshopid'=>$this->workshop->id, 'example'=>0));
$sql = 'SELECT COUNT(s.id) AS nonallocated
FROM {workshop_submissions} s
LEFT JOIN {workshop_assessments} a ON (a.submissionid=s.id)
WHERE s.workshopid = :workshopid AND s.example=0 AND a.submissionid IS NULL';
$params['workshopid'] = $this->workshop->id;
$numnonallocated = $DB->count_records_sql($sql, $params);
if ($numofsubmissions == 0) {
$task->completed = null;
} elseif ($numnonallocated == 0) {
$task->completed = true;
} elseif ($this->workshop->phase > workshop::PHASE_SUBMISSION) {
$task->completed = false;
} else {
$task->completed = null; // still has a chance to allocate
}
$a = new stdclass();
$a->expected = $numofauthors;
$a->submitted = $numofsubmissions;
$a->allocate = $numnonallocated;
$task->details = get_string('allocatedetails', 'workshop', $a);
unset($a);
$phase->tasks['allocate'] = $task;
if ($numofsubmissions < $numofauthors and $this->workshop->phase >= workshop::PHASE_SUBMISSION) {
$task = new stdclass();
$task->title = get_string('someuserswosubmission', 'workshop');
$task->completed = 'info';
$phase->tasks['allocateinfo'] = $task;
}
}
if ($this->workshop->submissionstart) {
$task = new stdclass();
$task->title = get_string('submissionstartdatetime', 'workshop', workshop::timestamp_formats($this->workshop->submissionstart));
$task->completed = 'info';
$phase->tasks['submissionstartdatetime'] = $task;
}
if ($this->workshop->submissionend) {
$task = new stdclass();
$task->title = get_string('submissionenddatetime', 'workshop', workshop::timestamp_formats($this->workshop->submissionend));
$task->completed = 'info';
$phase->tasks['submissionenddatetime'] = $task;
}
$this->phases[workshop::PHASE_SUBMISSION] = $phase;
//---------------------------------------------------------
// setup | submission | * ASSESSMENT | evaluation | closed
//---------------------------------------------------------
$phase = new stdclass();
$phase->title = get_string('phaseassessment', 'workshop');
$phase->tasks = array();
$phase->isreviewer = has_capability('mod/workshop:peerassess', $this->workshop->context, $userid);
$phase->assessments = $this->workshop->get_assessments_by_reviewer($userid);
if (empty($phase->tasks['examples']) or !empty($phase->tasks['examples']->completed)) {
$phase->assessments = $workshop->get_assessments_by_reviewer($userid);
$numofpeers = 0; // number of allocated peer-assessments
$numofpeerstodo = 0; // number of peer-assessments to do
$numofself = 0; // number of allocated self-assessments - should be 0 or 1
@ -1908,11 +1935,11 @@ class workshop_user_plan implements renderable {
}
}
unset($a);
if ($this->workshop->usepeerassessment and $numofpeers) {
if ($workshop->usepeerassessment and $numofpeers) {
$task = new stdclass();
if ($numofpeerstodo == 0) {
$task->completed = true;
} elseif ($this->workshop->phase > workshop::PHASE_ASSESSMENT) {
} elseif ($workshop->phase > workshop::PHASE_ASSESSMENT) {
$task->completed = false;
}
$a = new stdclass();
@ -1923,25 +1950,26 @@ class workshop_user_plan implements renderable {
unset($a);
$phase->tasks['assesspeers'] = $task;
}
if ($this->workshop->useselfassessment and $numofself) {
if ($workshop->useselfassessment and $numofself) {
$task = new stdclass();
if ($numofselftodo == 0) {
$task->completed = true;
} elseif ($this->workshop->phase > workshop::PHASE_ASSESSMENT) {
} elseif ($workshop->phase > workshop::PHASE_ASSESSMENT) {
$task->completed = false;
}
$task->title = get_string('taskassessself', 'workshop');
$phase->tasks['assessself'] = $task;
}
if ($this->workshop->assessmentstart) {
}
if ($workshop->assessmentstart) {
$task = new stdclass();
$task->title = get_string('assessmentstartdatetime', 'workshop', workshop::timestamp_formats($this->workshop->assessmentstart));
$task->title = get_string('assessmentstartdatetime', 'workshop', workshop::timestamp_formats($workshop->assessmentstart));
$task->completed = 'info';
$phase->tasks['assessmentstartdatetime'] = $task;
}
if ($this->workshop->assessmentend) {
if ($workshop->assessmentend) {
$task = new stdclass();
$task->title = get_string('assessmentenddatetime', 'workshop', workshop::timestamp_formats($this->workshop->assessmentend));
$task->title = get_string('assessmentenddatetime', 'workshop', workshop::timestamp_formats($workshop->assessmentend));
$task->completed = 'info';
$phase->tasks['assessmentenddatetime'] = $task;
}
@ -1953,10 +1981,10 @@ class workshop_user_plan implements renderable {
$phase = new stdclass();
$phase->title = get_string('phaseevaluation', 'workshop');
$phase->tasks = array();
if (has_capability('mod/workshop:overridegrades', $this->workshop->context)) {
$expected = count($this->workshop->get_potential_authors(false));
if (has_capability('mod/workshop:overridegrades', $workshop->context)) {
$expected = count($workshop->get_potential_authors(false));
$calculated = $DB->count_records_select('workshop_submissions',
'workshopid = ? AND (grade IS NOT NULL OR gradeover IS NOT NULL)', array($this->workshop->id));
'workshopid = ? AND (grade IS NOT NULL OR gradeover IS NOT NULL)', array($workshop->id));
$task = new stdclass();
$task->title = get_string('calculatesubmissiongrades', 'workshop');
$a = new stdclass();
@ -1965,14 +1993,14 @@ class workshop_user_plan implements renderable {
$task->details = get_string('calculatesubmissiongradesdetails', 'workshop', $a);
if ($calculated >= $expected) {
$task->completed = true;
} elseif ($this->workshop->phase > workshop::PHASE_EVALUATION) {
} elseif ($workshop->phase > workshop::PHASE_EVALUATION) {
$task->completed = false;
}
$phase->tasks['calculatesubmissiongrade'] = $task;
$expected = count($this->workshop->get_potential_reviewers(false));
$expected = count($workshop->get_potential_reviewers(false));
$calculated = $DB->count_records_select('workshop_aggregations',
'workshopid = ? AND gradinggrade IS NOT NULL', array($this->workshop->id));
'workshopid = ? AND gradinggrade IS NOT NULL', array($workshop->id));
$task = new stdclass();
$task->title = get_string('calculategradinggrades', 'workshop');
$a = new stdclass();
@ -1981,12 +2009,12 @@ class workshop_user_plan implements renderable {
$task->details = get_string('calculategradinggradesdetails', 'workshop', $a);
if ($calculated >= $expected) {
$task->completed = true;
} elseif ($this->workshop->phase > workshop::PHASE_EVALUATION) {
} elseif ($workshop->phase > workshop::PHASE_EVALUATION) {
$task->completed = false;
}
$phase->tasks['calculategradinggrade'] = $task;
} elseif ($this->workshop->phase == workshop::PHASE_EVALUATION) {
} elseif ($workshop->phase == workshop::PHASE_EVALUATION) {
$task = new stdclass();
$task->title = get_string('evaluategradeswait', 'workshop');
$task->completed = 'info';
@ -2006,7 +2034,7 @@ class workshop_user_plan implements renderable {
foreach ($this->phases as $phasecode => $phase) {
$phase->title = isset($phase->title) ? $phase->title : '';
$phase->tasks = isset($phase->tasks) ? $phase->tasks : array();
if ($phasecode == $this->workshop->phase) {
if ($phasecode == $workshop->phase) {
$phase->active = true;
} else {
$phase->active = false;
@ -2024,15 +2052,30 @@ class workshop_user_plan implements renderable {
}
// Add phase swithing actions
if (has_capability('mod/workshop:switchphase', $this->workshop->context, $userid)) {
if (has_capability('mod/workshop:switchphase', $workshop->context, $userid)) {
foreach ($this->phases as $phasecode => $phase) {
if (! $phase->active) {
$action = new stdclass();
$action->type = 'switchphase';
$action->url = $this->workshop->switchphase_url($phasecode);
$action->url = $workshop->switchphase_url($phasecode);
$phase->actions[] = $action;
}
}
}
}
/**
* Returns example submissions to be assessed by the owner of the planner
*
* This is here to cache the DB query because the same list is needed later in view.php
*
* @see workshop::get_examples_for_reviewer() for the format of returned value
* @return array
*/
public function get_examples() {
if (is_null($this->examples)) {
$this->examples = $this->workshop->get_examples_for_reviewer($this->userid);
}
return $this->examples;
}
}

View file

@ -60,7 +60,7 @@ $cansubmit = has_capability('mod/workshop:submit', $workshop->context);
$canallocate = has_capability('mod/workshop:allocate', $workshop->context);
$canoverride = (($workshop->phase == workshop::PHASE_EVALUATION) and has_capability('mod/workshop:overridegrades', $workshop->context));
$isreviewer = $DB->record_exists('workshop_assessments', array('submissionid' => $submission->id, 'reviewerid' => $USER->id));
$editable = $cansubmit and $ownsubmission and $workshop->submitting_allowed();
$editable = ($cansubmit and $ownsubmission and $workshop->submitting_allowed());
if ($editable and $workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_SUBMISSION
and !has_capability('mod/workshop:manageexamples', $workshop->context)) {
// check that all required examples have been assessed by the user

View file

@ -58,12 +58,13 @@ $PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$output = $PAGE->get_renderer('mod_workshop');
$userplan = new workshop_user_plan($workshop, $USER->id);
/// Output starts here
echo $output->header();
echo $output->heading_with_help(format_string($workshop->name), 'userplan', 'workshop');
echo $output->render(new workshop_user_plan($workshop, $USER->id));
echo $output->render($userplan);
switch ($workshop->phase) {
case workshop::PHASE_SETUP:
@ -101,11 +102,11 @@ case workshop::PHASE_SUBMISSION:
print_collapsible_region_end();
}
$examplesdone = !$workshop->useexamples;
$examplesdone = (!$workshop->useexamples or has_capability('mod/workshop:manageexamples', $workshop->context));
if ($workshop->assessing_examples_allowed()
and has_capability('mod/workshop:submit', $workshop->context)
and ! has_capability('mod/workshop:manageexamples', $workshop->context)) {
$examples = $workshop->get_examples_for_reviewer($USER->id);
$examples = $userplan->get_examples();
$total = count($examples);
$left = 0;
// make sure the current user has all examples allocated
@ -122,7 +123,7 @@ case workshop::PHASE_SUBMISSION:
} else {
$examplesdone = true;
}
print_collapsible_region_start('', 'workshop-viewlet-examples', get_string('exampleassessments', 'workshop'));
print_collapsible_region_start('', 'workshop-viewlet-examples', get_string('exampleassessments', 'workshop'), false, $examplesdone);
echo $output->box_start('generalbox exampleassessments');
if ($total == 0) {
echo $output->heading(get_string('noexamples', 'workshop'), 3);
@ -207,6 +208,41 @@ case workshop::PHASE_ASSESSMENT:
echo $output->box(format_text($instructions, $workshop->instructreviewersformat), array('generalbox', 'instructions'));
print_collapsible_region_end();
}
$examplesdone = (!$workshop->useexamples or has_capability('mod/workshop:manageexamples', $workshop->context));
if ($workshop->assessing_examples_allowed()
and has_capability('mod/workshop:submit', $workshop->context)
and ! has_capability('mod/workshop:manageexamples', $workshop->context)) {
$examples = $userplan->get_examples();
$total = count($examples);
$left = 0;
// make sure the current user has all examples allocated
foreach ($examples as $exampleid => $example) {
if (is_null($example->assessmentid)) {
$examples[$exampleid]->assessmentid = $workshop->add_allocation($example, $USER->id, 0);
}
if (is_null($example->grade)) {
$left++;
}
}
if ($left > 0 and $workshop->examplesmode != workshop::EXAMPLES_VOLUNTARY) {
$examplesdone = false;
} else {
$examplesdone = true;
}
print_collapsible_region_start('', 'workshop-viewlet-examples', get_string('exampleassessments', 'workshop'), false, $examplesdone);
echo $output->box_start('generalbox exampleassessments');
if ($total == 0) {
echo $output->heading(get_string('noexamples', 'workshop'), 3);
} else {
foreach ($examples as $example) {
$summary = $workshop->prepare_example_summary($example);
echo $output->example_summary($summary);
}
}
echo $output->box_end();
print_collapsible_region_end();
}
if ($examplesdone) {
print_collapsible_region_start('', 'workshop-viewlet-assignedassessments', get_string('assignedassessments', 'workshop'));
if (! $assessments = $workshop->get_assessments_by_reviewer($USER->id)) {
echo $output->box_start('generalbox assessment-none');
@ -243,6 +279,7 @@ case workshop::PHASE_ASSESSMENT:
}
}
print_collapsible_region_end();
}
break;
case workshop::PHASE_EVALUATION:
if (has_capability('mod/workshop:viewallassessments', $PAGE->context)) {