本文整理匯總了PHP中eZRole::createNew方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZRole::createNew方法的具體用法?PHP eZRole::createNew怎麽用?PHP eZRole::createNew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eZRole
的用法示例。
在下文中一共展示了eZRole::createNew方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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');
示例2: createTemporaryVersion
function createTemporaryVersion()
{
$db = eZDB::instance();
$db->begin();
$newRole = eZRole::createNew();
$this->copyPolicies($newRole->attribute('id'));
$newRole->setAttribute('name', $this->attribute('name'));
$newRole->setAttribute('version', $this->attribute('id'));
$newRole->store();
$db->commit();
return $newRole;
}