Exemplo n.º 1
0
 public function actionIndex()
 {
     $view = new View();
     $view->title = 'Blog | Editor';
     $where = "author_id=" . 1;
     $view->items = ModelArticle::getColumn(['id', 'title'], $where);
     $view->displayPage('articles/editor');
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     $view = new View();
     $view->title = 'Blog | Admin';
     //        $comments = Comment::getAll();
     $view->comments = Comment::getAll();
     $view->users = User::getAll();
     $view->displayPage('admin/index');
 }
Exemplo n.º 3
0
 public function actionEdit()
 {
     $id = $_GET['id'];
     // Get updating data:
     $updating = ModelArticle::getOneById($id);
     $this->isFound($updating);
     $view = new View(['article' => $updating, 'title' => $updating->title]);
     if ($this->isPost()) {
         $article = new ModelArticle();
         $article->id = $id;
         // fields cannot be empty!
         $success = $article->fill(['title' => $_POST['title'], 'content' => $_POST['content'], 'author_id' => $updating->author_id]);
         if ($success) {
             $article->save();
             header('Location: /article/one?id=' . $id);
             exit;
         } else {
             $_SESSION['error'] = 'Fields cannot be empty!';
             $view->article->content = $_POST['content'];
             $view->article->title = $_POST['title'];
         }
     }
     $view->displayPage('articles/edit');
 }
Exemplo n.º 4
0
 public function actionIndex()
 {
     $view = new View();
     $view->title = 'Blog | About';
     $view->displayPage('about');
 }