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(); } }
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(); } }
public function register() { $userGadget = new \Own\App\User\Gadget($this->app); $register = $userGadget->register(); $this->signedUser = $this->app->user(); if ($this->signedUser->getId() != 0) { $player = \Own\Bus\Player\Data::loadById($this->signedUser->getId()); if ($player == null) { $player = \Own\Bus\Player\Service::create($this->signedUser); } } return $this->response('tpl-default', ['title' => Util\Lang::lang('profile')], 'layout-home', ['column1' => $register]); }
public function register() { $userGadget = new \Own\App\User\Gadget($this->app); $register = $userGadget->register(); $this->signedUser = $this->app->user(); if ($this->signedUser->getId() != 0) { $player = \Own\Bus\Player\Data::loadByUserId($this->signedUser->getId()); if ($player == null) { $player = \Own\Bus\Player\Service::create($this->signedUser); } $player->setActive(true); $player->save(); } $email = Util\Converter::toString('email', 'post'); if (isset($email)) { $user = \Rebond\Core\User\Data::loadByEmail($email); } // view $this->setTpl(); // layout $this->tplLayout->set('column1', $register); // template $this->tplMaster->set('layout', $this->tplLayout->render('layout-center')); return $this->tplMaster->render('tpl-default'); }