Exemplo n.º 1
0
 private function _getBlogLatest()
 {
     if (empty($this->_articles)) {
         $articles = eVias_Blog_Article::loadAllPublished();
         $this->_articles = $articles;
     }
     $html = "";
     if (!empty($this->_articles)) {
         $html .= "<ul>";
         for ($ix = 0, $cntArticles = count($this->_articles); $ix < 3 && $ix < $cntArticles; $ix++) {
             $articleTitle = $this->_articles[$ix]->titre;
             $articleLink = "/blog/index/show-full-article/?article_id=" . $this->_articles[$ix]->article_id;
             $html .= "\n                    <li class='article'>\n                        <a href='{$articleLink}'>\n                        - {$articleTitle}\n                        </a>\n                    </li>\n                ";
         }
         $html .= "</ul>";
     }
     return $html;
 }
Exemplo n.º 2
0
 public function writeAction()
 {
     $this->view->headTitle('Redaction', 'PREPEND');
     try {
         $this->view->blogCategories = eVias_Blog_Category::fetchAll('eVias_Blog_Category');
     } catch (eVias_Exception $e) {
         $this->view->blogCategories = array();
     }
     if ($this->_request->isPost()) {
         $titre = $this->_getParam('titre');
         $content = $this->_getParam('contenu');
         $category_id = $this->_getParam('category');
         $status_id = $this->_getParam('status');
         $article = new eVias_Blog_Article();
         $article->titre = $titre;
         $article->contenu = $content;
         $article->small_contenu = substr($content, 1, 200);
         $article->category_id = $category_id;
         $article->status_type_id = $status_id;
         $article->date_updated = date('Y-M-d');
         $article->save();
         $this->_helper->FlashMessenger('Your article has been succesfully saved');
         $this->_redirect('/blog/index/index');
     }
 }