private function handleTopicReplyUpload($model, $name) { $topicReply = new TopicReplies(); if (isset($_POST['TopicReplies'])) { $topicReply->setAttributes($_POST['TopicReplies']); if ($topicReply->save()) { $model->associationId = $topicReply->id; $model->update(array('associationId')); echo $topicReply->id; } else { file_exists('uploads/protected/' . $name) && unlink('uploads/protected/' . $name); echo CJSON::encode(array('message' => $topicReply->getAllErrorMessages())); } } else { file_exists('uploads/protected/' . $name) && unlink('uploads/protected/' . $name); echo CJSON::encode(array('message' => Yii::t('app', 'Reply '))); } }
public function actionNewReply() { if (isset($_POST['TopicReplies'])) { $model = $this->loadModel($_POST['TopicReplies']['topicId']); if (!$this->checkPermissions($model, 'view')) { $this->denied(); } $reply = new TopicReplies(); $reply->text = $_POST['TopicReplies']['text']; $reply->topicId = $_POST['TopicReplies']['topicId']; if ($reply->save()) { $event = new Events(); $event->visibility = 1; $event->associationType = 'TopicRepies'; $event->associationId = $reply->id; $event->user = Yii::app()->user->getName(); $event->type = 'topic_reply'; $event->save(); echo $reply->id; } } }
public function actionNewReply() { if (isset($_POST['TopicReplies'])) { $model = $this->loadModel($_POST['TopicReplies']['topicId']); if (!$this->checkPermissions($model, 'view')) { $this->denied(); } $reply = new TopicReplies(); $reply->text = $_POST['TopicReplies']['text']; $reply->topicId = $_POST['TopicReplies']['topicId']; if ($reply->save()) { echo $reply->id; } } }