示例#1
0
 public function index()
 {
     session_start();
     $page = \Repository\Page::createInstance()->selectAllPages();
     $this->view->page = $page;
     $this->view->part('header');
     if (isset($_POST['login'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         $user = \Repository\User::createInstance()->getOneByDetails($username, $password);
         $userName = $user->getUsername();
         if (empty($userName) || $user->getAdmin() != 1) {
             $this->redirectControllers('home');
             //                echo 'Oops! It looks like your admin name and/or password are incorrect. '
             //                . 'Please try again.';
             //                die();
         }
         //session_start();
         $_SESSION['adminName'] = $userName;
         $pageTitle = \Repository\Page::createInstance()->selectAllPages();
         $this->redirectAdminControllers('Main', 'log');
     }
     $this->view->showView();
     $this->view->part('footer');
 }
 /**
  * This method add all created page in navigation bar
  * add header for page
  * TODO
  * the admin can add pages (for everything???)
  */
 public function headerData()
 {
     //        session_start();
     $page = \Repository\Page::createInstance()->selectAllPages();
     $this->view->page = $page;
     $this->view->part('header');
 }
示例#3
0
 public function page($slug)
 {
     $this->headerData();
     $page = \Repository\Page::createInstance()->selectOneContent($slug);
     $this->view->page = $page;
     $this->view->showCustomView('Page');
     $this->view->part('footer');
 }
示例#4
0
 private function headerData()
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     $page = \Repository\Page::createInstance()->selectAllPages();
     $this->view->page = $page;
     $this->view->part('header');
 }
示例#5
0
 public function index()
 {
     $slug = array_pop($_GET);
     $slug = explode('/', trim($slug, '/'));
     $slug = array_pop($slug);
     $page = \Repository\Page::createInstance()->selectAllPages();
     $this->view->page = $page;
     $content = \Repository\Page::createInstance()->selectOneContent($slug);
     $this->view->slug = $content;
     $this->view->part('header');
     $this->view->showView();
     $this->view->part('footer');
 }
示例#6
0
 public function delete()
 {
     $id = array_pop($_GET);
     $id = explode('/', trim($id, '/'));
     $id = array_pop($id);
     $delete = Page::createInstance()->selectById($id);
     $id = $delete->getId();
     $delete->delete($id);
     $this->redirectAdminControllers('home', 'log');
 }
示例#7
0
 public function delete($id)
 {
     return \Repository\Page::createInstance()->delete($id);
 }