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


PHP Helper::selectedPermissionsArray方法代码示例

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


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

示例1: getEdit

 /**
  * Returns a view that presents a form to edit a User Group.
  *
  * @author [A. Gianotto] [<snipe@snipe.net]
  * @see GroupsController::postEdit()
  * @param int $id
  * @since [v1.0]
  * @return View
  */
 public function getEdit($id = null)
 {
     $group = Group::find($id);
     $permissions = config('permissions');
     $groupPermissions = $group->decodePermissions();
     $selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions);
     return View::make('groups/edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'));
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:17,代码来源:GroupsController.php

示例2: getClone

 /**
  * Return a view containing a pre-populated new user form,
  * populated with some fields from an existing user.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @since [v1.0]
  * @param  int  $id
  * @return Redirect
  */
 public function getClone($id = null)
 {
     // We need to reverse the UI specific logic for our
     // permissions here before we update the user.
     $permissions = Input::get('permissions', array());
     //$this->decodePermissions($permissions);
     app('request')->request->set('permissions', $permissions);
     try {
         // Get the user information
         $user_to_clone = User::withTrashed()->find($id);
         $user = clone $user_to_clone;
         $user->first_name = '';
         $user->last_name = '';
         $user->email = substr($user->email, ($pos = strpos($user->email, '@')) !== false ? $pos : 0);
         $user->id = null;
         // Get this user groups
         $userGroups = $user_to_clone->groups()->lists('name', 'id');
         // Get a list of all the available groups
         $groups = Group::pluck('name', 'id');
         // Get all the available permissions
         $permissions = config('permissions');
         $clonedPermissions = $user_to_clone->decodePermissions();
         $userPermissions = Helper::selectedPermissionsArray($permissions, $clonedPermissions);
         //$this->encodeAllPermissions($permissions);
         $location_list = Helper::locationsList();
         $company_list = Helper::companyList();
         $manager_list = Helper::managerList();
         // Show the page
         return View::make('users/edit', compact('groups', 'userGroups', 'permissions', 'userPermissions'))->with('location_list', $location_list)->with('company_list', $company_list)->with('manager_list', $manager_list)->with('user', $user)->with('groups', $groups)->with('userGroups', $userGroups)->with('clone_user', $user_to_clone);
     } catch (UserNotFoundException $e) {
         // Prepare the error message
         $error = trans('admin/users/message.user_not_found', compact('id'));
         // Redirect to the user management page
         return redirect()->route('users')->with('error', $error);
     }
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:45,代码来源:UsersController.php


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