Ejemplo n.º 1
0
 public function behaviors()
 {
     $base = parent::behaviors();
     $arr = array(array('class' => 'ext.seo.components.SeoRecordBehavior', 'route' => 'space/index', 'params' => array('uid' => $this->primaryKey, 'name' => $this->udomain)));
     return $base + $arr;
 }
Ejemplo n.º 2
0
 /**
  * Returns the static model of the specified AR class.
  * @return StarRateLog the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Ejemplo n.º 3
0
 /**
  * @author:majc
  * 在uchome 保存留言的动态信息
  */
 public function afterSave2()
 {
     parent::afterSave();
     $model = new UchomeFeed();
     //后台判断是否显示动态
     if (!$model->isShowFeed()) {
         return null;
     }
     $object_type = $this->object_type;
     $object_id = $this->object_id;
     $uid = Yii::app()->user->id;
     $username = Yii::app()->user->name;
     $dateline = strtotime("now");
     $board_content = cutString($this->board_content, 150);
     $icon = $model->getObject_type($object_type);
     $url = $model->getObjectLink($object_type, $object_id);
     $ObjectTypeInfo = $model->getObjectTypeInfo($object_type, $object_id);
     $setarr['icon'] = $icon;
     $setarr['id'] = $object_id;
     $setarr['idtype'] = $object_type;
     $setarr['uid'] = $uid;
     $setarr['username'] = $username;
     $setarr['dateline'] = $dateline;
     switch ($object_type) {
         case 'mentor':
             $setarr['image_1'] = Yii::app()->createAbsoluteUrl('mentor' . $ObjectTypeInfo->lecturer_pic);
             $setarr['image_1_link'] = $url;
             $setarr['title_template'] = '{actor} 给 {module} 导师留言了';
             $setarr['title_data'] = array('module' => "<a href=\"{$url}\">{$ObjectTypeInfo->lecturer_name}</a>");
             $setarr['body_template'] = '<a href="{img_url}"></a> {summary}';
             $setarr['body_data'] = array('img_url' => $url, 'summary' => $board_content, 'people_board_id' => $this->primaryKey);
             break;
         case 'za_article':
             $Magazine_info = MagazineMagazine::model()->findByPk($ObjectTypeInfo->magazine_id);
             $setarr['image_1'] = Yii::app()->createAbsoluteUrl('magazine' . $Magazine_info->magazine_small_pic);
             $setarr['image_1_link'] = $url;
             $setarr['title_template'] = '{actor} 给 {module} 杂志留言了';
             $issueUrl = Yii::app()->createAbsoluteUrl('magazine/default/issue', array('id' => $Magazine_info->magazine_id));
             $setarr['title_data'] = array('module' => "<a href=\"{$issueUrl}\">{$Magazine_info->magazine_issue_name}</a>");
             $setarr['body_template'] = '<a href="{img_url}"></a> <a href="{object_url}">{object_title}</a> {summary}';
             $img_src = "<img src='" . $Magazine_info->magazine_small_pic . "' />";
             $setarr['body_data'] = array('img_url' => $url, 'object_url' => $url, 'object_title' => $ObjectTypeInfo->article_title, 'summary' => $board_content, 'people_board_id' => $this->primaryKey);
             break;
         case 'book':
             $setarr['image_1'] = Yii::app()->createAbsoluteUrl('mentor' . $ObjectTypeInfo->pic);
             $setarr['image_1_link'] = $url;
             $setarr['title_template'] = '{actor} 给 {module} 书籍留言了';
             $setarr['title_data'] = array('module' => "<a href=\"{$url}\">{$ObjectTypeInfo->title}</a>");
             $setarr['body_template'] = '<a href="{img_url}"></a> {summary}';
             $img_src = "<img src='" . $ObjectTypeInfo->pic . "' />";
             $setarr['body_data'] = array('img_url' => $url, 'summary' => $board_content, 'people_board_id' => $this->primaryKey);
             break;
         case 'video':
             $setarr['image_1'] = Yii::app()->createAbsoluteUrl('mentor' . $ObjectTypeInfo->pic);
             $setarr['image_1_link'] = $url;
             $setarr['title_template'] = '{actor} 给 {module} 视频留言了';
             $setarr['title_data'] = array('module' => "<a href=\"{$url}\">{$ObjectTypeInfo->tit}</a>");
             $setarr['body_template'] = '<a href="{img_url}"></a> {summary}';
             $img_src = "<img src='" . $ObjectTypeInfo->pic . "' />";
             $setarr['body_data'] = array('img_url' => $url, 'summary' => $board_content, 'people_board_id' => $this->primaryKey);
             break;
         case 'course':
             $disposeImgUrl = !empty($ObjectTypeInfo->lecture_pic) ? $ObjectTypeInfo->lecture_pic : '/css/happyschool/images/nav_pic.png';
             $setarr['image_1'] = Yii::app()->createAbsoluteUrl('/happyschool' . $disposeImgUrl);
             $setarr['image_1_link'] = $url;
             $setarr['title_template'] = '{actor} 给 {module} 课程留言了';
             $setarr['title_data'] = array('module' => "<a href=\"{$url}\">{$ObjectTypeInfo->lecture_name}</a>");
             $setarr['body_template'] = '<a href="{img_url}"></a> {summary}';
             $img_src = "<img src='" . $ObjectTypeInfo->lecture_pic ? YiicmsImage::getImageurl($ObjectTypeInfo->lecture_pic) : '/css/happyschool/images/nav_pic.png' . "' />";
             $setarr['body_data'] = array('img_url' => $url, 'summary' => $board_content, 'people_board_id' => $this->primaryKey);
             break;
         case 'goods':
             $setarr['image_1'] = Yii::app()->createAbsoluteUrl('q100' . $ObjectTypeInfo->getProductImgUrl());
             $setarr['image_1_link'] = $url;
             $setarr['title_template'] = '{actor} 给 {module} 在线学习课程留言了。';
             $setarr['title_data'] = array('module' => "<a href=\"{$url}\">{$ObjectTypeInfo->getProductName}()</a>");
             $setarr['body_template'] = '<a href="{img_url}"></a> {summary}';
             $setarr['body_data'] = array('img_url' => $url, 'summary' => $star_num, 'people_board_id' => $this->primaryKey);
             break;
     }
     $setarr['title_data'] = serialize($setarr['title_data']);
     $setarr['body_data'] = serialize($setarr['body_data']);
     $model->attributes = $setarr;
     $model->save();
 }