MDL-34310 display grading method description inside render_preview

This way we can use the function gradingform_controller::render_preview() to display a preview for students in different modules
without worrying on gradingform-specific options on whether to display description for students or not
This commit is contained in:
Marina Glancy 2012-08-24 11:51:20 +08:00
parent c92d6f417c
commit 42b1867410
5 changed files with 16 additions and 7 deletions

View File

@ -506,6 +506,14 @@ class gradingform_guide_controller extends gradingform_controller {
$comments = $this->definition->guide_comment;
$options = $this->get_options();
$guide = '';
if (has_capability('moodle/grade:managegradingforms', $page->context)) {
$showdescription = true;
} else {
$showdescription = $options['showdescriptionstudent'];
}
if ($showdescription) {
$guide .= $output->box($this->get_formatted_description(), 'gradingform_guide-description');
}
if (has_capability('moodle/grade:managegradingforms', $page->context)) {
$guide .= $output->display_guide_mapping_explained($this->get_min_max_score());
$guide .= $output->display_guide($criteria, $comments, $options, self::DISPLAY_PREVIEW, 'guide');

View File

@ -49,8 +49,5 @@ $PAGE->set_heading($title);
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
if (!empty($options['showdescriptionstudent'])) {
echo $OUTPUT->box($controller->get_formatted_description(), 'gradingform_guide-description');
}
echo $controller->render_preview($PAGE);
echo $OUTPUT->footer();

View File

@ -508,6 +508,14 @@ class gradingform_rubric_controller extends gradingform_controller {
$criteria = $this->definition->rubric_criteria;
$options = $this->get_options();
$rubric = '';
if (has_capability('moodle/grade:managegradingforms', $page->context)) {
$showdescription = true;
} else {
$showdescription = $options['showdescriptionstudent'];
}
if ($showdescription) {
$rubric .= $output->box($this->get_formatted_description(), 'gradingform_rubric-description');
}
if (has_capability('moodle/grade:managegradingforms', $page->context)) {
$rubric .= $output->display_rubric_mapping_explained($this->get_min_max_score());
$rubric .= $output->display_rubric($criteria, $options, self::DISPLAY_PREVIEW, 'rubric');

View File

@ -49,8 +49,5 @@ $PAGE->set_heading($title);
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
if (!empty($options['showdescriptionstudent'])) {
echo $OUTPUT->box($controller->get_formatted_description(), 'gradingform_rubric-description');
}
echo $controller->render_preview($PAGE);
echo $OUTPUT->footer();

View File

@ -233,7 +233,6 @@ if (!empty($method)) {
$tag = html_writer::tag('span', get_string('statusdraft', 'core_grading'), array('class' => 'status draft'));
}
echo $output->heading(s($definition->name) . ' ' . $tag, 3, 'definition-name');
echo $output->box($controller->get_formatted_description());
echo $output->box($controller->render_preview($PAGE), 'definition-preview');
}
}