Beispiel #1
0
$sid = required_param('sid', PARAM_INT);
// example submission id
$aid = required_param('aid', PARAM_INT);
// the user's assessment id
$cm = get_coursemodule_from_id('teamwork', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
if (isguestuser()) {
    print_error('guestsarenotallowed');
}
$teamwork = $DB->get_record('teamwork', array('id' => $cm->instance), '*', MUST_EXIST);
$teamwork = new teamwork($teamwork, $cm, $course);
$strategy = $teamwork->grading_strategy_instance();
$PAGE->set_url($teamwork->excompare_url($sid, $aid));
$example = $teamwork->get_example_by_id($sid);
$assessment = $teamwork->get_assessment_by_id($aid);
if ($assessment->submissionid != $example->id) {
    print_error('invalidarguments');
}
$mformassessment = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, false);
if ($refasid = $DB->get_field('teamwork_assessments', 'id', array('submissionid' => $example->id, 'weight' => 1))) {
    $reference = $teamwork->get_assessment_by_id($refasid);
    $mformreference = $strategy->get_assessment_form($PAGE->url, 'assessment', $reference, false);
}
$canmanage = has_capability('mod/teamwork:manageexamples', $teamwork->context);
$isreviewer = $USER->id == $assessment->reviewerid;
if ($canmanage) {
    // ok you can go
} elseif ($isreviewer and $teamwork->assessing_examples_allowed()) {
    // ok you can go
} else {
Beispiel #2
0
echo $output->header();
echo $output->heading(format_string($teamwork->name));
echo $output->heading(get_string('assessedexample', 'teamwork'), 3);
$example = $teamwork->get_example_by_id($example->id);
// reload so can be passed to the renderer
echo $output->render($teamwork->prepare_example_submission($example));
// show instructions for assessing as thay may contain important information
// for evaluating the assessment
if (trim($teamwork->instructreviewers)) {
    $instructions = file_rewrite_pluginfile_urls($teamwork->instructreviewers, 'pluginfile.php', $PAGE->context->id, 'mod_teamwork', 'instructreviewers', 0, teamwork::instruction_editors_options($PAGE->context));
    print_collapsible_region_start('', 'teamwork-viewlet-instructreviewers', get_string('instructreviewers', 'teamwork'));
    echo $output->box(format_text($instructions, $teamwork->instructreviewersformat, array('overflowdiv' => true)), array('generalbox', 'instructions'));
    print_collapsible_region_end();
}
// extend the current assessment record with user details
$assessment = $teamwork->get_assessment_by_id($assessment->id);
if ($canmanage and $assessment->weight == 1) {
    $options = array('showreviewer' => false, 'showauthor' => false, 'showform' => true);
    $assessment = $teamwork->prepare_example_reference_assessment($assessment, $mform, $options);
    $assessment->title = get_string('assessmentreference', 'teamwork');
    echo $output->render($assessment);
} else {
    if ($isreviewer) {
        $options = array('showreviewer' => true, 'showauthor' => false, 'showform' => true);
        $assessment = $teamwork->prepare_example_assessment($assessment, $mform, $options);
        $assessment->title = get_string('assessmentbyyourself', 'teamwork');
        echo $output->render($assessment);
    } else {
        if ($canmanage) {
            $options = array('showreviewer' => true, 'showauthor' => false, 'showform' => true, 'showweight' => false);
            $assessment = $teamwork->prepare_example_assessment($assessment, $mform, $options);