/**
  * Если форма пустая
  * Остаемся на странице добавления статьи
  * Если заполнены поля названия и содержимого статьи
  * Показываем шаблон успешного добавления статьи
  *
  * @param array $params Переменные из $_POST
  */
 public function Add($params)
 {
     if (!$params['content'] || !$params['name']) {
         $this->view->Show('edit_article.tpl', array('authors' => Author::GetAll($this->conn), 'authId' => $params['authId'], 'cats' => Category::GetAll($this->conn), 'catId' => $params['catId'], 'pubDate ' => $params['pubDate'], 'cuntent' => $params['content']));
     } else {
         Article::EditArticle($this->conn, $params);
         $this->view->Show('success.tpl');
     }
 }
Example #2
0
 static function find($searchId)
 {
     $authors = Author::GetAll();
     foreach ($authors as $author) {
         if ($searchId == $author->getId()) {
             return $author;
         }
     }
 }
Example #3
0
 public function Index($params)
 {
     $this->view->Show('books.tpl', array('books' => Book::Find($this->conn, $params['pubId'], $params['catId'], $params['authId']), 'pubs' => array(-1 => '- Все -') + Publisher::GetAll($this->conn), 'pubId' => $params['pubId'], 'cats' => array(-1 => '- Все -') + Category::GetAll($this->conn), 'catId' => $params['catId'], 'auth' => array(-1 => '- Все -') + Author::GetAll($this->conn), 'authId' => $params['authId']));
     //        $this->smarty->assign('books', Book::Find($this->conn, $params['pubId'], $params['catId']));
     //
     //        $this->smarty->assign('pubs', array(-1 => '- Все -') + Publisher::GetAll($this->conn));
     //        $this->smarty->assign('pubId', $params['pubId']);
     //
     //        $this->smarty->assign('cats', array(-1 => '- Все -') + Category::GetAll($this->conn));
     //        $this->smarty->assign('catId', $params['catId']);
     //
     //        $this->smarty->display('books.tpl');
 }