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


PHP eZRole::fetchByOffset方法代码示例

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


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

示例1: getRoles

 /**
  * We do our best to sort in a way that makes matching easy when ids are different
  * @return array
  *
  * @todo finish obj to array conversion ($users) to make it easier to have non-html output
  * @todo sorting of same-policies-w.-different-limitations in a role is far from perfect despite our efforts
  */
 public static function getRoles()
 {
     $roles = eZRole::fetchByOffset(0, false, true, true);
     // scrap original array, create a new one where policies are sorted. Can you follow the logic?
     foreach ($roles as $role) {
         $policies = array();
         $users = array();
         foreach ($role->attribute('policies') as $policy) {
             $limitations = array();
             foreach ($policy->attribute('limitations') as $limitation) {
                 $values = $limitation->attribute('values_as_array_with_names');
                 // We only use the "name" in each limitation.
                 // This might cause fake-positives when comparing, f.e. different node-limitations on different folders all having the same name
                 // But comparing what is inside the limitation is hard (eg node-ids, which we do not want to compare)
                 $valNames = array();
                 foreach ($values as $item) {
                     $valNames[] = $item["Name"];
                 }
                 $limName = $limitation->attribute('identifier') . '_' . md5(serialize($valNames));
                 $limitations[$limName] = array('identifier' => $limitation->attribute('identifier'), 'values_as_array_with_names' => $values);
             }
             ksort($limitations);
             $policy = array('module_name' => $policy->attribute('module_name'), 'function_name' => $policy->attribute('function_name'), 'limitations' => array_values($limitations));
             $policies[$policy['module_name'] . '_' . $policy['function_name'] . '_' . md5(serialize(array_keys($limitations)))] = $policy;
         }
         ksort($policies);
         foreach ($role->fetchUserByRole() as $user) {
             $users[$user['user_object']->attribute('name')] = $user;
         }
         ksort($users);
         $roles[$role->attribute('name')] = array('name' => $role->attribute('name'), 'policies' => $policies, 'user_array' => $users);
     }
     ksort($roles);
     return array_values($roles);
 }
开发者ID:gggeek,项目名称:ggsysinfo,代码行数:42,代码来源:ezpoliciesreport.php

示例2: foreach

}
// Redirect to content node browse in the user tree
// Assign the role for a user or group
if ($Module->isCurrentAction('AssignRole')) {
    $selectedObjectIDArray = eZContentBrowse::result('AssignRole');
    foreach ($selectedObjectIDArray as $objectID) {
        $role->assignToUser($objectID);
    }
    // Clear role caches.
    eZRole::expireCache();
    // Clear all content cache.
    eZContentCacheManager::clearAllContentCache();
}
if ($http->hasPostVariable('NewButton')) {
    $role = eZRole::createNew();
    return $Module->redirectToView('edit', array($role->attribute('id')));
}
$viewParameters = array('offset' => $offset);
$tpl = eZTemplate::factory();
$roles = eZRole::fetchByOffset($offset, $limit, $asObject = true, $ignoreTemp = true);
$roleCount = eZRole::roleCount();
$tempRoles = eZRole::fetchList($temporaryVersions = true);
$tpl->setVariable('roles', $roles);
$tpl->setVariable('role_count', $roleCount);
$tpl->setVariable('temp_roles', $tempRoles);
$tpl->setVariable('module', $Module);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('limit', $limit);
$Result = array();
$Result['content'] = $tpl->fetch('design:role/list.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/role', 'Role list')));
开发者ID:legende91,项目名称:ez,代码行数:31,代码来源:list.php


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