当前位置: 首页>>代码示例>>PHP>>正文


PHP Notice::setData方法代码示例

本文整理汇总了PHP中Notice::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Notice::setData方法的具体用法?PHP Notice::setData怎么用?PHP Notice::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notice的用法示例。


在下文中一共展示了Notice::setData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionSetStatus

 /** 
  * set status
  * @param integer $id
  * @param integer $status
  */
 public function actionSetStatus($id, $status)
 {
     $group = Group::model()->findByPk($id);
     $oldState = $group->status;
     $group->status = $status;
     $result = $group->save();
     if ($result && ($oldState == "apply" && $status == "ok")) {
         $notice = new Notice();
         $notice->type = 'group_publish';
         $notice->setData(array('groupId' => $id));
         $notice->userId = $group->userId;
         $notice->save();
     }
     if ($result) {
         Yii::app()->user->setFlash('success', '操作成功');
     }
     $this->redirect(array('index'));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:23,代码来源:IndexController.php

示例2: actionSetStatus

 public function actionSetStatus($id, $status)
 {
     $course = Course::model()->findByPk($id);
     $oldState = $course->status;
     $course->status = $status;
     $result = $course->save();
     if ($result && ($oldState == "apply" && $status == Course::STATUS_OK)) {
         $notice = new Notice();
         $notice->type = 'course_publish';
         $notice->setData(array('courseId' => $id));
         $notice->userId = $course->userId;
         $notice->save();
     }
     if ($result) {
         Yii::app()->user->setFlash('success', '操作成功');
     }
     $this->redirect(array('index'));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:18,代码来源:IndexController.php

示例3: actionComment

 public function actionComment()
 {
     $comment = new LessonComment();
     if (isset($_POST['LessonComment'])) {
         $comment->attributes = $_POST['LessonComment'];
         $comment->userId = Yii::app()->user->id;
         $comment->addTime = time();
         if ($comment->save()) {
             $comment = LessonComment::model()->findByPk($comment->getPrimaryKey());
             if ($comment->referid) {
                 $notice = new Notice();
                 $notice->type = 'lesson_recomment';
                 $notice->setData(array('commentId' => $comment->commentId));
                 $notice->userId = $comment->refer->userId;
                 $result = $notice->save();
             }
             $commentDataProvider = new CArrayDataProvider($comment->lesson->comments, array('keyField' => 'commentId', 'pagination' => array('pageSize' => 20)));
             $feed = new Feed();
             $feed->type = 'lesson_comment';
             $feed->setData(array('commentId' => $comment->getPrimaryKey()));
             $feed->save();
             $feed->dispatch(array('user' => array('userId' => $comment->userId), 'course' => array('courseId' => $comment->lesson->courseId)));
             $this->renderPartial('_comment', array('commentDataProvider' => $commentDataProvider));
         }
     }
     //		$this->redirect(array('view','id'=>$comment->lessonid));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:27,代码来源:NoteController.php

示例4: send

 /**
  * 发送系统提醒消息
  * @param iint $userId 消息接收人
  * @param string $type 消息类型,用于确定消息填充的template
  * @param array $data 消息填充所需要的数据
  */
 public static function send($userId, $type, $data)
 {
     $notice = new Notice();
     $notice->type = $type;
     $notice->setData($data);
     $notice->userId = $userId;
     return $notice->save();
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:14,代码来源:Notice.php

示例5: actionApplyPublish

 public function actionApplyPublish($courseId)
 {
     $course = $this->loadModel($courseId);
     if ($course->userId == Yii::app()->user->id) {
         $course->status = "applying";
         if ($course->save()) {
             //通知#1用户
             $notice = new Notice();
             $notice->userId = 1;
             $notice->type = "apply_publish_course";
             $notice->setData(array('courseId' => $courseId));
             $notice->save();
             echo true;
         }
     }
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:16,代码来源:IndexController.php

示例6: actionLessonNote

 /**
  * 为个人笔记投票
  * Enter description here ...
  * @param unknown_type $lessonid
  * @param unknown_type $value
  */
 public function actionLessonNote($noteid)
 {
     //$vote = new PostVote;
     $vote = LessonNoteVote::model()->findByAttributes(array('userId' => Yii::app()->user->id, 'noteid' => $noteid));
     if ($vote) {
         $result = $vote->delete();
     } else {
         $vote or $vote = new LessonNoteVote();
         $vote->noteid = $noteid;
         $vote->userId = Yii::app()->user->id;
         $vote->addTime = time();
         if ($vote->save()) {
             //发送提醒
             $notice = new Notice();
             $notice->type = 'vote_lesson_note';
             $notice->setData(array('voteId' => $vote->getPrimaryKey()));
             $notice->userId = $vote->userId;
             $notice->save();
         }
     }
     $note = LessonNote::model()->findByPk($vote->noteid);
     $score = $note->voteCount;
     $this->renderPartial('thanks_result', array('score' => $score, 'voteupers' => $note->voteupers));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:30,代码来源:VoteController.php


注:本文中的Notice::setData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。