<?php

/* @var $this NoticeController */
/* @var $data Notice */
$comment = Comment::model()->findByPk($data['commentId']);
$post = CoursePost::model()->findByAttributes(array('entityId' => $comment['commentableEntityId']));
if (!$post || !$comment) {
    return false;
}
echo CHtml::link($comment->user->name, $comment->user->pageUrl);
echo Yii::t('app', ' 对你在');
echo CHtml::link(mb_substr($post->title, 0, 10, 'utf8'), array('/course/post/view', 'id' => $post->id));
echo Yii::t('app', ' 的评论做了回复: ');
echo mb_substr($comment->content, 0, 10);
예제 #2
0
 /**
  * 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 integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = CoursePost::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }