本文整理汇总了PHP中Gpf_Data_RecordSet::sort方法的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Data_RecordSet::sort方法的具体用法?PHP Gpf_Data_RecordSet::sort怎么用?PHP Gpf_Data_RecordSet::sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gpf_Data_RecordSet
的用法示例。
在下文中一共展示了Gpf_Data_RecordSet::sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadRolePrivileges
/**
* Load role privileges
*
* @service
* @anonym
* @param Gpf_Rpc_Params $params
* @return Gpf_Data_RecordSet
*/
public function loadRolePrivileges(Gpf_Rpc_Params $params)
{
if (!Gpf_Session::getAuthUser()->hasPrivilege(Gpf_Privileges::ROLE, Gpf_Privileges::P_READ) && !Gpf_Session::getAuthUser()->hasPrivilege(Gpf_Privileges::ROLE, Pap_Privileges::P_READ_OWN)) {
throw new Gpf_Rpc_PermissionDeniedException('Gpf_Role_RolePrivilegesForm', 'loadRolePrivileges');
}
$role = new Gpf_Db_Role();
$role->setId($params->get('roleid'));
$role->load();
$defaultPrivileges = Gpf_Application::getInstance()->getDefaultPrivilegesByRoleType($role->getRoleType());
$result = new Gpf_Data_RecordSet();
$result->addColumn('object');
$result->addColumn('objectName');
$result->addColumn('possiblePrivileges');
$result->addColumn('activePrivileges');
$rolePrivileges = Gpf_Privileges::loadPrivileges($role->getId());
foreach ($defaultPrivileges->getDefaultPrivileges() as $object => $privileges) {
$record = new Gpf_Data_Record($result->getHeader());
$record->add('object', $object);
$record->add('objectName', ucfirst(str_replace('_', ' ', strtolower($object))));
$allTypes = $defaultPrivileges->getObjectToTypeRelation();
$record->add('possiblePrivileges', implode(',', $allTypes[$object]));
if (array_key_exists($object, $rolePrivileges)) {
$record->add('activePrivileges', implode(',', array_keys($rolePrivileges[$object])));
} else {
$record->add('activePrivileges', '');
}
$result->addRecord($record);
}
$result->sort('objectName');
return $result;
}
示例2: createLoadTreeResult
private function createLoadTreeResult(array $files, array $dirs, $itemPath){
$result = new Gpf_Data_RecordSet();
$result->setHeader(array('itemId', 'subItemsCount', 'name', 'info', 'type', 'path'));
foreach ($files as $name => $path){
$date = date("y-m-d H:i:s.", filectime($path));
$result->add(array($itemPath.'/'.$name, 0, $name, $date, Gpf_File_FilesTree::TYPE_FILE, $path));
}
foreach ($dirs as $name => $path){
$result->add(array($itemPath.'/'.$name, 1, $name, 99999999, Gpf_File_FilesTree::TYPE_DIRECTORY, $path));
}
$result->sort('info', Gpf_Data_RecordSet::SORT_DESC);
return $result;
}