Пример #1
0
 public function get_index()
 {
     $tpl_users = null;
     $all_users = Model_Users::getAllWithGroupsInfos();
     if (empty($all_users)) {
         $tpl_users = \Eliya\Tpl::get('admin/users/none');
     } else {
         $tpl_users = \Eliya\Tpl::get('admin/users/list', ['all_users' => $all_users]);
     }
     $this->response->set(\Eliya\Tpl::get('admin/users/index', ['tpl_users' => $tpl_users, 'groups' => Model_Groups::getAll()]));
 }
Пример #2
0
 public function get_index($id = null)
 {
     // Force to edit the current user if they don't have the proper permissions
     if (!$this->_currentUser->hasPermission(Model_Groups::PERM_MANAGE_USERS)) {
         $id = $this->_currentUser->getId();
     } else {
         $groups = Model_Groups::getAll();
     }
     $user = Model_Users::getById($id);
     if (!$user) {
         $this->response->error("L'utilisateur demandé n'existe pas !", 404);
         return;
     }
     $this->response->set(\Eliya\Tpl::get('admin/users/edit/index', ['edit_current' => $id == $this->_currentUser->getId(), 'user' => $user, 'usergroup' => $user->load('usergroup'), 'groups' => isset($groups) ? $groups : null]));
 }