コード例 #1
0
 /**
  * @authorize
  * @customRoute('home/welcome')
  */
 public function welcome()
 {
     $repo = new UserRepository($this->_databaseInstance);
     $userInfo = $repo->getInfo($_SESSION['id']);
     $viewModel = new WelcomeViewModel();
     $viewModel->setUsername($userInfo['username']);
     $this->_view->appendToLayout('layouts.home', 'header');
     $this->_view->appendToLayout('layouts.home', 'body', $viewModel);
     $this->_view->appendToLayout('layouts.home', 'footer');
     $this->_view->render('layouts.home');
 }
コード例 #2
0
 public function welcome()
 {
     if (!$this->isLogged()) {
         $this->redirect($this->unauthorizedLocation);
     }
     $repo = new UserRepository($this->databaseInstance);
     $userInfo = $repo->getInfo($_SESSION['id']);
     $viewModel = new WelcomeViewModel();
     $viewModel->setUsername($userInfo['username']);
     return new View($viewModel);
 }