echo $OUTPUT->header();
$allocators = $workshop->installed_allocators();
-$tabrow = array();
-foreach ($allocators as $methodid => $methodname) {
- $tabrow[] = new tabobject($methodid, "allocation.php?cmid={$cmid}&method={$methodid}", $methodname);
-}
-print_tabs(array($tabrow), $method); // todo use $output call
+$currenttab = 'allocation';
+include(dirname(__FILE__) . '/tabs.php');
if (!empty($initresult)) {
echo $OUTPUT->container_start('allocator-init-results');
$exclude = array();
if (!$workshop->useselfassessment) {
$exclude[$user->id] = true;
+ $o .= $this->output->container(get_string('selfassessmentdisabled', 'workshop'), 'info');
}
// todo add an option to exclude users without own submission
// todo nice to have number of current allocations for every user plus ordering by it
$removecurrent = required_param('removecurrent', PARAM_INT);
$assesswosubmission = required_param('assesswosubmission', PARAM_INT);
$musthavesubmission = empty($assesswosubmission);
- $addselfassessment = required_param('addselfassessment', PARAM_INT);
+ $addselfassessment = optional_param('addselfassessment', false, PARAM_INT); // may be frozen in the form
$authors = $this->workshop->get_peer_authors();
$authors = $this->workshop->get_grouped($authors);
$mform->addElement('advcheckbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random'));
$mform->setDefault('assesswosubmission', 0);
- $mform->addElement('advcheckbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'));
+ $grpselfassessment = array();
+ $grpselfassessment[] = $mform->createElement('advcheckbox', 'addselfassessment');
$mform->setDefault('addselfassessment', 0);
+ if (!$workshop->useselfassessment) {
+ $grpselfassessment[] = $mform->createElement('static', 'selfassessmentcheck', '',
+ get_string('selfassessmentdisabled', 'workshop'));
+ }
+ $mform->addGroup($grpselfassessment, 'grpselfassessment', get_string('addselfassessment', 'workshopallocation_random'));
+ if (!$workshop->useselfassessment) {
+ $mform->freeze(array('grpselfassessment'));
+ }
$this->add_action_buttons();
}
// no break, skip to default
default:
echo $OUTPUT->header();
+ $currenttab = 'develtools';
+ include(dirname(__FILE__) . '/tabs.php');
echo $OUTPUT->heading('Workshop development tools', 1);
echo '<ul>';
echo '<li><a href="' . $PAGE->url->out(false, array('tool' => 'mksubmissions')) . '">Fake submissions</a></li>';
$string[''] = '';
$string[''] = '';
$string[''] = '';
-$string['info'] = 'Info';
-$string['undersetup'] = 'The workshop is currently under setup. Please wait until it is switched to the next phase.';
-$string['taskinstructreviewers'] = 'Provide instructions for grading';
-$string['taskinstructauthors'] = 'Provide instructions for submitting';
-$string['taskintro'] = 'Set the workshop introduction';
-$string['phaseclosed'] = 'Closed';
-$string['phaseevaluation'] = 'Grading evaluation phase';
-$string['phaseassessment'] = 'Assessment phase';
-$string['phasesubmission'] = 'Submission phase';
-$string['phasesetup'] = 'Setup phase';
-$string['taskassessself'] = 'Assess yourself';
-$string['taskassesspeers'] = 'Assess peers';
-$string['allocatedetails'] = 'submissions: $a->total<br />allocated: $a->done';
-$string['taskassesspeersdetails'] = 'total: $a->total<br />pending: $a->todo';
-$string['tasksubmit'] = 'Submit your work';
$string['accesscontrol'] = 'Access control';
$string['agreeassessments'] = 'Assessments must be agreed';
$string['agreeassessmentsdesc'] = 'Authors may comment assessments of their work and agree/disagree with it';
$string['allocate'] = 'Allocate submissions';
+$string['allocatedetails'] = 'expected: $a->expected<br />submitted: $a->submitted<br />allocated: $a->allocated';
$string['allocationdone'] = 'Allocation done';
$string['allocationerror'] = 'Allocation error';
$string['allocation'] = 'Submission allocation';
$string['gradingsettings'] = 'Grading settings';
$string['chooseuser'] = 'Choose user...';
$string['iamsure'] = 'Yes, I am sure';
+$string['info'] = 'Info';
$string['introduction'] = 'Introduction';
$string['latesubmissionsdesc'] = 'Allow submitting the work after the deadline';
$string['latesubmissions'] = 'Late submissions';
$string['participant'] = 'Participant';
$string['participantrevierof'] = 'Participant is reviewer of';
$string['participantreviewedby'] = 'Participant is reviewed by';
+$string['phaseassessment'] = 'Assessment phase';
+$string['phaseclosed'] = 'Closed';
+$string['phaseevaluation'] = 'Grading evaluation phase';
+$string['phasesetup'] = 'Setup phase';
+$string['phasesubmission'] = 'Submission phase';
$string['previewassessmentform'] = 'Preview';
$string['releasegrades'] = 'Push final grades into the gradebook';
$string['saveandclose'] = 'Save and close';
$string['saveandcontinue'] = 'Save and continue editing';
$string['saveandpreview'] = 'Save and preview';
+$string['selfassessmentdisabled'] = 'Self-assessment disabled';
$string['strategyaccumulative'] = 'Accumulative grading';
$string['strategydummy'] = 'Dummy strategy';
$string['strategy'] = 'Grading strategy';
$string['submissionstart'] = 'Start of submission phase';
$string['submission'] = 'Submission';
$string['submissiontitle'] = 'Title';
+$string['taskassesspeers'] = 'Assess peers';
+$string['taskassesspeersdetails'] = 'total: $a->total<br />pending: $a->todo';
+$string['taskassessself'] = 'Assess yourself';
+$string['taskinstructauthors'] = 'Provide instructions for submitting';
+$string['taskinstructreviewers'] = 'Provide instructions for grading';
+$string['taskintro'] = 'Set the workshop introduction';
+$string['tasksubmit'] = 'Submit your work';
$string['teacherweight'] = 'Weight of the teacher\'s assessments';
+$string['undersetup'] = 'The workshop is currently under setup. Please wait until it is switched to the next phase.';
$string['useexamplesdesc'] = 'Users practise evaluating on example submissions';
$string['useexamples'] = 'Use examples';
$string['usepeerassessmentdesc'] = 'Users perform peer assessment of others\' work';
* This returns the list of all users who can submit their work or review submissions (or both
* which is the common case). So basically this is to return list of all students participating
* in the workshop. For every participant, it adds information about their submission and their
- * reviews.
+ * reviews, if such information is available (null elsewhere).
*
* The returned structure is recordset of objects with following properties:
* [authorid] [authorfirstname] [authorlastname] [authorpicture] [authorimagealt]
LEFT JOIN {workshop_submissions} s ON (s.userid = author.id)
LEFT JOIN {workshop_assessments} a ON (s.id = a.submissionid)
LEFT JOIN {user} reviewer ON (a.userid = reviewer.id)
- WHERE author.id $usql AND s.workshopid = :workshopid
+ WHERE author.id $usql AND (s.id IS NULL OR s.workshopid = :workshopid)
ORDER BY author.lastname,author.firstname,reviewer.lastname,reviewer.firstname";
-
+
return $DB->get_recordset_sql($sql, $params);
}
$task->title = get_string('allocate', 'workshop');
$task->link = $this->allocation_url();
$rs = $this->get_allocations_recordset();
+ $authors = array();
$allocations = array(); // 'submissionid' => isallocated
foreach ($rs as $allocation) {
- if (!isset($allocations[$allocation->submissionid])) {
- $allocations[$allocation->submissionid] = false;
+ if (!isset($authors[$allocation->authorid])) {
+ $authors[$allocation->authorid] = true;
}
- if (!empty($allocation->reviewerid)) {
- $allocations[$allocation->submissionid] = true;
+ if (isset($allocation->submissionid)) {
+ if (!isset($allocations[$allocation->submissionid])) {
+ $allocations[$allocation->submissionid] = false;
+ }
+ if (!empty($allocation->reviewerid)) {
+ $allocations[$allocation->submissionid] = true;
+ }
}
}
+ $numofauthors = count($authors);
$numofsubmissions = count($allocations);
$numofallocated = count(array_filter($allocations));
$rs->close();
if ($numofsubmissions == 0) {
$task->completed = null;
- } elseif ($numofsubmissions == $numofallocated) {
+ } elseif ($numofauthors == $numofallocated) {
$task->completed = true;
} elseif ($this->phase > self::PHASE_SUBMISSION) {
$task->completed = false;
$task->completed = null; // still has a chance to allocate
}
$a = new stdClass();
- $a->total = $numofsubmissions;
- $a->done = $numofallocated;
- $task->details = get_string('allocatedetails', 'workshop', $a);
+ $a->expected = $numofauthors;
+ $a->submitted = $numofsubmissions;
+ $a->allocated = $numofallocated;
+ $task->details = get_string('allocatedetails', 'workshop', $a);
unset($a);
- $phase->tasks['submit'] = $task;
+ $phase->tasks['allocate'] = $task;
}
// Prepare tasks for the peer-assessment phase (includes eventual self-assessments)
if (has_capability('mod/workshop:submit', $workshop->context)) {
$row[] = new tabobject('submission', $workshop->submission_url()->out(), get_string('editsubmission', 'workshop'));
}
+if (has_capability('mod/workshop:allocate', $workshop->context)) {
+ $row[] = new tabobject('allocation', $workshop->allocation_url()->out(), get_string('allocate', 'workshop'));
+}
+if (has_capability('moodle/site:config', get_system_context())) {
+ // todo remove these tools from a production release
+ $row[] = new tabobject('develtools', "develtools.php?cmid={$cm->id}", 'Development tools');
+}
$tabs[] = $row;
+if ($currenttab == 'allocation' and !empty($allocators)) {
+ // this is included from allocation.php so we rely of some variables defined there
+ $activated[] = 'allocation';
+ $row = array();
+ foreach ($allocators as $methodid => $methodname) {
+ $row[] = new tabobject($methodid, "allocation.php?cmid={$cmid}&method={$methodid}", $methodname);
+ if ($methodid == $method) {
+ $currenttab = $methodid;
+ }
+ }
+ $tabs[] = $row;
+}
+
+
print_tabs($tabs, $currenttab, $inactive, $activated);
default:
}
-
-/// Print the main part of the page - todo these are just links to help during development
-echo $OUTPUT->box_start();
-echo $OUTPUT->heading('Workshop testing', 1);
-echo "<ol>\n";
-echo '<li><a href="' . $workshop->editform_url()->out() . '">Edit grading form (' . get_string('pluginname', 'workshopgrading_' . $workshop->strategy) . ')</a></li>' . "\n";
-echo "<li><a href=\"submission.php?cmid={$cm->id}\">View/edit your own submission</a></li>\n";
-echo "<li><a href=\"develtools.php?tool=mksubmissions&cmid={$cm->id}\">Fake others' submissions</a></li>\n";
-echo "<li><a href=\"allocation.php?cmid={$cm->id}\">Allocate submissions</a></li>\n";
-
-$assessments = $workshop->get_assessments($USER->id);
-echo "<li>Assess submissions\n";
-echo "<ol>\n";
-foreach ($assessments as $assessment) {
- echo "<li><a href=\"assessment.php?asid={$assessment->id}\">Assessment of '{$assessment->title}' by {$assessment->authorid}</a></li>" . "\n";
-}
-echo "</ol></li>" . "\n";
-echo "</ol>\n";
-echo "<p><a href=\"develtools.php?cmid={$cm->id}\">Workshop development tools</a></p>\n";
-echo $OUTPUT->box_end();
-
echo $OUTPUT->footer();