• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Notification类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testGetNotification

    public function testGetNotification()
    {
        $SofortLibNotification = new Notification();
        $statusNotification = '';
        $this->assertFalse($SofortLibNotification->getNotification($statusNotification));
        $statusNotification = '<?xml version="1.0" encoding="UTF-8"?>
<status_notification>
<transaction>1324-1234-5483-4891</transaction>
<time>2010-04-14T19:01:08+02:00</time>
</status_notification>';
        $notification = '1324-1234-5483-4891';
        $this->assertEquals($notification, $SofortLibNotification->getNotification($statusNotification));
        $statusNotification = '<?xml version="1.0" encoding="UTF-8"?>
<status_test>
<transaction>1324-1234-5483-4891</transaction>
<time>2010-04-14T19:01:08+02:00</time>
</status_test>';
        $this->assertFalse($SofortLibNotification->getNotification($statusNotification));
        $statusNotification = '<?xml version="1.0" encoding="UTF-8"?>
<status_notification>
<nontransaction>1324-1234-5483-4891</nontransaction>
<time>2010-04-14T19:01:08+02:00</time>
</status_notification>';
        $this->assertFalse($SofortLibNotification->getNotification($statusNotification));
    }
开发者ID:vojtasvoboda,项目名称:sofortlib-php,代码行数:25,代码来源:NotificationTest.php


示例2: plugin_typology_uninstall

function plugin_typology_uninstall()
{
    global $DB;
    // Plugin tables deletion
    $tables = array("glpi_plugin_typology_profiles", "glpi_plugin_typology_typologies", "glpi_plugin_typology_typologycriterias", "glpi_plugin_typology_typologycriteriadefinitions", "glpi_plugin_typology_typologies_items");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    // Plugin adding information on general table deletion
    $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs");
    foreach ($tables_glpi as $table_glpi) {
        $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` = 'PluginTypologyTypology';");
    }
    //drop rules
    $Rule = new Rule();
    $a_rules = $Rule->find("`sub_type`='PluginTypologyRuleTypology'");
    foreach ($a_rules as $data) {
        $Rule->delete($data);
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginTypologyTypology', 'event' => 'AlertNotValidatedTypology', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    return true;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:26,代码来源:hook.php


示例3: 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


示例4: uninstall

 /**
  * Remove mreporting notifications from GLPI.
  * 
  * @return array 'success' => true on success
  */
 static function uninstall()
 {
     global $DB;
     $queries = array();
     // Remove NotificationTargets and Notifications
     $notification = new Notification();
     $result = $notification->find("itemtype = 'PluginMreportingNotification'");
     foreach ($result as $row) {
         $notification_id = $row['id'];
         $queries[] = "DELETE FROM glpi_notificationtargets \n                        WHERE notifications_id = " . $notification_id;
         $queries[] = "DELETE FROM glpi_notifications \n                        WHERE id = " . $notification_id;
     }
     // Remove NotificationTemplateTranslations and NotificationTemplates
     $template = new NotificationTemplate();
     $result = $template->find("itemtype = 'PluginMreportingNotification'");
     foreach ($result as $row) {
         $template_id = $row['id'];
         $queries[] = "DELETE FROM glpi_notificationtemplatetranslations \n                        WHERE notificationtemplates_id = " . $template_id;
         $queries[] = "DELETE FROM glpi_notificationtemplates \n                        WHERE id = " . $template_id;
     }
     foreach ($queries as $query) {
         $DB->query($query);
     }
     return array('success' => true);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:notification.class.php


示例5: 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


示例6: getLatestNotificationsAndCounts

 public function getLatestNotificationsAndCounts($userId)
 {
     $notification = new Notification();
     $listUnread = $notification->Find("toUser = ? and status = ?", array($userId, 'Unread'));
     $unreadCount = count($listUnread);
     $limit = $unreadCount < 10 ? 10 : $unreadCount;
     $list = $notification->Find("toUser = ? order by time desc limit ?", array($userId, $limit));
     $newList = array();
     $fs = new FileService();
     foreach ($list as $noti) {
         if ($noti->fromEmployee > 0) {
             $employee = $this->baseService->getElement('Employee', $noti->fromEmployee, null, true);
             if (!empty($employee)) {
                 $employee = $fs->updateEmployeeImage($employee);
                 $noti->image = $employee->image;
                 if (empty($noti->image)) {
                     if ($employee->gender == 'Male') {
                         $noti->image = BASE_URL . "images/user_male.png";
                     } else {
                         $noti->image = BASE_URL . "images/user_female.png";
                     }
                 }
                 $newList[] = $noti;
             }
         } else {
             $noti->image = BASE_URL . "images/icehrm.png";
             $newList[] = $noti;
         }
     }
     return array($unreadCount, $list);
 }
开发者ID:brajovela,项目名称:hrm,代码行数:31,代码来源:NotificationManager.php


示例7: check_writable_relative

function check_writable_relative($dir)
{
    $uid = posix_getuid();
    $gid = posix_getgid();
    $user_info = posix_getpwuid($uid);
    $user = $user_info['name'];
    $group_info = posix_getgrgid($gid);
    $group = $group_info['name'];
    $fix_cmd = '. ' . _("To fix that, execute following commands as root") . ':<br><br>' . "cd " . getcwd() . "<br>" . "mkdir -p {$dir}<br>" . "chown {$user}:{$group} {$dir}<br>" . "chmod 0700 {$dir}";
    if (!is_dir($dir)) {
        $config_nt = array('content' => _("Required directory " . getcwd() . "{$dir} does not exist") . $fix_cmd, 'options' => array('type' => 'nf_warning', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        exit;
    }
    if (!($stat = stat($dir))) {
        $config_nt = array('content' => _("Could not stat configs dir") . $fix_cmd, 'options' => array('type' => 'nf_warning', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        exit;
    }
    // 2 -> file perms (must be 0700)
    // 4 -> uid (must be the apache uid)
    // 5 -> gid (must be the apache gid)
    if ($stat[2] != 16832 || $stat[4] !== $uid || $stat[5] !== $gid) {
        $config_nt = array('content' => _("Invalid perms for configs dir") . $fix_cmd, 'options' => array('type' => 'nf_warning', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        exit;
    }
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:view.php


示例8: 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


示例9: display_errors

function display_errors($info_error)
{
    $errors = implode("</div><div style='padding-top: 3px;'>", $info_error);
    $error_msg = "<div>" . _("The following errors occurred:") . "</div><div style='padding-left: 15px;'><div>{$errors}</div></div>";
    $config_nt = array('content' => $error_msg, 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 90%; margin: 20px auto; padding: 10px 0px; text-align: left; font-style: italic');
    $nt = new Notification('nt_1', $config_nt);
    return $nt->show(FALSE);
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:8,代码来源:incidenttag.php


示例10: 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


示例11: createMessageObject

 /**
  * Creates a by $type parameter specified message
  *
  * @param string $type
  * @param string $message
  *
  * @return Notification
  */
 private function createMessageObject(string $type, string $message) : Notification
 {
     $msg = new Notification();
     $msg->setType($type);
     $msg->setMessage($message);
     $this->handler->add($msg);
     return $msg;
 }
开发者ID:tekkla,项目名称:core-framework,代码行数:16,代码来源:MessageFacade.php


示例12: send

 /**
  * Send the given notification with Apple Push Notification Service Server.
  *
  * @param Notification $notification the notification to send
  * @return boolean true on success, false if there was an error.
  */
 public function send($notification)
 {
     $config = Config::getInstance();
     $appRoot = $config->getString('appRootDir');
     // Instanciate a new ApnsPHP_Push object, with the provider certificate
     $push = new ApnsPHP_Push(ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION, $appRoot . $config->getString('monitoring/notification/push/providerCertificateDir'));
     // Set custom logger
     $push->setLogger(new ApnsPHP_Log_Fruition());
     // Set the Provider Certificate passphrase
     $push->setProviderCertificatePassphrase($config->getString('monitoring/notification/push/passphrase'));
     // Set the Root Certificate Autority to verify the Apple remote peer
     $push->setRootCertificationAuthority($appRoot . $config->getString('monitoring/notification/push/rootCertificateAuthorityDir'));
     // Get recipient list. If no registration id (user did not connect to the
     // mobile app, we stop the process
     $stringRecipients = $notification->getRecipient();
     if (empty($stringRecipients)) {
         Logger::info("No registration id was found. The notification is not sent.");
         return false;
     }
     // Connect to the Apple Push Notification Service
     $push->connect();
     // Create a message for each device
     $message = new ApnsPHP_Message();
     $message->setText($notification->getContent());
     $message->setSound();
     $message->setExpiry(30);
     // 60 seconds
     $recipientList = explode(",", $notification->getRecipient());
     foreach ($recipientList as $registrationId) {
         $message->addRecipient($registrationId);
     }
     // Add the message to the message queue
     $push->add($message);
     // Send all messages in the message queue
     $push->send();
     // Disconnect from the Apple Push Notification Service
     $push->disconnect();
     // Examine the error message container.
     $aErrorQueue = $push->getErrors();
     if (!empty($aErrorQueue)) {
         foreach ($aErrorQueue as $error) {
             foreach ($error['ERRORS'] as $err) {
                 //For statusCode = 8, which is Invalid Token, we delete the token.
                 if ($err['statusCode'] == self::INVALID_TOKEN) {
                     if ($this->handlerErrorCallBack) {
                         $token = $error['MESSAGE']->getRecipient();
                         call_user_func($this->handlerErrorCallBack, $token);
                     }
                 }
                 Logger::error("Sending push notification failed. Error code: " . $err['statusCode'] . ". Message: " . $err['statusMessage']);
             }
         }
         return false;
     }
     //If success
     Logger::info("Notification sent with device token " . $notification->getRecipient());
     return true;
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:64,代码来源:PushNotificationiOSManager.php


示例13: getLatestNotificationsAndCounts

 public function getLatestNotificationsAndCounts($userId)
 {
     $notification = new Notification();
     $listUnread = $notification->Find("toUser = ? and status = ?", array($userId, 'Unread'));
     $unreadCount = count($listUnread);
     $limit = $unreadCount < 20 ? 20 : $unreadCount;
     $list = $notification->Find("toUser = ? order by time desc limit ?", array($userId, $limit));
     return array($unreadCount, $list);
 }
开发者ID:rakesh-mohanta,项目名称:icehrm,代码行数:9,代码来源:NotificationManager.php


示例14: show_notification

function show_notification($msg, $type = 'nf_error')
{
    echo "<div class='container' style='width:100%;height:30px;margin:10px auto;text-align:center'>";
    $config_nt = array('content' => $msg, 'options' => array('type' => $type, 'cancel_button' => FALSE), 'style' => ' margin:0 auto;text-align:center;');
    $nt = new Notification('nt_panel', $config_nt);
    $nt->show();
    echo "</div>";
    die;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:9,代码来源:repository_common.php


示例15: checkAuthCreatedByStudent

 /**
  * A method to check whether a user is allowed to remove a notification
  * In particular, if it's the student who created the notification, only a supervisor can
  * remove it from the list (it is necessary for the supervisor to see every student action)
  * @param Notification $notif the notification object
  */
 private function checkAuthCreatedByStudent(Notification $notif)
 {
     # If it's the student who created the notification, only a supervisor can
     # remove it from the list (it is necessary for the supervisor to see every student action)
     $creatorUserType = $this->model('User', $notif->getCreatorUserId())->getType();
     if ($creatorUserType == User::USER_TYPE_STUDENT && HTTPSession::getInstance()->USER_TYPE != User::USER_TYPE_SUPERVISOR) {
         header('Location: ' . SITE_URL . 'notifications');
     }
 }
开发者ID:emilcieslar,项目名称:student-supervisor,代码行数:15,代码来源:notifications.php


示例16: downloadDismiss

 public function downloadDismiss(Notification $notification)
 {
     $user = Auth::user();
     if ($notification->user_id !== $user->id) {
         App::abort(403, 'That notification doesn\'t belong to you');
     }
     $notification->dismiss();
     $path = $notification->pathRecord->getPath();
     return $this->download($path);
 }
开发者ID:Lord-Simon,项目名称:MangaIndex,代码行数:10,代码来源:UsersController.php


示例17: 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


示例18: notify_and_die

function notify_and_die($msg, $db)
{
    $config_nt = array('content' => $msg, 'options' => array('type' => 'nf_error', 'cancel_button' => ''), 'style' => ' margin:25px auto 0 auto;text-align:center;padding:3px 30px;');
    $nt = new Notification('nt_panel', $config_nt);
    $nt->show();
    if (is_object($db)) {
        $db->close();
    }
    die;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:10,代码来源:alarm_detail.php


示例19: set

 public function set($fields = array())
 {
     if (!$this->_db->insert('posts', $fields)) {
         throw new Exception('There was a problem posting');
     }
     $notification = new Notification();
     $timestamp = date('Y-m-d H:i:s');
     $notification->set(array('uid' => $fields['uid'], 'fid' => $fields['fid'], 'type' => 'new_post', 'timestamp' => $timestamp));
     $notification->set(array('uid' => $fields['fid'], 'fid' => $fields['uid'], 'type' => 'posted', 'timestamp' => $timestamp));
 }
开发者ID:seanhho28,项目名称:social-network,代码行数:10,代码来源:Post.php


示例20: check_deploy_perms

function check_deploy_perms()
{
    if (!Session::am_i_admin()) {
        $config_nt = array('content' => _("You do not have permission to see this section"), 'options' => array('type' => 'nf_error', 'cancel_button' => false), 'style' => 'width: 60%; margin: 30px auto; text-align:center;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        die;
    }
    return true;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:10,代码来源:deploy_common.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP NotificationEvent类代码示例发布时间:2022-05-23
下一篇:
PHP Notice类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap