public static function getInstance() { if (!self::$instance instanceof self) { Bolts_Log::info("Creating plugin manager"); self::$instance = new self(); } return self::$instance; }
function addRoles($parent_role = null) { $roles_table = new Roles(); //dd($roles_table->fetchImmediateChildren(2)->toArray()); // we start this recursive funtion by looking for roles with no parent. if (is_null($parent_role)) { $roles = $roles_table->fetchParentless(); } else { $roles = $roles_table->fetchImmediateChildren($parent_role); //dd($roles->toArray()); } foreach ($roles as $role) { // Add the role and specifiy that as the parent. On the first pass, this is null. if (!$this->hasRole($role->id)) { Bolts_Log::info("Adding role " . $role->shortname); $this->addRole(new Zend_Acl_Role($role->id), $parent_role); } if (count($roles_table->fetchImmediateChildren($role->id)) > 0) { $this->addRoles($role->id); } } }