display.
Changed context capability check so that CONTEXT_BLOCK capabilities can also come from the
moodle core capability definitions
/**
* Returns true or false, depending on whether this block has any content to display
+ * and whether the user has permission to view the block
*
* @return boolean
*/
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->text) && empty($this->content->footer));
}
$string['blog:manageofficialtags'] = 'Manage official tags';
$string['blog:managepersonaltags'] = 'Manage personal tags';
$string['blog:view'] = 'View blog entries';
+$string['block:view'] = 'View block';
$string['calendar:manageentries'] = 'Manage any calendar entries';
$string['calendar:manageownentries'] = 'Manage own calendar entries';
$string['capabilities'] = 'Capabilities';
$block = get_record('block', 'id', $cb->blockid);
$SQL = "select * from {$CFG->prefix}capabilities where contextlevel = ".CONTEXT_BLOCK."
- and component = 'block/$block->name'";
+ and ( component = 'block/$block->name' or component = 'moodle')";
break;
default:
break;
case CONTEXT_BLOCK:
- $string = get_string('blockname', 'block_'.basename($component));
+ if( $component == 'moodle' ){
+ $string = get_string('block');
+ }else{
+ $string = get_string('blockname', 'block_'.basename($component));
+ }
break;
default:
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
+ ),
+
+ 'moodle/block:view' => array(
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_BLOCK,
+ 'legacy' => array(
+ 'guest' => CAP_ALLOW,
+ 'user' => CAP_ALLOW
+ )
)
);
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2007081001; // YYYYMMDD = date
+ $version = 2007081301; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.9 dev'; // Human-friendly version name