From 600af1f9fefa8ed286380612d70e0004edfd4837 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Mon, 11 Aug 2008 15:43:14 +0000 Subject: [PATCH] MDL-15768 - more cap checks in resource mod --- mod/resource/type/html/resource.class.php | 6 +++--- mod/resource/type/text/resource.class.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/resource/type/html/resource.class.php b/mod/resource/type/html/resource.class.php index 1e2e387fa7..be819dc064 100644 --- a/mod/resource/type/html/resource.class.php +++ b/mod/resource/type/html/resource.class.php @@ -65,7 +65,7 @@ function display() { parent::display_course_blocks_start(); echo format_text($this->resource->alltext, FORMAT_HTML, $formatoptions, $this->course->id); - if (true) { //@todo penny replace later with capability check + if (has_capability('mod/resource:exportresource', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { resource_portfolio_caller::add_button($this); } @@ -85,7 +85,7 @@ function display() { print_header(); print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center clearfix", "", "", "20"); - if (true) { //@todo penny replace later with capability check + if (has_capability('mod/resource:exportresource', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { resource_portfolio_caller::add_button($this); } print_footer($course); @@ -124,7 +124,7 @@ function display() { navmenu($course, $cm)); print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center clearfix", "", "", "20"); - if (true) { //@todo penny replace later with capability check + if (has_capability('mod/resource:exportresource', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { resource_portfolio_caller::add_button($this); } diff --git a/mod/resource/type/text/resource.class.php b/mod/resource/type/text/resource.class.php index 99f3689431..9fed61d396 100644 --- a/mod/resource/type/text/resource.class.php +++ b/mod/resource/type/text/resource.class.php @@ -56,7 +56,7 @@ function display() { if (trim(strip_tags($this->resource->alltext))) { echo format_text($this->resource->alltext, FORMAT_MOODLE, $formatoptions, $this->course->id); - if (true) { //@todo penny replace later with capability check + if (has_capability('mod/resource:exportresource', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { resource_portfolio_caller::add_button($this); } } @@ -84,7 +84,7 @@ function display() { print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20"); print_footer($course); - if (true) { //@todo penny replace later with capability check + if (has_capability('mod/resource:exportresource', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { resource_portfolio_caller::add_button($this); } } else { /// Make a page and a pop-up window @@ -126,7 +126,7 @@ function display() { print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20"); - if (true) { //@todo penny replace later with capability check + if (has_capability('mod/resource:exportresource', get_context_instance(CONTEXT_MODULE, $this->cm->id))) { resource_portfolio_caller::add_button($this); } $strlastmodified = get_string("lastmodified"); -- 2.39.5