Example #1
0
File: Base.php Project: vincium/lot
 public function __construct(\Rebond\App $app)
 {
     if ($app->site()->getStatus() == \Rebond\Core\StatusType::INACTIVE) {
         Util\Session::redirect('/error/maintenance');
     }
     parent::__construct($app);
     if ($this->signedUser->getId() != 0) {
         $this->player = \Own\Bus\Player\Data::loadByUserId($this->signedUser->getId());
         if ($this->player == null) {
             $this->player = \Own\Bus\Player\Service::create($this->signedUser);
         }
     } else {
         $this->player = new \Own\Bus\Player\Model();
     }
 }
Example #2
0
 public function ranking()
 {
     $id = Converter::toInt('id', 'get', $this->player->getLeagueId());
     $league = \Own\Bus\League\Data::loadById($id);
     if (!isset($league)) {
         $league = $this->player->getLeague();
     }
     // player not logged in
     if (!isset($league)) {
         Session::redirect('/league');
     }
     // view
     $this->setTpl();
     $cacheTime = $this->app->site()->getCacheTime();
     $cache = \Rebond\Util\Cache::getCache('league-ranking', $league->getId(), $cacheTime);
     if (isset($cache)) {
         // layout
         $this->tplLayout->set('column1', $cache);
     } else {
         $options = [];
         $options['clearSelect'] = true;
         $options['select'][] = \Own\Bus\Player\Data::getList(['id', 'user_id', 'country', 'experience', 'username', 'league_ranking', 'league_point', 'league_diff']);
         $options['select'][] = \Rebond\Core\User\Data::getList(['id', 'avatar_id'], 'player_user');
         $options['select'][] = \Rebond\Core\Media\Data::getList([], 'player_user_avatar');
         $options['leftJoin'][] = 'core_user player_user ON player_user.id = player.user_id';
         $options['leftJoin'][] = 'core_media player_user_avatar ON player_user_avatar.id = player_user.avatar_id';
         $options['where'][] = 'player.active = 1';
         $options['where'][] = 'player.league_id = ' . $league->getId();
         $options['order'][] = 'player.league_ranking, player.created_date';
         $players = \Own\Bus\Player\Data::loadAll($options);
         // main
         $tplMain = new Template(Template::SITE, ['www']);
         $tplMain->set('league', $league);
         $tplMain->set('player', $this->player);
         $tplMain->set('players', $players);
         // layout
         $cache = $tplMain->render('league-ranking');
         $this->tplLayout->set('column1', $cache);
         // cache
         \Rebond\Util\Cache::saveCache('league-ranking', $league->getId(), $cacheTime, $cache);
     }
     // template
     $this->tplMaster->set('layout', $this->tplLayout->render('layout-center'));
     return $this->tplMaster->render('tpl-default');
 }
Example #3
0
 public function __construct(\Rebond\App $app)
 {
     if ($app->site()->getStatus() == \Rebond\Core\StatusType::INACTIVE) {
         if ($app->ajax()) {
             return ['result' => ResultType::ERROR, 'message' => Lang::lang('error.maintenance')];
         } else {
             Util\Session::redirect('/error/maintenance');
         }
     }
     parent::__construct($app);
     if ($this->signedUser->getId() != 0) {
         $options = ['where' => [['id = ?', $this->signedUser->getId()]]];
         $this->player = \Own\Bus\Player\Data::load($options);
         if ($this->player == null) {
             $this->player = \Own\Bus\Player\Service::create($this->signedUser);
         }
     } else {
         $this->player = new \Own\Bus\Player\Model();
     }
 }
Example #4
0
 public function sign_in()
 {
     // auth
     if (Auth::isAdminAuthorized($this->signedUser)) {
         Session::redirect('/');
     }
     // action
     $form = new \Rebond\Core\User\Form($this->signedUser);
     $form->signIn();
     if (Auth::isAdmin($form->getModel())) {
         Session::redirect('/');
     }
     if (Auth::isAuth($form->getModel())) {
         Session::setAndRedirect('siteError', Lang::lang('accessNonAuthorized'), 'http://' . \Rebond\Config::getPath('siteUrl'));
     }
     // view
     $this->setTpl();
     // main
     $tplMain = new Template(Template::MODULE, ['core', 'user']);
     $tplMain->set('item', $form);
     // master
     $this->tplMaster->set('column1', $tplMain->render('sign-in'));
     $this->tplMaster->set('jsLauncher', 'profile');
     return $this->tplMaster->render('tpl-signin');
 }