Пример #1
0
 public function actionIndex()
 {
     if (Common::getRole() == User::GUEST) {
         return $this->render('guest');
     } else {
         return $this->render('index');
     }
 }
Пример #2
0
 public function getCount()
 {
     $query = News::find();
     if (Common::getRole() == User::MODER) {
         $query->where(['status' => News::MODER_NEWS, 'category_id' => $this->getCategoryId()]);
     } elseif (Common::getRole() == User::SMODER) {
         $query->where(['status' => News::SMODER_NEWS, 'category_id' => $this->getCategoryId()]);
     } elseif (Common::getRole() == User::ADMIN) {
         $query->where(['status' => News::ADMIN_NEWS]);
     }
     return count($query->all());
 }