public function actionReadTopic($id) { $thread = Thread::model()->getThreadInfoById($id); $this->forumBreadcrumb = array('Programs' => array('forum/index'), $thread['program_name'] => array('forum/programView', 'programId' => $thread['program_id']), $thread['semester_name'] => array('forum/viewTopics', 'programId' => $thread['program_id'], 'semesterId' => $thread['semester_id']), $thread['title'] < Yii::app()->params['forum_max_crumb_length'] ? $thread['title'] : substr($thread['title'], 0, Yii::app()->params['forum_max_crumb_length']) . '...'); $this->areaLarge = $thread['program_name']; $this->areaSmall = $thread['semester_name']; $reply = new Reply(); $complaint = new Complaint('postComplaint'); if (isset($_POST['Reply'])) { $reply->attributes = $_POST['Reply']; $reply->post_item_id = $id; if ($reply->save()) { Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.reply.success')); $reply->unsetAttributes(); } else { Yii::app()->user->setFlash('error', Yii::t('forum', 'forum.view.reply.error')); } } if (isset($_POST['Complaint'])) { $complaint->attributes = $_POST['Complaint']; if ($complaint->save()) { if ($complaint->post_item_id == $id) { Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success')); } else { Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success')); } $complaint->unsetAttributes(); } else { Yii::app()->clientScript->registerScript('show_modal', "\$('#reportModal').modal('show');", CClientScript::POS_READY); } } $dataProvider = Thread::model()->getPostsDataInThread($id); Yii::log(CVarDumper::dumpAsString($dataProvider->getData())); $this->render('view', array('thread' => $thread, 'threadId' => $id, 'dataProvider' => $dataProvider, 'reply' => $reply, 'complaint' => $complaint)); }
public function actionReadTopic($id) { $thread = Thread::model()->getThreadInfoById($id); $this->areaLarge = $thread['program_name']; $this->areaSmall = $thread['semester_name']; $reply = new Reply(); $complaint = new Complaint('postComplaint'); if (isset($_POST['Reply'])) { $reply->attributes = $_POST['Reply']; $reply->post_item_id = $id; if ($reply->save()) { Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.reply.success')); $reply->unsetAttributes(); } else { Yii::app()->user->setFlash('error', Yii::t('forum', 'forum.view.reply.error')); } } if (isset($_POST['Complaint'])) { $complaint->attributes = $_POST['Complaint']; if ($complaint->save()) { if ($complaint->post_item_id == $id) { Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success')); } else { Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success')); } $complaint->unsetAttributes(); } else { Yii::app()->clientScript->registerScript('show_modal', "\$('#reportModal').modal('show');", CClientScript::POS_READY); } } $dataProvider = Thread::model()->getPostsDataInThread($id); Yii::log(CVarDumper::dumpAsString($dataProvider->getData())); $this->render('application.modules.community.views.front.post.view', array('thread' => $thread, 'threadId' => $id, 'dataProvider' => $dataProvider, 'reply' => $reply, 'complaint' => $complaint)); }