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


PHP Notice::send方法代码示例

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


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

示例1: run

 /**
  * 更新一个markable对象的mark表记录
  * @param $id:markable对象的id
  */
 public function run($id)
 {
     //得到当前的questionable对象
     $controller = $this->getController();
     $model = $controller->loadModel($id);
     $comment = new Comment();
     if (isset($_POST['Comment'])) {
         $comment->attributes = $_POST['Comment'];
         if ($model->addComment($comment)) {
             $model->upTime = time();
             $model->save();
             //发送消息
             //$comment = $event->params['comment'];
             if ($model->asa('followable')) {
                 $follows = $model->getAllFollows();
                 foreach ($follows as $follow) {
                     if ($follow->userId != $comment->userId && $follow->userId != $comment->referId) {
                         Notice::send($follow->userId, $model->entity->type . "_comment_added", array('commentId' => $comment->id));
                     }
                 }
             }
             Yii::app()->user->setFlash('success', '评论成功!');
         } else {
             Yii::app()->user->setFlash('error', '抱歉,评论失败!');
         }
     }
     $controller->redirect(array('view', 'id' => $model->id));
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:32,代码来源:AddCommentAction.php

示例2: handleOnRecommentAdded

 /**
  * 处理被回复事件
  */
 public function handleOnRecommentAdded($event)
 {
     $owner = $this->getOwner();
     $comment = $event->params['comment'];
     if ($owner->userId != $comment->userId) {
         return Notice::send($owner->userId, "comment_recomment_added", array('commentId' => $comment->id));
     }
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:11,代码来源:CommentHelperBehavior.php

示例3: handleOnApplied

 /**
  * 申请发布事件
  * @param unknown_type $event
  */
 public function handleOnApplied($event)
 {
     $owner = $this->getOwner();
     $admins = UserInfo::getAllAdmins();
     foreach ($admins as $user) {
         Notice::send($user->id, 'entity_applied', array('entityId' => $owner->entityId));
     }
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:12,代码来源:ApplyableBehavior.php

示例4: handleOnAdded

 /**
  * 
  * (non-PHPdoc)
  * @see AbleBehavior::handleOnAdded()
  */
 public function handleOnAdded($event)
 {
     //只对follow用户的情形发通知
     $follow = $event->params['follow'];
     if ($follow->followableEntity->type == "user") {
         $user = $follow->followableEntity->getModel();
         if (isset($user->fanNum)) {
             $user->fanNum = $this->getFanCount();
             $user->save();
         }
         Notice::send($user->id, "follow_user", array('userId' => $follow->userId));
     }
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:18,代码来源:FollowableBehavior.php

示例5: run

 /**
  * 关注或取消赞成
  * @param unknown_type $id
  */
 public function run($id, $value)
 {
     $model = $this->controller->loadModel($id, $value);
     $model->toggleVote(Yii::app()->user->id, $value);
     $vote = Vote::model()->findByAttributes(array('voteableEntityId' => $model->entityId, 'userId' => Yii::app()->user->id));
     if (isset($vote) && $vote) {
         if ($vote->userId != $model->userId) {
             $result = Notice::send($model->userId, $model->entity->type . "_vote_added", array('voteId' => $vote->id));
         }
     }
     //feed
     //	Feed::send("vote_added", array('voteid'=>$vote->id));
     $this->controller->renderPartial('//vote/result', array('score' => $model->voteUpNum, 'voteUpers' => $model->getVoteUperDataProvider()->getData()));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:18,代码来源:ToggleVoteAction.php

示例6: handleOnAdded

 /**
  * 覆盖父类的时间相应函数
  * @see AbleBehavior::handleOnAdded()
  */
 public function handleOnAdded($event)
 {
     //更新Num
     $this->refreshMediaNum();
     //发送消息
     $media = $event->params['media'];
     $follows = $owner->getAllFollows();
     foreach ($follows as $follow) {
         if ($follow->userId != $media->userId && $follow->userId != $media->referId) {
             Notice::send($follow->userId, "media_added", array('entityId' => $owner->entityId, 'mediaid' => $media->id));
         }
     }
     //feed
     Feed::send("media_added", array('entityId' => $owner->entityId, 'mediaid' => $media->id));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:19,代码来源:MediaableBehavior.php

示例7: addComment

 /**
  * 添加comment
  */
 public function addComment($comment)
 {
     //$this->addItem($comment);
     $comment->addTime = time();
     $comment->userId = Yii::app()->user->id;
     $comment->commentableEntityId = $this->getOwner()->entityId;
     $result = $comment->save();
     if ($result) {
         if ($comment->referId && $comment->userId != $comment->refer->userId) {
             //触发onRecommented事件
             //	$referComment = Comment::model()->findByPk($comment->referId);
             //	$referComment->onRecommentAdded(new CEvent($referComment,array('comment'=>$comment)));
             $type = $comment->commentableEntity->type;
             Notice::send($comment->refer->userId, $type . "_comment_recomment_added", array('commentId' => $comment->id));
         }
         $this->onAdded(new CEvent($this, array('comment' => $comment)));
     }
     return $result;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:22,代码来源:CommentableBehavior.php

示例8: actionCreate

 /**
  * 创建小组页面和处理
  */
 public function actionCreate()
 {
     $model = new Group();
     if (isset($_POST['Group'])) {
         $model->attributes = $_POST['Group'];
         $model->addTime = time();
         $model->userId = Yii::app()->user->id;
         $model->status = "apply";
         if ($model->save()) {
             //			$model->addMember(Yii::app()->user->id,array('superAdmin'));
             $member = new GroupMember();
             $member->groupId = $model->id;
             $member->userId = Yii::app()->user->id;
             $member->setArrRoles(array('superAdmin'));
             $member->save();
             $admins = UserInfo::getAllAdmins();
             foreach ($admins as $user) {
                 Notice::send($user->id, 'group_apply', array('groupId' => $model->getPrimaryKey()));
             }
             Yii::app()->user->setFlash('success', '申请已提交,请继续完善小组资料');
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $user = UserInfo::model()->findByPk(Yii::app()->user->id);
     $this->render('create', array('model' => $model, 'user' => $user));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:29,代码来源:IndexController.php

示例9: actionAddComment

 public function actionAddComment($id)
 {
     $model = $this->loadModel($id);
     $comment = new Comment();
     if (isset($_POST['Comment'])) {
         $comment->attributes = $_POST['Comment'];
         if ($model->addComment($comment)) {
             $model->upTime = time();
             $model->save();
             //发送消息
             if ($model->asa('followable')) {
                 $follows = $model->getAllFollows();
                 foreach ($follows as $follow) {
                     if ($follow->userId != $comment->userId && $follow->userId != $comment->referId) {
                         Notice::send($follow->userId, $model->entity->type . "_comment_added", array('commentId' => $comment->id));
                     }
                 }
             }
             //更新回复统计
             $member = CourseMember::model()->findByAttributes(array('userId' => Yii::app()->user->id, 'courseId' => $model->courseId));
             if ($member) {
                 $criteria = new CDbCriteria();
                 $criteria->join = "inner join {{course_post}} p on p.entityId=t.commentableEntityId";
                 $criteria->condition = "p.courseId=" . intval($model->courseId) . " and t.userId=" . Yii::app()->user->id;
                 //	Comment::model()->count($criteria);
                 $member->commentNum = Comment::model()->count($criteria);
                 $member->save();
             }
             Yii::app()->user->setFlash('success', '回复成功!');
         } else {
             Yii::app()->user->setFlash('error', '抱歉,回复失败!');
         }
     }
     $this->redirect(array('view', 'id' => $model->id));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:35,代码来源:PostController.php


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