e92c286c20
even non-course and sticky blocks. The parent context is block_instances.parentcontextid. The block context should be used for checking permissions directly related to the block, like moodle/block:view or moodle/site:manageblocks. However, if the block is displaying information about the current page, for example the participants block showing who 'here', then it may be better to use the context of the page where the bloack is appearing - in other words $this->page->context - to check permissions about the user's ability to see participants here. Or, if the block is displaying something stronly related to courses, for example, a course meny block, the block should probably use the context for $this->page->course to check permissions.
25 lines
1.1 KiB
PHP
25 lines
1.1 KiB
PHP
<?php // $Id$
|
|
/// This file to be included so we can assume config.php has already been included.
|
|
/// We also assume that $inactive, $activetab and $currentaction have been set
|
|
|
|
global $USER;
|
|
$tabs = $row = array();
|
|
|
|
if (has_capability('moodle/site:manageblocks', $this->context)) {
|
|
$script = $page->url->out(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id, 'section' => 'rss'));
|
|
$row[] = new tabobject('configblock', $script,
|
|
get_string('configblock', 'block_rss_client'));
|
|
}
|
|
|
|
$script = $page->url->out(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id, 'section' => 'rss'));
|
|
$row[] = new tabobject('managefeeds', $script,
|
|
get_string('managefeeds', 'block_rss_client'));
|
|
|
|
$tabs[] = $row;
|
|
|
|
/// Print out the tabs and continue!
|
|
print "\n".'<div class="tabs">'."\n";
|
|
print_tabs($tabs, $currentaction);
|
|
print '</div>' . print_location_comment(__FILE__, __LINE__, true);
|
|
?>
|