Ejemplo n.º 1
0
 public function getUserListsForGroup($groupId)
 {
     $users = $this->userRepository->getAllUsers();
     $usersInGroups = array();
     $freeUsers = array();
     foreach ($users as $user) {
         $user['editUrl'] = $this->router->getUrlByRoute('admin_user_edit', array('id' => $user['id']));
         if (in_array($groupId, $user['groups'])) {
             $usersInGroups[] = $user;
         } else {
             $freeUsers[] = $user;
         }
     }
     return array('included' => $usersInGroups, 'free' => $freeUsers);
 }
Ejemplo n.º 2
0
 public function getDataAsArray(Router $router)
 {
     $node = array('label' => $this->name, 'id' => $this->id, 'type_' => 'group', 'users' => $this->users->count(), 'active' => $this->isActive, 'children' => array(), 'movedUrl' => $router->getUrlByRoute('admin_group_move', array(), false), 'editUrl' => $router->getUrlByRoute('admin_group_edit', array('id' => $this->id), false), 'usersUrl' => $router->getUrlByRoute('admin_group_edit_users_list', array('id' => $this->id), false), 'userCreateUrl' => $router->getUrlByRoute('admin_user_new_in_group', array('groupId' => $this->id), false), 'groupCreateUrl' => $router->getUrlByRoute('admin_group_new', array('ownerId' => $this->id), false), 'removeUrl' => $router->getUrlByRoute('admin_group_delete_request', array('id' => $this->id), false));
     foreach ($this->nodes as $nodeChild) {
         $node['children'][] = $nodeChild->getDataAsArray($router);
     }
     return $node;
 }