本文整理匯總了PHP中Permissions::findAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permissions::findAll方法的具體用法?PHP Permissions::findAll怎麽用?PHP Permissions::findAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Permissions
的用法示例。
在下文中一共展示了Permissions::findAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPermissionsBySource
static function getPermissionsBySource()
{
$sources = array();
$permissions = Permissions::findAll();
//findAll
if (is_array($permissions)) {
foreach ($permissions as $permission) {
if (!isset($sources[$permission->getSource()])) {
$sources[$permission->getSource()] = array();
}
// if
$sources[$permission->getSource()][] = array($permission->getName(), $permission->getId());
}
// foreach
}
// if
return $sources;
}
示例2: removeSource
static function removeSource($source)
{
$permissions = Permissions::findAll(array('conditions' => "`source` = '" . $source . "'"));
if (is_array($permissions)) {
foreach ($permissions as $permission) {
$userpermissions = ProjectUserPermissions::findAll(array('conditions' => "`permission_id` = '" . $permission->getId() . "'"));
foreach ($userpermissions as $userpermission) {
$userpermission->delete();
}
$permission->delete();
}
return true;
// permission already exists
}
return false;
// permission source does not exist
}
示例3: removeSource
static function removeSource($source)
{
$permissions = Permissions::findAll(array('conditions' => "`source` = '" . $source . "'"));
if (is_array($permissions)) {
foreach ($permissions as $permission) {
PermissionManager::removeUserPermissions($permission);
$permission->delete();
}
return true;
// permission source removed
}
return false;
// permission source does not exist
}
示例4: lang
<?php
$page_title = lang('permissions');
set_page_title($page_title);
project_crumbs(lang('permissions'));
add_stylesheet_to_page('project/permissions.css');
$source = array();
$names = array();
$source_id = 0;
$name_id = 0;
$xpermissions = Permissions::findAll();
// findAll
if (is_array($permissions)) {
foreach ($xpermissions as $permission) {
$source_id++;
$sources[$permission->getSource()] = option_tag($permission->getSource(), $source_id);
$name_id++;
$names[$permission->getName()] = option_tag($permission->getName(), $name_id);
}
// foreach
}
// if
$this->includeTemplate(get_template_path('project/pageactions'));
$quoted_permissions = array();
foreach ($permissions as $permission_id => $permission_text) {
$quoted_permissions[] = "'{$permission_id}'";
}
// foreach
if (isset($companies) && is_array($companies) && count($companies)) {
?>
<form action="<?php