예제 #1
0
 /**
  * Constructor
  * @param object $context the context this table relates to.
  * @param object $user the user we are generating the results for.
  * @param string $contextname $context->get_context_name() - to save recomputing.
  */
 public function __construct($context, $user, $contextname)
 {
     parent::__construct($context, 'explaincaps');
     $this->user = $user;
     $this->fullname = fullname($user);
     $this->contextname = $contextname;
     $this->stryes = get_string('yes');
     $this->strno = get_string('no');
 }
 /**
  * Constructor.
  * @param context $context the context this table relates to.
  * @param string $contextname $context->get_context_name() - to save recomputing.
  * @param array $allowoverrides
  * @param array $allowsafeoverrides
  * @param array $overridableroles
  */
 public function __construct($context, $contextname, $allowoverrides, $allowsafeoverrides, $overridableroles)
 {
     parent::__construct($context, 'permissions');
     $this->contextname = $contextname;
     $this->allowoverrides = $allowoverrides;
     $this->allowsafeoverrides = $allowsafeoverrides;
     $this->overridableroles = $overridableroles;
     $roles = get_all_roles($context);
     $this->roles = role_fix_names(array_reverse($roles, true), $context, ROLENAME_ALIAS, true);
 }
 public function __construct($context, $id, $roleid)
 {
     parent::__construct($context, $id);
     $this->allrisks = get_all_risks();
     $this->risksurl = get_docs_url(s(get_string('risks', 'core_role')));
     $this->allpermissions = array(CAP_INHERIT => 'inherit', CAP_ALLOW => 'allow', CAP_PREVENT => 'prevent', CAP_PROHIBIT => 'prohibit');
     $this->strperms = array();
     foreach ($this->allpermissions as $permname) {
         $this->strperms[$permname] = get_string($permname, 'core_role');
     }
     $this->roleid = $roleid;
     $this->load_current_permissions();
     // Fill in any blank permissions with an explicit CAP_INHERIT, and init a locked field.
     foreach ($this->capabilities as $capid => $cap) {
         if (!isset($this->permissions[$cap->name])) {
             $this->permissions[$cap->name] = CAP_INHERIT;
         }
         $this->capabilities[$capid]->locked = false;
     }
 }