public function actionAlarm() { $id = Yii::$app->request->post('id'); $msg = Yii::$app->request->post('msg'); $comment = Comment::findOne($id); if ($comment && !empty($msg)) { if (Alarm::addAlarm(Alarm::ENTITY_COMMENT, $comment->id, $msg)) { return json_encode(['content' => \frontend\widgets\CommentsWidget::widget(['entity' => $comment->entity, 'entity_id' => $comment->entity_id, 'showDialog' => false]), 'anchor' => $comment->id]); } else { return json_encode(['content' => '', 'anchor' => '']); } } }
public function actionAlarm() { $id = Yii::$app->request->post('id'); $msg = Yii::$app->request->post('msg'); $event = Event::findOne($id); if ($event && !empty($msg)) { if (Alarm::addAlarm(Alarm::ENTITY_EVENT, $event->id, $msg)) { $resultMsg = Lang::t('main/dialogs', 'modalAlarm_msgAlarmResultTrue'); Yii::$app->session->setFlash('success', Lang::t('main/dialogs', 'modalAlarm_msgAlarmResultTrue')); } else { $resultMsg = Lang::t('main/dialogs', 'modalAlarm_msgAlarmResultFalse'); Yii::$app->session->setFlash('success', Lang::t('main/dialogs', 'modalAlarm_msgAlarmResultFalse')); } return json_encode(['msg' => $resultMsg]); } return ""; }