MDL-10573 - moodle/block:view wasn't working with switch roles or block_list class

This commit is contained in:
poltawski 2007-08-22 10:35:28 +00:00
parent 58a0097f39
commit 25a7d98066
2 changed files with 12 additions and 1 deletions

View File

@ -689,6 +689,13 @@ class block_list extends block_base {
var $content_type = BLOCK_TYPE_LIST;
function is_empty() {
$context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
if ( !has_capability('moodle/block:view', $context) ) {
return true;
}
$this->get_content();
return (empty($this->content->items) && empty($this->content->footer));
}

View File

@ -1153,7 +1153,11 @@ $moodle_capabilities = array(
'contextlevel' => CONTEXT_BLOCK,
'legacy' => array(
'guest' => CAP_ALLOW,
'user' => CAP_ALLOW
'user' => CAP_ALLOW,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW
)
)
);