public function __construct($context, $roleid) { $this->roleid = $roleid; parent::__construct($context, 'defineroletable', $roleid); $this->displaypermissions = $this->allpermissions; $this->strperms[$this->allpermissions[CAP_INHERIT]] = get_string('notset', 'core_role'); $this->allcontextlevels = array(); $levels = context_helper::get_all_levels(); foreach ($levels as $level => $classname) { $this->allcontextlevels[$level] = context_helper::get_level_name($level); } }
/** * Constructor. * * This method loads loads all the information about the current state of * the overrides, then updates that based on any submitted data. It also * works out which capabilities should be locked for this user. * * @param object $context the context this table relates to. * @param integer $roleid the role being overridden. * @param boolean $safeoverridesonly If true, the user is only allowed to override * capabilities with no risks. */ public function __construct($context, $roleid, $safeoverridesonly) { parent::__construct($context, 'overriderolestable', $roleid); $this->displaypermissions = $this->allpermissions; $this->strnotset = get_string('notset', 'core_role'); // Determine which capabilities should be locked. if ($safeoverridesonly) { foreach ($this->capabilities as $capid => $cap) { if (!is_safe_capability($cap)) { $this->capabilities[$capid]->locked = true; $this->haslockedcapabilities = true; } } } }