当前位置: 首页>>代码示例>>PHP>>正文


PHP Role::fetchAll方法代码示例

本文整理汇总了PHP中Role::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::fetchAll方法的具体用法?PHP Role::fetchAll怎么用?PHP Role::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Role的用法示例。


在下文中一共展示了Role::fetchAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRoles

 /**
  * Pobranie wszystkich ról z dziedziczeniem oraz z przypisanymi groupmi
  * uprawnień,  przyczym jeśli profil jest obecny, zwraca tylko role dla
  * profilu. Wykożystywane przy inicjowaniu rów w resource ACL (co poprawia
  * działanie $acl->hasRole('role').
  *
  * @param $profiel mixed null | Row_Profile
  * @return array
  *
  */
 public function getRoles($profile = null)
 {
     $roleModel = new Role();
     $roleParentsModel = new RoleRole();
     $roleGroupsModel = new RoleGroup();
     if ($profile && $profile->id) {
         $db = Zend_Db_Table::getDefaultAdapter();
         $sql = $db->quoteInto('select r.* from profile_role pr left join "role" r on r.id = pr.id_role where  pr.id_profile = ?', $profile->id);
         $roles = $db->fetchAll($sql);
     } else {
         $roles = $roleModel->fetchAll("ghost = false ", 'priority asc')->toArray();
     }
     $roleGroups = $roleGroupsModel->fetchAll()->toArray();
     $roleParents = $roleParentsModel->fetchAll()->toArray();
     $rolesArray = array();
     foreach ($roles as $role) {
         $role['parents']['group'] = array();
         $role['parents']['role'] = array();
         $rolesArray[$role['id']] = $role;
     }
     foreach ($roleParents as $parent) {
         if (isset($rolesArray[$parent['id_role']])) {
             $rolesArray[$parent['id_role']]['parents']['role'][] = $parent['id_parent'];
         }
     }
     foreach ($roleGroups as $group) {
         if (isset($rolesArray[$group['id_role']])) {
             $rolesArray[$group['id_role']]['parents']['group'][] = $group['id_group'];
         }
     }
     return $rolesArray;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:42,代码来源:Privileges.php

示例2: __construct

 public function __construct($options = null)
 {
     $rolaModel = new Role();
     $grupaModel = new Group();
     $this->roles = $rolaModel->fetchAll(array('ghost = false', 'is_system = false'))->toArray();
     $this->groups = $grupaModel->fetchAll(array('ghost = false', 'is_system = false'), 'group_name asc')->toArray();
     parent::__construct($options);
 }
开发者ID:knatorski,项目名称:SMS,代码行数:8,代码来源:Profile.php

示例3: __construct

 public function __construct($options = null)
 {
     $rola = new Role();
     $this->role = $rola->fetchAll(array('ghost = false ', 'is_system = false '))->toArray();
     parent::__construct($options);
 }
开发者ID:knatorski,项目名称:SMS,代码行数:6,代码来源:Roles.php

示例4: getDataToUserReport

 public function getDataToUserReport()
 {
     $profileModel = new Profile();
     $select = $profileModel->select()->order('id_user');
     $profileDataArray = $profileModel->fetchAll($select)->toArray();
     $groupModel = new Group();
     $select = $groupModel->select();
     $groupDataArray = $groupModel->fetchAll($select)->toArray();
     foreach ($groupDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $groupDataArray = $tmp;
     unset($tmp);
     $branchModel = new Branch();
     $select = $branchModel->select();
     $branchDataArray = $branchModel->fetchAll($select)->toArray();
     foreach ($branchDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $branchDataArray = $tmp;
     unset($tmp);
     $userModel = new User();
     $select = $userModel->select();
     $userDataArray = $userModel->fetchAll($select)->toArray();
     foreach ($userDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $userDataArray = $tmp;
     unset($tmp);
     $roleModel = new Role();
     $select = $roleModel->select();
     $roleDataArray = $roleModel->fetchAll($select)->toArray();
     foreach ($roleDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $roleDataArray = $tmp;
     unset($tmp);
     $groupArray = array();
     foreach ($profileDataArray as $key => $value) {
         $data = $this->getAuthorizationsForProfile($value['id']);
         foreach ($data as $key2 => $values) {
             foreach ($values as $key3 => $privs) {
                 /* if ($privs['ghost'] === true) {
                     unset($data[$key2][$key3]);
                     continue;
                     }
                    */
                 $tmp = array('login' => '', 'surname' => '', 'first_name' => '', 'group' => '', 'role' => '', 'branch' => '', 'ghost' => '');
                 if ($key2 === 'group') {
                     $tmp['group'] = $groupDataArray[$privs['id_group']]['group_name'];
                 }
                 if ($key2 === 'role') {
                     $tmp['role'] = $roleDataArray[$privs['id_role']]['description'];
                 }
                 $tmp['login'] = $userDataArray[$value['id_user']]['login'];
                 $tmp['surname'] = $userDataArray[$value['id_user']]['surname'];
                 $tmp['first_name'] = $userDataArray[$value['id_user']]['first_name'];
                 $tmp['branch'] = $branchDataArray[$value['id_branch']]['branch_name'];
                 $tmp['ghost'] = $userDataArray['ghost'] ? 'NIEAKTYWNY' : 'AKTYWNY';
                 $groupArray[] = $tmp;
             }
         }
     }
     return $groupArray;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:65,代码来源:User.php


注:本文中的Role::fetchAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。