示例#1
0
 protected function add_permission_cells($capability)
 {
     if ($this->permissions[$capability->name] == CAP_PROHIBIT) {
         $permname = $this->allpermissions[CAP_PROHIBIT];
         echo '<td class="' . $permname . '" colspan="' . count($this->displaypermissions) . '">';
         echo '<input type="hidden" name="' . $capability->name . '" value="' . CAP_PROHIBIT . '" />';
         echo $this->strperms[$permname] . '<span class="note">' . $this->stradvmessage . '</span>';
         echo '</td>';
     } else {
         parent::add_permission_cells($capability);
     }
 }
示例#2
0
        $PAGE->set_heading(print_context_name($context, false));
        $PAGE->set_cacheable(false);
        break;
    case CONTEXT_BLOCK:
        $PAGE->set_heading($PAGE->course->fullname);
        break;
}
// Make sure this user can override that role
if (empty($overridableroles[$roleid])) {
    $a = new stdClass();
    $a->roleid = $roleid;
    $a->context = $contextname;
    print_error('cannotoverriderolehere', '', get_context_url($context), $a);
}
// If we are actually overriding a role, create the table object, and save changes if appropriate.
$overridestable = new override_permissions_table_advanced($context, $roleid, false);
$overridestable->read_submitted_permissions();
if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
    $overridestable->save_changes();
    $rolename = $overridableroles[$roleid];
    add_to_log($course->id, 'role', 'override', 'admin/roles/override.php?contextid=' . $context->id . '&roleid=' . $roleid, $rolename, '', $USER->id);
    redirect($returnurl);
}
// Finally start page output
echo $OUTPUT->header();
echo $OUTPUT->heading_with_help($title, 'overridepermissions', 'role');
// Show UI for overriding roles.
if (!empty($capabilities)) {
    echo $OUTPUT->box(get_string('nocapabilitiesincontext', 'role'), 'generalbox boxaligncenter');
} else {
    // Print the capabilities overrideable in this context