Beispiel #1
0
 public function actionLatest($cid = 0, $tid = 0)
 {
     $cid = (int) $cid;
     $tid = (int) $tid;
     $criteria = new CDbCriteria();
     $title = t('post_list_table', 'admin');
     if ($cid > 0) {
         $category = AdminCategory::model()->findByPk($cid);
         if ($category === null) {
             throw new CException(t('category_is_not_exist', 'admin'));
         }
         $title = $title . ' - ' . $category->postsLink;
         $criteria->addColumnCondition(array('category_id' => $cid));
     }
     if ($tid > 0) {
         $topic = AdminTopic::model()->findByPk($tid);
         if ($topic === null) {
             throw new CException(t('topic_is_not_exist', 'admin'));
         }
         $title = $title . ' - ' . $topic->postsLink;
         $criteria->addColumnCondition(array('topic_id' => $tid));
     }
     $criteria->addCondition('t.state != ' . POST_STATE_TRASH);
     $data = AdminPost::fetchList($criteria);
     $this->adminTitle = $title;
     $this->render('list', $data);
 }
 public function actionList()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = param('adminCategoryCountOfPage');
     $sort = new CSort('Category');
     $sort->defaultOrder = 'orderid desc, id asc';
     $sort->applyOrder($criteria);
     $pages = new CPagination(AdminCategory::model()->count($criteria));
     $pages->pageSize = $criteria->limit;
     $pages->applyLimit($criteria);
     $models = AdminCategory::model()->findAll($criteria);
     $data = array('models' => $models, 'sort' => $sort, 'pages' => $pages);
     $this->render('list', $data);
 }