getAdapter()->quoteInto($this->getAdapter()->quoteIdentifier('groupid') . ' = ?', $groupid); $sql = 'SELECT * FROM ' . $this->getTable() . ' WHERE ' . $where; $row = $this->getAdapter()->query($sql)->fetch(); unset($sql); return (is_array($row) && count($row) > 0) ? $row : null; } /** * 获取用户组的所有权限 * @param array|integer $groups */ public function getGroupPermissions($groups) { if (is_array($groups)) { $val = implode(',', array_map('intval', $groups)); $where = $this->getAdapter()->quoteIdentifier('parameter') . ' IN( ' . $val . ' )'; } else { $where = $this->getAdapter()->quoteInto($this->getAdapter()->quoteIdentifier('parameter') . ' = ?', (int)$groups); } $where .= ' AND ' . $this->getAdapter()->quoteInto($this->getAdapter()->quoteIdentifier('ptype') . ' = ?', 'group'); $select = $this->getAdapter()->select()->from('admin_user_permission', array('permission_id'))->where($where); $rows = $select->query()->fetchAll(); $ps = array(); if (is_array($rows) && count($rows) > 0) { foreach ($rows as $row) { $ps[] = $row['permission_id']; } } return $ps; } /** * @return Com_Admin_Model_Group */ public static function instance() { return parent::_instance(__CLASS__); } } // End ^ LF ^ encoding