Example #1
0
 protected function AllAction()
 {
     try {
         $allNews = ArticleModel::findAll();
     } catch (Exception $e) {
         echo "Исключение: " . $e->getMessage();
         die;
     }
     $view = new View();
     $view->items = $allNews;
     $view->display('all.php');
 }
Example #2
0
 /**
  * get all articles in bootstrap section of an article
  *
  * @param $mcw
  * @return array
  */
 public function getPageBootstrapArticles($mcw)
 {
     if ($this->articles === null) {
         $article = \ArticleModel::findByPk($mcw->activeRecord->pid);
         $model = \ArticleModel::findAll(array('column' => 'pid =? AND inColumn', 'value' => array($article->pid, 'bootstrap')));
         $articles = array();
         if ($model === null) {
             return $articles;
         }
         while ($model->next()) {
             $articles[$model->id] = $model->title;
         }
         $this->articles = $articles;
     }
     return $this->articles;
 }