public function actionFaqView($id) { $id = (int) $id; if (!$id) { throw new CHttpException(404, Yii::t('FeedbackModule.feedback', 'Page was not found!')); } $model = FeedBack::model()->answered()->faq()->findByPk($id); if (null === $model) { throw new CHttpException(404, Yii::t('FeedbackModule.feedback', 'Page was not found!')); } $this->render('faqView', array('model' => $model)); }
public function checkSelf() { $messages = []; if (in_array(FeedbackModule::BACKEND_EMAIL, $this->backEnd) && (!$this->emails || !count(explode(',', $this->emails)))) { $messages[WebModule::CHECK_ERROR][] = ['type' => WebModule::CHECK_ERROR, 'message' => Yii::t('FeedbackModule.feedback', 'Select feedback message email receivers (emails) {link}', ['{link}' => CHtml::link(Yii::t('FeedbackModule.feedback', 'Change module settings'), ['/yupe/backend/modulesettings/', 'module' => $this->id])])]; } if (!$this->notifyEmailFrom) { $messages[WebModule::CHECK_ERROR][] = ['type' => WebModule::CHECK_ERROR, 'message' => Yii::t('FeedbackModule.feedback', 'Select email which will be display in "From" field {link}', ['{link}' => CHtml::link(Yii::t('FeedbackModule.feedback', 'Change module settings'), ['/yupe/backend/modulesettings/', 'module' => $this->id])])]; } $count = FeedBack::model()->new()->cache($this->cacheTime)->count(); if ($count) { $messages[WebModule::CHECK_NOTICE][] = ['type' => WebModule::CHECK_NOTICE, 'message' => Yii::t('FeedbackModule.feedback', 'You have {{count}} ', ['{{count}}' => $count]) . Yii::t('FeedbackModule.feedback', 'new message |new messages |new messages ', $count) . ' ' . CHtml::link(Yii::t('FeedbackModule.feedback', 'Show and reply?'), ['/feedback/feedbackBackend/index/', 'order' => 'status.asc', 'FeedbBack_sort' => 'status'])]; } return isset($messages[WebModule::CHECK_ERROR]) || isset($messages[WebModule::CHECK_NOTICE]) ? $messages : true; }
public function run() { $models = FeedBack::model()->answered()->faq()->cache($this->cacheTime)->findAll(['limit' => $this->limit, 'order' => 'id DESC']); $this->render($this->view, ['models' => $models]); }
public function getName() { $count = FeedBack::model()->new()->cache(5)->count(); return $count ? Yii::t('feedback', 'Сообщения с сайта') . " ({$count})" : Yii::t('feedback', 'Сообщения с сайта'); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * * @param int $id - record value * * @return FeedBack $model * * @throws CHttpException */ public function loadModel($id = null) { if ($this->_model === null) { $id = $id ?: Yii::app()->getRequest()->getParam('id'); if (($this->_model = FeedBack::model()->findByPk($id)) === null) { throw new CHttpException(404, Yii::t('FeedbackModule.feedback', 'Requested page was not found!')); } } return $this->_model; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = FeedBack::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
/** * @throws CException */ public function run() { $dataProvider = new CActiveDataProvider('FeedBack', ['sort' => ['defaultOrder' => 'id DESC'], 'pagination' => ['pageSize' => (int) $this->limit]]); $cacheTime = Yii::app()->getController()->yupe->coreCacheTime; $this->render('panel-feedback-stat', ['feedbackCount' => FeedBack::model()->cache($cacheTime)->count('create_time >= :time', [':time' => time() - 24 * 60 * 60]), 'allFeedbackCount' => FeedBack::model()->cache($cacheTime)->count(), 'needAnswerCount' => FeedBack::model()->new()->cache($cacheTime)->count(), 'dataProvider' => $dataProvider]); }