Permalink
Browse files

MDL-27550 workshop: assessments are now displayed via proper renderin…

…g subsystem

AMOS BEGIN
 MOV [assessmentbyknown,mod_workshop],[assessmentbyfullname,mod_workshop]
AMOS END
  • Loading branch information...
1 parent 3675dbc commit c9f31ba3a3832632772cd026ac65b74ff1b07000 @mudrd8mz mudrd8mz committed Jul 28, 2011
@@ -182,24 +182,33 @@
print_collapsible_region_end();
}
+// extend the current assessment record with user details
+$assessment = $workshop->get_assessment_by_id($assessment->id);
+
if ($isreviewer) {
- echo $output->heading(get_string('assessmentbyyourself', 'workshop'), 2);
-} elseif (has_capability('mod/workshop:viewreviewernames', $workshop->context)) {
- $assessment = $workshop->get_assessment_by_id($assessment->id); // extend the current record with user details
- $reviewer = new stdclass();
- $reviewer->firstname = $assessment->reviewerfirstname;
- $reviewer->lastname = $assessment->reviewerlastname;
- echo $output->heading(get_string('assessmentbyknown', 'workshop', fullname($reviewer)), 2);
-} else {
- echo $output->heading(get_string('assessmentbyunknown', 'workshop'), 2);
-}
+ $options = array(
+ 'showreviewer' => true,
+ 'showauthor' => has_capability('mod/workshop:viewauthornames', $workshop->context),
+ 'showform' => $assessmenteditable or !is_null($assessment->grade),
+ 'showweight' => true,
+ );
+ $assessment = $workshop->prepare_assessment($assessment, $mform, $options);
+ $assessment->title = get_string('assessmentbyyourself', 'workshop');
+ echo $output->render($assessment);
-if ($mform) {
- $mform->display();
} else {
- echo $output->heading(get_string('notassessed', 'workshop'));
+ $options = array(
+ 'showreviewer' => has_capability('mod/workshop:viewreviewernames', $workshop->context),
+ 'showauthor' => has_capability('mod/workshop:viewauthornames', $workshop->context),
+ 'showform' => $assessmenteditable or !is_null($assessment->grade),
+ 'showweight' => true,
+ );
+ $assessment = $workshop->prepare_assessment($assessment, $mform, $options);
+ echo $output->render($assessment);
}
-if ($canoverridegrades) {
+
+if (!$assessmenteditable and $canoverridegrades) {
$feedbackform->display();
}
+
echo $output->footer();
@@ -56,7 +56,7 @@
}
// only the reviewer is allowed to modify the assessment
-if ($canmanage or ($isreviewer and $workshop->assessing_examples_allowed())) {
+if (($canmanage and $assessment->weight == 1) or ($isreviewer and $workshop->assessing_examples_allowed())) {
$assessmenteditable = true;
} else {
$assessmenteditable = false;
@@ -119,17 +119,40 @@
print_collapsible_region_end();
}
-if ($canmanage) {
- echo $output->heading(get_string('assessmentreference', 'workshop'), 2);
-} elseif ($isreviewer) {
- echo $output->heading(get_string('assessmentbyyourself', 'workshop'), 2);
-} else {
- $assessment = $workshop->get_assessment_by_id($assessment->id); // extend the current record with user details
- $reviewer = new stdclass();
- $reviewer->firstname = $assessment->reviewerfirstname;
- $reviewer->lastname = $assessment->reviewerlastname;
- echo $output->heading(get_string('assessmentbyknown', 'workshop', fullname($reviewer)), 2);
+// 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,
+ 'showweight' => false,
+ );
+ $assessment = $workshop->prepare_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,
+ 'showweight' => false,
+ );
+ $assessment = $workshop->prepare_assessment($assessment, $mform, $options);
+ $assessment->title = get_string('assessmentbyyourself', 'workshop');
+ echo $output->render($assessment);
+
+} else if ($canmanage) {
+ $options = array(
+ 'showreviewer' => true,
+ 'showauthor' => false,
+ 'showform' => true,
+ 'showweight' => false,
+ );
+ $assessment = $workshop->prepare_assessment($assessment, $mform, $options);
+ echo $output->render($assessment);
}
-$mform->display();
echo $output->footer();
View
@@ -78,33 +78,45 @@
echo $output->render($workshop->prepare_example_submission($example));
+// if the reference assessment is available, display it
if (!empty($mformreference)) {
- echo $output->heading(get_string('assessmentreference', 'workshop'), 2);
- $a = new stdclass();
- $a->received = $workshop->real_grade($reference->grade);
- $a->max = $workshop->real_grade(100);
- echo $output->heading(get_string('gradeinfo', 'workshop' , $a), 3);
- $mformreference->display();
+ $options = array(
+ 'showreviewer' => false,
+ 'showauthor' => false,
+ 'showform' => true,
+ 'showweight' => false,
+ );
+ $reference = $workshop->prepare_assessment($reference, $mformreference, $options);
+ $reference->title = get_string('assessmentreference', 'workshop');
+ echo $output->render($reference);
}
if ($isreviewer) {
- echo $output->heading(get_string('assessmentbyyourself', 'workshop'), 2);
+ $options = array(
+ 'showreviewer' => true,
+ 'showauthor' => false,
+ 'showform' => true,
+ 'showweight' => false,
+ );
+ $assessment = $workshop->prepare_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) {
- $reviewer = new stdclass();
- $reviewer->firstname = $assessment->reviewerfirstname;
- $reviewer->lastname = $assessment->reviewerlastname;
- echo $output->heading(get_string('assessmentbyknown', 'workshop', fullname($reviewer)), 2);
-}
-$a = new stdclass();
-$a->received = $workshop->real_grade($assessment->grade);
-$a->max = $workshop->real_grade(100);
-echo $output->heading(get_string('gradeinfo', 'workshop' , $a), 3);
-$mformassessment->display();
-echo $output->container_start('buttonsbar');
-if ($isreviewer and $workshop->assessing_examples_allowed()) {
- $aurl = new moodle_url($workshop->exsubmission_url($example->id), array('assess' => 'on', 'sesskey' => sesskey()));
- echo $output->single_button($aurl, get_string('reassess', 'workshop'), 'get');
+ $options = array(
+ 'showreviewer' => true,
+ 'showauthor' => false,
+ 'showform' => true,
+ 'showweight' => false,
+ );
+ $assessment = $workshop->prepare_assessment($assessment, $mformassessment, $options);
+ echo $output->render($assessment);
}
-echo $output->container_end(); // buttonsbar
echo $output->footer();
@@ -43,9 +43,10 @@
$string['assessedsubmission'] = 'Assessed submission';
$string['assessingexample'] = 'Assessing example submission';
$string['assessingsubmission'] = 'Assessing submission';
-$string['assessmentbyknown'] = 'Assessment by {$a}';
-$string['assessmentbyunknown'] = 'Assessment';
-$string['assessmentbyyourself'] = 'Assessment by yourself';
+$string['assessment'] = 'Assessment';
+$string['assessmentby'] = 'by <a href="{$a->url}">{$a->name}</a>';
+$string['assessmentbyfullname'] = 'Assessment by {$a}';
+$string['assessmentbyyourself'] = 'Your assessment';
$string['assessmentdeleted'] = 'Assessment deallocated';
$string['assessmentend'] = 'Deadline for assessment';
$string['assessmentenddatetime'] = 'Assessment deadline: {$a->daydatetime} ({$a->distanceday})';
View
@@ -862,12 +862,12 @@ function workshop_print_recent_mod_activity($activity, $courseid, $detail, $modn
$url = new moodle_url('/user/view.php', array('id'=>$activity->user->id, 'course'=>$courseid));
$name = fullname($activity->user);
$link = html_writer::link($url, $name);
- echo get_string('assessmentbyknown', 'workshop', $link);
+ echo get_string('assessmentbyfullname', 'workshop', $link);
echo ' - '.userdate($activity->timestamp);
echo html_writer::end_tag('div');
} else {
echo html_writer::start_tag('div', array('class'=>'anonymous'));
- echo get_string('assessmentbyunknown', 'workshop');
+ echo get_string('assessment', 'workshop');
echo ' - '.userdate($activity->timestamp);
echo html_writer::end_tag('div');
}
Oops, something went wrong.

0 comments on commit c9f31ba

Please sign in to comment.