Permalink
Browse files

Merge branch 'wip-MDL-39710-m25' of git://github.com/marinaglancy/moo…

…dle into MOODLE_25_STABLE
  • Loading branch information...
2 parents 189590b + 5117347 commit 73f8ab649f9f8a5d90e23c17464e7427116aea24 @stronk7 stronk7 committed Jun 3, 2013
Showing with 13 additions and 3 deletions.
  1. +8 −2 grade/grading/form/guide/lib.php
  2. +5 −1 grade/grading/form/rubric/lib.php
@@ -501,10 +501,16 @@ public function render_preview(moodle_page $page) {
throw new coding_exception('It is the caller\'s responsibility to make sure that the form is actually defined');
}
- $output = $this->get_renderer($page);
+ // Check if current user is able to see preview
+ $options = $this->get_options();
+ if (empty($options['alwaysshowdefinition']) && !has_capability('moodle/grade:managegradingforms', $page->context)) {
+ return '';
+ }
+
$criteria = $this->definition->guide_criteria;
$comments = $this->definition->guide_comment;
- $options = $this->get_options();
+ $output = $this->get_renderer($page);
+
$guide = '';
$guide .= $output->box($this->get_formatted_description(), 'gradingform_guide-description');
if (has_capability('moodle/grade:managegradingforms', $page->context)) {
@@ -505,15 +505,19 @@ public function render_preview(moodle_page $page) {
throw new coding_exception('It is the caller\'s responsibility to make sure that the form is actually defined');
}
- $output = $this->get_renderer($page);
$criteria = $this->definition->rubric_criteria;
$options = $this->get_options();
$rubric = '';
if (has_capability('moodle/grade:managegradingforms', $page->context)) {
$showdescription = true;
} else {
+ if (empty($options['alwaysshowdefinition'])) {
+ // ensure we don't display unless show rubric option enabled
+ return '';
+ }
$showdescription = $options['showdescriptionstudent'];
}
+ $output = $this->get_renderer($page);
if ($showdescription) {
$rubric .= $output->box($this->get_formatted_description(), 'gradingform_rubric-description');
}

0 comments on commit 73f8ab6

Please sign in to comment.