Esempio n. 1
0
 /**
  * 
  * @param integer|string|ZtChart_Model_Db_Table_Row $role
  */
 public function __construct($role)
 {
     if (null !== $role) {
         if (!$role instanceof ZtChart_Model_Db_Table_Row) {
             $roleDAO = new ZtChart_Model_DbTable_Role();
             if (is_numeric($role)) {
                 $role = $roleDAO->fetchRow($role);
             }
         }
         $this->_roleRow = $role;
     }
 }
Esempio n. 2
0
 /**
  * 删除角色
  * 
  * @param integer|array $roleId
  * @return integer
  */
 public function delete($roleId)
 {
     if (!$this->hasUser($roleId)) {
         return $this->_roleDAO->delete($roleId);
     }
     return 0;
 }
Esempio n. 3
0
 /**
  * 取得自身及所有子角色
  * 
  * @param integer|null $count 总共取出多少数据
  * @param integer $offset 从哪一行开始取数据
  * @return ZtChart_Model_Db_Table_Rowset
  */
 public function getSelfAndChildRoles($count = null, $offset = 0)
 {
     $roleDAO = new ZtChart_Model_DbTable_Role();
     return $roleDAO->fetchAll($this->isAdmin() ? null : $roleDAO->select()->where('role_parent = ?', $this->_roleId)->orWhere('role_id = ?', $this->_roleId));
 }