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


PHP User::getAll方法代码示例

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


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

示例1: index

 /**
  * Index action method
  *
  * @return void
  */
 public function index($rid = null)
 {
     if (null === $rid || $this->services['acl']->isAllowed($this->sess->user->role, 'users-of-role-' . $rid, 'index')) {
         $deniedRoles = [];
         $resources = $this->services['acl']->getResources();
         foreach ($resources as $name => $resource) {
             if (!$this->services['acl']->isAllowed($this->sess->user->role, $name, 'index')) {
                 $deniedRoles[] = (int) substr($name, strrpos($name, '-') + 1);
             }
         }
         $user = new Model\User();
         $searchUsername = $this->request->getQuery('search_username');
         if ($user->hasPages($this->application->config()['pagination'], $rid, $searchUsername, $deniedRoles)) {
             $limit = $this->application->config()['pagination'];
             $pages = new Paginator($user->getCount($rid, $searchUsername, $deniedRoles), $limit);
             $pages->useInput(true);
         } else {
             $limit = null;
             $pages = null;
         }
         $this->prepareView('users/index.phtml');
         $this->view->title = 'Users';
         $this->view->pages = $pages;
         $this->view->roleId = $rid;
         $this->view->queryString = $this->getQueryString('sort');
         $this->view->searchUsername = $searchUsername;
         $this->view->users = $user->getAll($rid, $searchUsername, $deniedRoles, $limit, $this->request->getQuery('page'), $this->request->getQuery('sort'));
         $this->view->roles = $user->getRoles();
         $this->send();
     } else {
         $this->redirect('/users');
     }
 }
开发者ID:popphp,项目名称:pop-bootstrap,代码行数:38,代码来源:IndexController.php

示例2: actionIndex

 public function actionIndex()
 {
     $view = new View();
     $view->title = 'Blog | Admin';
     //        $comments = Comment::getAll();
     $view->comments = Comment::getAll();
     $view->users = User::getAll();
     $view->displayPage('admin/index');
 }
开发者ID:zhizunbaonie,项目名称:blog-2,代码行数:9,代码来源:Admin.php

示例3: createComponentGrid

 protected function createComponentGrid($name)
 {
     $grid = new \App\Grid\Grid($this, $name);
     $query = $this->model->getAll();
     if (!$this->getUser()->isInRole('super_admin')) {
         $query->where('NOT role_id', 2);
     }
     $grid->setModel($query);
     $grid->addColumn(new Column('email', $this->translator->translate('admin.form.email')));
     $grid->addColumn(new Column('name', $this->translator->translate('admin.user.name')));
     $grid->addColumn(new Column('surname', $this->translator->translate('admin.user.surname')));
     $grid->addColumn(new HasOne('name', $this->translator->translate('admin.user.role'), 'role'));
     $grid->addColumn(new Column('id', $this->translator->translate('admin.grid.id')));
     $grid->addMenu(new \App\Grid\Menu\Update('edit', $this->translator->translate('admin.form.edit')));
     $grid->addMenu(new \App\Grid\Menu\Delete('delete', $this->translator->translate('admin.grid.delete')));
     $grid->setOrder('role_id, name');
     return $grid;
 }
开发者ID:vsek,项目名称:base,代码行数:18,代码来源:UserPresenter.php

示例4: remove

 /**
  * Remove action method
  *
  * @return void
  */
 public function remove()
 {
     $roleId = $this->getRoleId();
     $user = new Model\User();
     $users = $user->getAll($roleId);
     $userIds = [];
     $this->console->append();
     $this->console->append("ID  \tUsername\tEmail");
     $this->console->append("----\t--------\t-----");
     foreach ($users as $user) {
         $userIds[] = $user->id;
         $this->console->append($user->id . "\t" . $user->username . "\t\t" . $user->email);
     }
     $this->console->append();
     $this->console->send();
     $userId = null;
     while (!is_numeric($userId) || !in_array($userId, $userIds)) {
         $userId = $this->console->prompt('Select User ID: ');
     }
     $user = new Model\User();
     $user->process(['process_users' => [$userId], 'user_process_action' => -1], $this->application->config()['application_title']);
     $this->console->write();
     $this->console->write($this->console->colorize('User Removed!', Console::BOLD_RED));
 }
开发者ID:popphp,项目名称:pop-bootstrap,代码行数:29,代码来源:UsersController.php


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