public function test_prepare_example_reference_assessment() { global $USER; $this->resetAfterTest(true); // fixture setup $fakerawrecord = (object) array('id' => 38, 'submissionid' => 56, 'weight' => 1, 'timecreated' => time() - 100, 'timemodified' => time() - 50, 'grade' => 0.75, 'gradinggrade' => 1.0, 'gradinggradeover' => null, 'feedbackauthor' => null, 'feedbackauthorformat' => 0, 'feedbackauthorattachment' => 0); // excersise SUT $a = $this->workshop->prepare_example_reference_assessment($fakerawrecord); // verify $this->assertTrue($a instanceof workshop_example_reference_assessment); // modify setup $fakerawrecord->weight = 0; $this->expectException('coding_exception'); // excersise SUT $a = $this->workshop->prepare_example_reference_assessment($fakerawrecord); }
'mod_workshop', 'instructreviewers', 0, workshop::instruction_editors_options($PAGE->context)); print_collapsible_region_start('', 'workshop-viewlet-instructreviewers', get_string('instructreviewers', 'workshop')); echo $output->box(format_text($instructions, $workshop->instructreviewersformat, array('overflowdiv'=>true)), array('generalbox', 'instructions')); print_collapsible_region_end(); } // extend the current assessment record with user details $assessment = $workshop->get_assessment_by_id($assessment->id); if ($canmanage and $assessment->weight == 1) { $options = array( 'showreviewer' => false, 'showauthor' => false, 'showform' => true, ); $assessment = $workshop->prepare_example_reference_assessment($assessment, $mform, $options); $assessment->title = get_string('assessmentreference', 'workshop'); echo $output->render($assessment); } else if ($isreviewer) { $options = array( 'showreviewer' => true, 'showauthor' => false, 'showform' => true, ); $assessment = $workshop->prepare_example_assessment($assessment, $mform, $options); $assessment->title = get_string('assessmentbyyourself', 'workshop'); echo $output->render($assessment); } else if ($canmanage) { $options = array(
} else { print_error('nopermissions', 'error', $workshop->view_url(), 'compare example assessment'); } $PAGE->set_title($workshop->name); $PAGE->set_heading($course->fullname); $PAGE->navbar->add(get_string('examplecomparing', 'workshop')); // Output starts here $output = $PAGE->get_renderer('mod_workshop'); echo $output->header(); echo $output->heading(format_string($workshop->name)); echo $output->heading(get_string('assessedexample', 'workshop'), 3); echo $output->render($workshop->prepare_example_submission($example)); // if the reference assessment is available, display it if (!empty($mformreference)) { $options = array('showreviewer' => false, 'showauthor' => false, 'showform' => true); $reference = $workshop->prepare_example_reference_assessment($reference, $mformreference, $options); $reference->title = get_string('assessmentreference', 'workshop'); if ($canmanage) { $reference->url = $workshop->exassess_url($reference->id); } echo $output->render($reference); } if ($isreviewer) { $options = array('showreviewer' => true, 'showauthor' => false, 'showform' => true); $assessment = $workshop->prepare_example_assessment($assessment, $mformassessment, $options); $assessment->title = get_string('assessmentbyyourself', 'workshop'); if ($workshop->assessing_examples_allowed()) { $assessment->add_action(new moodle_url($workshop->exsubmission_url($example->id), array('assess' => 'on', 'sesskey' => sesskey())), get_string('reassess', 'workshop')); } echo $output->render($assessment); } elseif ($canmanage) {