public function actionIndex() { if (Common::getRole() == User::GUEST) { return $this->render('guest'); } else { return $this->render('index'); } }
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()); }