Example #1
0
} else {
    print_error('nopermissions', 'error', $teamwork->view_url(), 'view or manage example submission');
}
if ($id and $delete and $confirm and $canmanage) {
    require_sesskey();
    $teamwork->delete_submission($example);
    redirect($teamwork->view_url());
}
if ($id and $assess and $canmanage) {
    // reference assessment of an example is the assessment with the weight = 1. There should be just one
    // such assessment
    require_sesskey();
    if (!$refasid) {
        $refasid = $teamwork->add_allocation($example, $USER->id, 1);
    }
    redirect($teamwork->exassess_url($refasid));
}
if ($id and $assess and $canassess) {
    // training assessment of an example is the assessment with the weight = 0
    require_sesskey();
    $asid = $DB->get_field('teamwork_assessments', 'id', array('submissionid' => $example->id, 'weight' => 0, 'reviewerid' => $USER->id));
    if (!$asid) {
        $asid = $teamwork->add_allocation($example, $USER->id, 0);
    }
    if ($asid == teamwork::ALLOCATION_EXISTS) {
        // the training assessment of the example was not found but the allocation already
        // exists. this probably means that the user is the author of the reference assessment.
        echo $output->header();
        echo $output->box(get_string('assessmentreferenceconflict', 'teamwork'));
        echo $output->continue_button($teamwork->view_url());
        echo $output->footer();
Example #2
0
$PAGE->set_title($teamwork->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('examplecomparing', 'teamwork'));
// Output starts here
$output = $PAGE->get_renderer('mod_teamwork');
echo $output->header();
echo $output->heading(format_string($teamwork->name));
echo $output->heading(get_string('assessedexample', 'teamwork'), 3);
echo $output->render($teamwork->prepare_example_submission($example));
// if the reference assessment is available, display it
if (!empty($mformreference)) {
    $options = array('showreviewer' => false, 'showauthor' => false, 'showform' => true);
    $reference = $teamwork->prepare_example_reference_assessment($reference, $mformreference, $options);
    $reference->title = get_string('assessmentreference', 'teamwork');
    if ($canmanage) {
        $reference->url = $teamwork->exassess_url($reference->id);
    }
    echo $output->render($reference);
}
if ($isreviewer) {
    $options = array('showreviewer' => true, 'showauthor' => false, 'showform' => true);
    $assessment = $teamwork->prepare_example_assessment($assessment, $mformassessment, $options);
    $assessment->title = get_string('assessmentbyyourself', 'teamwork');
    if ($teamwork->assessing_examples_allowed()) {
        $assessment->add_action(new moodle_url($teamwork->exsubmission_url($example->id), array('assess' => 'on', 'sesskey' => sesskey())), get_string('reassess', 'teamwork'));
    }
    echo $output->render($assessment);
} elseif ($canmanage) {
    $options = array('showreviewer' => true, 'showauthor' => false, 'showform' => true);
    $assessment = $teamwork->prepare_example_assessment($assessment, $mformassessment, $options);
    echo $output->render($assessment);
Example #3
0
 */
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once dirname(__FILE__) . '/locallib.php';
$asid = required_param('asid', PARAM_INT);
// assessment id
$assessment = $DB->get_record('teamwork_assessments', array('id' => $asid), '*', MUST_EXIST);
$example = $DB->get_record('teamwork_submissions', array('id' => $assessment->submissionid, 'example' => 1), '*', MUST_EXIST);
$teamwork = $DB->get_record('teamwork', array('id' => $example->teamworkid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $teamwork->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('teamwork', $teamwork->id, $course->id, false, MUST_EXIST);
require_login($course, false, $cm);
if (isguestuser()) {
    print_error('guestsarenotallowed');
}
$teamwork = new teamwork($teamwork, $cm, $course);
$PAGE->set_url($teamwork->exassess_url($assessment->id));
$PAGE->set_title($teamwork->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('assessingexample', 'teamwork'));
$currenttab = 'assessment';
$canmanage = has_capability('mod/teamwork:manageexamples', $teamwork->context);
$isreviewer = $USER->id == $assessment->reviewerid;
if ($isreviewer or $canmanage) {
    // such a user can continue
} else {
    print_error('nopermissions', 'error', $teamwork->view_url(), 'assess example submission');
}
// only the reviewer is allowed to modify the assessment
if ($canmanage and $assessment->weight == 1 or $isreviewer and $teamwork->assessing_examples_allowed()) {
    $assessmenteditable = true;
} else {