diff --git a/grade/grading/form/guide/lib.php b/grade/grading/form/guide/lib.php index 15ef0d7b1de..33686a8a62c 100644 --- a/grade/grading/form/guide/lib.php +++ b/grade/grading/form/guide/lib.php @@ -501,10 +501,16 @@ class gradingform_guide_controller extends gradingform_controller { 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)) { diff --git a/grade/grading/form/rubric/lib.php b/grade/grading/form/rubric/lib.php index 247724d3daa..b323dc9a1df 100644 --- a/grade/grading/form/rubric/lib.php +++ b/grade/grading/form/rubric/lib.php @@ -504,15 +504,19 @@ class gradingform_rubric_controller extends gradingform_controller { 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'); }