本文整理匯總了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;
}