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


PHP Notification::save方法代码示例

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


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

示例1: add

 public static function add($params = array())
 {
     $uid = zmf::uid();
     $data = array('uid' => $params['uid'], 'authorid' => $uid, 'content' => $params['content'], 'new' => 1, 'type' => $params['type'], 'cTime' => zmf::now(), 'from_id' => $params['from_id'], 'from_idtype' => $params['from_idtype'], 'from_num' => 1);
     if ($uid == $params['uid']) {
         return false;
     }
     $model = new Notification();
     $info = $model->find("uid=:uid AND authorid=:authorid AND from_id=:from AND type=:type", array(':uid' => $params['uid'], ':authorid' => $uid, ':from' => $params['from_id'], ':type' => $params['type']));
     if ($info) {
         //存在则更新最新操作时间
         if ($model->updateByPk($info['id'], array('cTime' => time(), 'new' => 1, 'from_num' => $info['from_num'] + 1))) {
             return true;
         } else {
             return false;
         }
     } else {
         //不存在则新增
         $model->attributes = $data;
         if ($model->save()) {
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:ph7pal,项目名称:mei,代码行数:26,代码来源:Notification.php

示例2: fire

 /**
  * Fires this notification
  *
  * @param type $like
  */
 public static function fire($like)
 {
     // Determine Space Id if exists
     $spaceId = "";
     if ($like->content->container instanceof Space) {
         $spaceId = $like->content->container->id;
     }
     // Determine who created the liked content / content addon
     $createdBy = "";
     if ($like->source instanceof HActiveRecordContent) {
         $createdBy = $like->source->content->created_by;
     } elseif ($like->source instanceof HActiveRecordContentAddon) {
         $createdBy = $like->source->created_by;
     }
     if ($createdBy != "" && $createdBy != $like->created_by) {
         // Send Notification to owner
         $notification = new Notification();
         $notification->class = "NewLikeNotification";
         $notification->user_id = $createdBy;
         $notification->space_id = $spaceId;
         $notification->source_object_model = "Like";
         $notification->source_object_id = $like->id;
         $notification->target_object_model = $like->object_model;
         $notification->target_object_id = $like->object_id;
         $notification->save();
     }
 }
开发者ID:ahdail,项目名称:humhub,代码行数:32,代码来源:NewLikeNotification.php

示例3: execute

 public function execute(&$params)
 {
     $options =& $this->config['options'];
     $notif = new Notification();
     $notif->user = $this->parseOption('user', $params);
     $notif->createdBy = 'API';
     $notif->createDate = time();
     // file_put_contents('triggerLog.txt',"\n".$notif->user,FILE_APPEND);
     // if($this->parseOption('type',$params) == 'auto') {
     // if(!isset($params['model']))
     // return false;
     // $notif->modelType = get_class($params['model']);
     // $notif->modelId = $params['model']->id;
     // $notif->type = $this->getNotifType();
     // } else {
     $notif->type = 'custom';
     $notif->text = $this->parseOption('text', $params);
     // }
     if ($notif->save()) {
         return array(true, "");
     } else {
         $errors = $notif->getErrors();
         return array(false, array_shift($errors));
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:25,代码来源:X2FlowCreateNotif.php

示例4: fire

 /**
  * Fire this notification on given comment object
  *
  * @param type $comment
  */
 public static function fire($comment)
 {
     $targetCreatorId = $comment->content->user_id;
     // gets also an new comment notification
     // Get Users which are also commented this model
     $userIds = array();
     $otherComments = Comment::model()->findAllByAttributes(array('object_model' => $comment->object_model, 'object_id' => $comment->object_id));
     foreach ($otherComments as $otherComment) {
         if ($comment->created_by != $otherComment->created_by && $otherComment->created_by != $targetCreatorId) {
             $userIds[] = $otherComment->created_by;
         }
     }
     $userIds = array_unique($userIds);
     // Write new Notification for them
     foreach ($userIds as $userId) {
         $notification = new Notification();
         $notification->class = "AlsoCommentedNotification";
         $notification->user_id = $userId;
         $notification->space_id = $comment->space_id;
         $notification->source_object_model = "Comment";
         $notification->source_object_id = $comment->id;
         $notification->target_object_model = $comment->object_model;
         $notification->target_object_id = $comment->object_id;
         $notification->save();
     }
 }
开发者ID:ahdail,项目名称:humhub,代码行数:31,代码来源:AlsoCommentedNotification.php

示例5: save

 public function save()
 {
     $message = "NEW " . strtolower(get_parent_class($this)) . " saved!";
     $type = parent::__get('resource_type');
     $notification = new Notification($message, $type);
     return $notification->save();
 }
开发者ID:jhmachado,项目名称:tools,代码行数:7,代码来源:NotificationTrait.php

示例6: createForUserRecord

 public static function createForUserRecord(User $user, PathRecord $record)
 {
     $notify = new Notification();
     $notify->user_id = $user->id;
     $notify->path_record_id = $record->id;
     $notify->save();
     return $notify;
 }
开发者ID:Lord-Simon,项目名称:MangaIndex,代码行数:8,代码来源:Notification.php

示例7: unfollow

 public function unfollow($id)
 {
     $sql = 'delete from followers where user_id = ' . (int) $id . ' and follower_id = ' . $this->id;
     $query = $this->db->query($sql);
     $notification = new Notification();
     $notification->text = 'Používateľ ' . $this->nick . ' vás prestal sledovať!';
     $notification->user_id = (int) $id;
     $notification->link = 'uzivatel/' . $this->id;
     $notification->save();
 }
开发者ID:fant0m,项目名称:VAII,代码行数:10,代码来源:User.php

示例8: fire

 public static function fire($user_follow)
 {
     $notification = new Notification();
     $notification->class = "FollowNotification";
     $notification->user_id = $user_follow->object_id;
     $notification->source_object_model = "UserFollow";
     $notification->source_object_id = $user_follow->id;
     $notification->target_object_model = $user_follow->object_model;
     $notification->target_object_id = $user_follow->user_id;
     $notification->save();
 }
开发者ID:alefernie,项目名称:intranet,代码行数:11,代码来源:FollowNotification.php

示例9: add

 public static function add($params = array())
 {
     $data = array('uid' => $params['uid'], 'authorid' => $params['authorid'], 'content' => $params['content'], 'new' => 1, 'type' => $params['type'], 'cTime' => zmf::now(), 'from_id' => $params['from_id'], 'from_idtype' => $params['from_idtype'], 'from_num' => 1);
     if ($params['uid'] == $params['authorid']) {
         return false;
     }
     $model = new Notification();
     //2016修改为不计条数
     $model->attributes = $data;
     return $model->save();
 }
开发者ID:ph7pal,项目名称:momo,代码行数:11,代码来源:Notification.php

示例10: Notification

 function save_notification($fields, $is_new = true)
 {
     $notification = new Notification();
     $notification->id = $fields['id'];
     $notification->message = $fields['message'];
     $notification->category = $fields['category'];
     $notification->display_type = $fields['type'];
     $notification->read = $fields['read'];
     $notification->is_new = $is_new;
     $result = $notification->save();
     return $this->status($result);
 }
开发者ID:neevan1e,项目名称:Done,代码行数:12,代码来源:ttw.notification.center.php

示例11: fire

 public static function fire($invitorUserId, $invitedUser, $space)
 {
     // Send Notification to owner
     $notification = new Notification();
     $notification->class = "SpaceInviteAcceptedNotification";
     $notification->user_id = $invitorUserId;
     $notification->space_id = $space->id;
     $notification->source_object_model = "User";
     $notification->source_object_id = $invitedUser->id;
     $notification->target_object_model = "Space";
     $notification->target_object_id = $space->id;
     $notification->save();
 }
开发者ID:ahdail,项目名称:humhub,代码行数:13,代码来源:SpaceInviteAcceptedNotification.php

示例12: fire

 public static function fire($approverUserId, $requestor, $room)
 {
     // Send Notification to owner
     $notification = new Notification();
     $notification->class = "RoomApprovalRequestAcceptedNotification";
     $notification->user_id = $requestor->id;
     $notification->space_id = $room->id;
     $notification->source_object_model = "User";
     $notification->source_object_id = $approverUserId;
     $notification->target_object_model = "Room";
     $notification->target_object_id = $room->id;
     $notification->save();
 }
开发者ID:verdin12345,项目名称:humhub-modules-rooms,代码行数:13,代码来源:RoomApprovalRequestAcceptedNotification.php

示例13: fire

 public static function fire($approverUserId, $requestor, $workspace)
 {
     // Send Notification to owner
     $notification = new Notification();
     $notification->class = "SpaceApprovalRequestDeclinedNotification";
     $notification->user_id = $requestor->id;
     $notification->space_id = $workspace->id;
     $notification->source_object_model = "User";
     $notification->source_object_id = $approverUserId;
     $notification->target_object_model = "Space";
     $notification->target_object_id = $workspace->id;
     $notification->save();
 }
开发者ID:alefernie,项目名称:intranet,代码行数:13,代码来源:SpaceApprovalRequestDeclinedNotification.php

示例14: fire

 public static function fire($invitorUserId, $invitedUser, $room)
 {
     // Send Notification to owner
     $notification = new Notification();
     $notification->class = "RoomInviteDeclinedNotification";
     $notification->user_id = $invitorUserId;
     $notification->space_id = $room->id;
     $notification->source_object_model = "User";
     $notification->source_object_id = $invitedUser->id;
     $notification->target_object_model = "Room";
     $notification->target_object_id = $room->id;
     $notification->save();
 }
开发者ID:verdin12345,项目名称:humhub-modules-rooms,代码行数:13,代码来源:RoomInviteDeclinedNotification.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::get();
     $input['userId'] = Auth::id();
     $followed = $this->execute(FollowUserCommand::class, $input);
     $notification = new Notification();
     $notification->notification_type = 'following';
     $notification->notified_id = Input::get('userIdToFollow');
     $notification->notifier_id = Auth::id();
     $notification->save();
     Flash::success("You are now following this user.");
     return Redirect::back();
 }
开发者ID:jamalots,项目名称:jamalot.dev,代码行数:18,代码来源:FollowsController.php


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