mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
ROLES AND PERMISSIONS - FIRST CHECK-IN
======================================= WARNING: DEV IS CURRENTLY VERY UNSTABLE. This is a mega-checkin of the new Roles system. A lot of changes have been made in core and modules. Currently there are a lot of rough edges and known problems. We are working hard on these .. .the reason for getting this into HEAD at this stage is enable us to move faster (our branch was diverging from HEAD too much). Please keep an eye on http://docs.moodle.org/en/Roles for current status and information for developers on how to use the new Roles system.
This commit is contained in:
parent
394577c3e4
commit
bbbf2d4015
139 changed files with 40452 additions and 2001 deletions
|
@ -281,8 +281,34 @@ class block_base {
|
|||
* @todo complete documenting this function. Define $options.
|
||||
*/
|
||||
function _add_edit_controls($options) {
|
||||
|
||||
global $CFG, $USER;
|
||||
|
||||
|
||||
// this is the context relevant to this particular block instance
|
||||
$blockcontext = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
|
||||
|
||||
// context for site or course, i.e. participant list etc
|
||||
// check to see if user can edit site or course blocks.
|
||||
// blocks can appear on other pages such as mod and blog pages...
|
||||
|
||||
switch ($this->instance->pagetype) {
|
||||
case 'course-view':
|
||||
if ($this->instance->pageid == SITEID) {
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, $this->instance->pageid);
|
||||
} else {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $this->instance->pageid);
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/site:manageblocks', $context->id)) {
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!isset($this->str)) {
|
||||
$this->str->delete = get_string('delete');
|
||||
$this->str->moveup = get_string('moveup');
|
||||
|
@ -310,6 +336,10 @@ class block_base {
|
|||
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
|
||||
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey));
|
||||
|
||||
// place holder for roles button
|
||||
$movebuttons .= '<a class="icon roles" title="'. $title .'" href="'.$CFG->wwwroot.'/admin/roles/roleassignment.php?contextid='.$blockcontext->id.'">' .
|
||||
'<img src="'.$CFG->pixpath.'/i/users.gif" alt="'.get_string('roles').'" /></a>';
|
||||
|
||||
$movebuttons .= '<a class="icon hide" title="'. $title .'" href="'.$script.'&blockaction=toggle">' .
|
||||
'<img src="'. $CFG->pixpath.$icon .'" alt="'.$title.'" /></a>';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue