Skip to content

Commit

Permalink
MDL-30453 Use correct renderable classes to represent assessments of …
Browse files Browse the repository at this point in the history
…example submission
  • Loading branch information
mudrd8mz committed Nov 25, 2011
1 parent e30f6ff commit cdc8577
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
8 changes: 3 additions & 5 deletions mod/workshop/exassessment.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@
'showreviewer' => false,
'showauthor' => false,
'showform' => true,
'showweight' => false,
);
$assessment = $workshop->prepare_assessment($assessment, $mform, $options);
$assessment = $workshop->prepare_example_reference_assessment($assessment, $mform, $options);
$assessment->title = get_string('assessmentreference', 'workshop');
echo $output->render($assessment);

Expand All @@ -138,9 +137,8 @@
'showreviewer' => true,
'showauthor' => false,
'showform' => true,
'showweight' => false,
);
$assessment = $workshop->prepare_assessment($assessment, $mform, $options);
$assessment = $workshop->prepare_example_assessment($assessment, $mform, $options);
$assessment->title = get_string('assessmentbyyourself', 'workshop');
echo $output->render($assessment);

Expand All @@ -151,7 +149,7 @@
'showform' => true,
'showweight' => false,
);
$assessment = $workshop->prepare_assessment($assessment, $mform, $options);
$assessment = $workshop->prepare_example_assessment($assessment, $mform, $options);
echo $output->render($assessment);
}

Expand Down
12 changes: 6 additions & 6 deletions mod/workshop/excompare.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@
'showreviewer' => false,
'showauthor' => false,
'showform' => true,
'showweight' => false,
);
$reference = $workshop->prepare_assessment($reference, $mformreference, $options);
$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);
}

Expand All @@ -96,9 +98,8 @@
'showreviewer' => true,
'showauthor' => false,
'showform' => true,
'showweight' => false,
);
$assessment = $workshop->prepare_assessment($assessment, $mformassessment, $options);
$assessment = $workshop->prepare_example_assessment($assessment, $mformassessment, $options);
$assessment->title = get_string('assessmentbyyourself', 'workshop');
if ($workshop->assessing_examples_allowed()) {
$assessment->add_action(
Expand All @@ -113,9 +114,8 @@
'showreviewer' => true,
'showauthor' => false,
'showform' => true,
'showweight' => false,
);
$assessment = $workshop->prepare_assessment($assessment, $mformassessment, $options);
$assessment = $workshop->prepare_example_assessment($assessment, $mformassessment, $options);
echo $output->render($assessment);
}

Expand Down
22 changes: 21 additions & 1 deletion mod/workshop/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ protected function render_workshop_assessment(workshop_assessment $assessment) {
} else {
$title = get_string('assessment', 'workshop');
}
if ($this->page->url != $assessment->url) {
if (($assessment->url instanceof moodle_url) and ($this->page->url != $assessment->url)) {
$o .= $this->output->container(html_writer::link($assessment->url, $title), 'title');
} else {
$o .= $this->output->container($title, 'title');
Expand Down Expand Up @@ -629,6 +629,26 @@ protected function render_workshop_assessment(workshop_assessment $assessment) {
return $o;
}

/**
* Renders the assessment of an example submission
*
* @param workshop_example_assessment $assessment
* @return string HTML
*/
protected function render_workshop_example_assessment(workshop_example_assessment $assessment) {
return $this->render_workshop_assessment($assessment);
}

/**
* Renders the reference assessment of an example submission
*
* @param workshop_example_reference_assessment $assessment
* @return string HTML
*/
protected function render_workshop_example_reference_assessment(workshop_example_reference_assessment $assessment) {
return $this->render_workshop_assessment($assessment);
}

////////////////////////////////////////////////////////////////////////////
// Internal rendering helper methods
////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit cdc8577

Please sign in to comment.