本文整理汇总了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