本文整理汇总了PHP中Roles::findProjectRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP Roles::findProjectRoles方法的具体用法?PHP Roles::findProjectRoles怎么用?PHP Roles::findProjectRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roles
的用法示例。
在下文中一共展示了Roles::findProjectRoles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_select_user_project_permissions
/**
* Render select user permissions widget
*
* Params:
*
* - name
* - id
* - permissions
* - role_id
*
* @param array $params
* @param Smarty $smarty
* @return string
*/
function smarty_function_select_user_project_permissions($params, &$smarty)
{
static $counter = 1;
$id = array_var($params, 'id');
if (empty($id)) {
$id = 'select_user_project_permissions_' . $counter;
$counter++;
}
// if
$role_id = array_var($params, 'role_id', 0);
$permissions = array_var($params, 'permissions', array());
$smarty->assign(array('_select_user_project_permissions_name' => array_var($params, 'name'), '_select_user_project_permissions_role_id_field' => array_var($params, 'role_id_field', 'role_id'), '_select_user_project_permissions_permissions_field' => array_var($params, 'permissions_field', 'permissions'), '_select_user_project_permissions_name' => array_var($params, 'name'), '_select_user_project_permissions_id' => $id, '_select_user_project_permissions_role_id' => $role_id, '_select_user_project_permissions_permissions' => $permissions, '_select_user_project_permissions_roles' => Roles::findProjectRoles()));
return $smarty->fetch(get_template_path('_user_project_permissions', null, SYSTEM_MODULE));
}
示例2: project_roles
/**
* Show all available project roles
*
* @param void
* @return null
*/
function project_roles()
{
$roles_data = array();
$project_permissions = array_keys(Permissions::findProject());
$roles = Roles::findProjectRoles();
if (is_foreachable($roles)) {
foreach ($roles as $role) {
$role_details = array('id' => $role->getId(), 'name' => $role->getName(), 'permissions' => array());
foreach ($project_permissions as $permission) {
$role_details['permissions'][$permission] = (int) $role->getPermissionValue($permission, 0);
}
// foreach
$roles_data[] = $role_details;
}
// foreach
}
// if
$this->serveData($roles_data, 'project_roles');
}