示例#1
0
文件: Own.php 项目: vincium/resa
 public function index()
 {
     Util\Auth::isAdminAuthorized($this->signedUser, 'member', true, '/');
     $page = Util\Converter::toInt('page', 'get', 1);
     // get user settings
     $userSettings = $this->signedUser->getUserSettings();
     $maxByPage = isset($userSettings) ? (int) $userSettings->getPagingValue() : 10;
     $countItems = \Own\Bus\Player\Data::count();
     $page = Util\Nav::getCurrentPage($page, $countItems, $maxByPage);
     $options = [];
     $options['clearSelect'] = true;
     $options['select'][] = \Own\Bus\Player\Data::getList(['id', 'credits', 'level']);
     $options['select'][] = \Rebond\Core\User\Data::getList(['id', 'firstname', 'lastname', 'status'], 'player_id');
     $options['join'][] = 'core_user player_id ON player_id.id = player.id';
     $options['order'][] = 'player_id.username';
     $options['limit'][] = ($page - 1) * $maxByPage . ', ' . $maxByPage;
     $items = \Own\Bus\Player\Data::loadAll($options);
     // main
     $tplFilter = new Util\Template(Util\Template::SITE, ['admin']);
     $tplFilter->set('paging', Util\Nav::renderPaging($countItems, '/own/index?page=', $maxByPage, $page));
     $tplFilter->set('itemsPerPage', Util\Nav::renderItemsPerPage($maxByPage));
     $tplPlayer = new Util\Template(Util\Template::SITE, ['admin']);
     $tplPlayer->set('items', $items);
     return $this->response('tpl-default', ['title' => Util\Lang::lang('own'), 'jsLauncher' => 'own'], 'layout-1-col', ['column1' => [$tplFilter->render('players-filter'), $tplPlayer->render('players')]]);
 }