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


PHP SessionUtils::prepareNotificationToFriends方法代码示例

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


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

示例1: notifyAction

 public static function notifyAction($object, $context)
 {
     $notificationDAO = new NotificationDAO();
     $timestamp = date(DATE_FORMAT);
     $userLoggedFriendList = SessionUtils::getUserLoggedFriendsList();
     if ($context === REGISTRATION_FORM) {
         $user = explode(SEPARATOR, $object);
         $message = DataModelUtils::getNotificationMessage($object, $context);
         $notificationDTO = new NotifyDTO(NULL, $user[0], 1, $message, 0, $timestamp, $context, $user[0] . SEPARATOR . $user[1]);
         $notificationDAO->saveNewNotification($notificationDTO);
     } else {
         if ($context === ADD_FRIEND_FORM) {
             $userLogged = SessionUtils::getUserLogged();
             $friend = explode(SEPARATOR, $object);
             $message = DataModelUtils::getNotificationMessage($object, $context);
             $notificationDTO = new NotifyDTO(NULL, $userLogged->getUserId(), $friend[0], $message, 0, $timestamp, $context, $userLogged->getUserId() . SEPARATOR . $userLogged->getUserName() . SEPARATOR . $friend[0] . SEPARATOR . $friend[1]);
             $notificationDAO->saveNewNotification($notificationDTO);
         } else {
             if ($context === CONFIRM_FRIENDSHIP_FORM) {
                 $userLogged = SessionUtils::getUserLogged();
                 $friend = explode(SEPARATOR, $object);
                 $message = DataModelUtils::getNotificationMessage($object, $context, TOMYSELF);
                 $notificationDTO = new NotifyDTO(NULL, $userLogged->getUserId(), $userLogged->getUserId(), $message, 1, $timestamp, $context, $userLogged->getUserId() . SEPARATOR . $userLogged->getUserName() . SEPARATOR . $friend[0] . SEPARATOR . $friend[1]);
                 $result = $notificationDAO->saveNewNotification($notificationDTO);
                 $message = DataModelUtils::getNotificationMessage($object, $context, TOMINENEWFRIEND);
                 $notificationDTO = new NotifyDTO(NULL, $userLogged->getUserId(), $friend[0], $message, 0, $timestamp, $context, $userLogged->getUserId() . SEPARATOR . $userLogged->getUserName() . SEPARATOR . $friend[0] . SEPARATOR . $friend[1]);
                 $result = $notificationDAO->saveNewNotification($notificationDTO);
                 $userLoggedFriendList = SessionUtils::getUserLoggedFriendsList();
                 SessionUtils::prepareNotificationToFriends($object, $context, $userLoggedFriendList, $timestamp, TOMYFRIENDSLIST);
                 $friendsDAO = new FriendsDAO();
                 $myfriendFriendList = $friendsDAO->getNewFriendsFriendList($userLogged->getUserId(), $friend[0]);
                 SessionUtils::prepareNotificationToFriends($object, $context, $myfriendFriendList, $timestamp, TOMINENEWFRIENDFRIENDLIST);
                 $message = '<a href="' . URL . PROFILE_CONTROLLER . INDEX . $userLogged->getUserId() . '"><label>' . $userLogged->getUsername() . '</label></a> ha stretto amicizia con <a href="' . URL . PROFILE_CONTROLLER . INDEX . $friend[0] . '"><label>' . $friend[1] . '</label></a>';
                 $adminNotificationDTO = new NotifyDTO(NULL, $userLogged->getUserId(), 1, $message, 0, $timestamp, $context, $userLogged->getUserId() . SEPARATOR . $userLogged->getUserName() . SEPARATOR . $friend[0] . SEPARATOR . $friend[1]);
                 $notificationDAO->saveNewNotification($adminNotificationDTO);
             } else {
                 $userLoggedFriendList = SessionUtils::getUserLoggedFriendsList();
                 SessionUtils::prepareNotificationToFriends($object, $context, $userLoggedFriendList, $timestamp);
             }
         }
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:42,代码来源:DataModelUtils.php


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