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


PHP notification::is_watching方法代码示例

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


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

示例1: item_before_delete

 static function item_before_delete($item)
 {
     notification::send_item_deleted($item);
     if (notification::is_watching($item)) {
         notification::remove_watch($item);
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:7,代码来源:notification_event.php

示例2: album

 static function album($menu, $theme)
 {
     if (!user::active()->guest) {
         $item = $theme->item();
         if ($item) {
             $watching = notification::is_watching($item);
             $menu->append(Menu::factory("link")->id("watch")->label(t("Enable notifications for this album"))->url(url::site("notification/watch/{$item->id}?csrf=" . access::csrf_token()))->css_id($watching ? "gRemoveWatchLink" : "gAddWatchLink"));
         }
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:10,代码来源:notification_menu.php

示例3: site_menu

 static function site_menu($menu, $theme)
 {
     if (!user::active()->guest) {
         $item = $theme->item();
         if ($item && $item->is_album() && access::can("view", $item)) {
             $watching = notification::is_watching($item);
             $label = $watching ? t("Remove notifications") : t("Enable notifications");
             $menu->get("options_menu")->append(Menu::factory("link")->id("watch")->label($label)->css_id("gNotifyLink")->url(url::site("notification/watch/{$item->id}?csrf=" . access::csrf_token())));
         }
     }
 }
开发者ID:eo04837,项目名称:gallery3,代码行数:11,代码来源:notification_event.php

示例4: watch

 function watch($id)
 {
     access::verify_csrf();
     $item = ORM::factory("item", $id);
     access::required("view", $item);
     if (notification::is_watching($item)) {
         notification::remove_watch($item);
         message::success(sprintf(t("You are no longer watching %s"), $item->title));
     } else {
         notification::add_watch($item);
         message::success(sprintf(t("You are now watching %s"), $item->title));
     }
     url::redirect($item->url(array(), true));
 }
开发者ID:xafr,项目名称:gallery3,代码行数:14,代码来源:notification.php

示例5: watch

 function watch($id)
 {
     access::verify_csrf();
     $item = ORM::factory("item", $id);
     access::required("view", $item);
     $watching = notification::is_watching($item);
     if (!$watching) {
         notification::add_watch($item);
         message::success(sprintf(t("Watch Enabled on %s!"), $item->title));
     } else {
         notification::remove_watch($item);
         message::success(sprintf(t("Watch Removed on %s!"), $item->title));
     }
     url::redirect($item->url());
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:15,代码来源:notification.php

示例6: send_notifications

 public static function send_notifications($recipient_id, $item_id, $mailtype)
 {
     //Load the item
     $item = ORM::factory("item")->where("id", "=", $item_id)->find();
     if (!$item->loaded()) {
         return false;
     }
     //Load the user
     $recipient = ORM::factory("user")->where("id", "=", $recipient_id)->find();
     if (!$recipient->loaded()) {
         return false;
     }
     //Only send mail if the notifications are switched on globally
     if (!module::get_var("photoannotation", "nonotifications", false)) {
         //Check if the use has a valid e-mail
         if (!valid::email($recipient->email)) {
             return false;
         }
         //Get the users settings
         $notification_settings = self::get_user_notification_settings($recipient);
         //Check which type of mail to send
         switch ($mailtype) {
             case "newtag":
                 //Only send if user has this option enabled
                 if ($notification_settings->newtag) {
                     //Get subject and body and send the mail
                     $subject = module::get_var("photoannotation", "newtagsubject", "Someone tagged a photo of you");
                     $body = module::get_var("photoannotation", "newtagbody", "Hello %name, please visit %url to view the photo.");
                     $body = str_ireplace(array("%url", "%name"), array($item->abs_url(), $recipient->display_name()), $body);
                     return self::_send_mail($recipient->email, $subject, $body);
                 }
                 break;
             case "newcomment":
                 //Only send if user has this option enabled
                 if ($notification_settings->comment) {
                     //Don't send if the notification module is active and the user is watching this item
                     if (module::is_active("notification")) {
                         if (notification::is_watching($item, $recipient)) {
                             return false;
                         }
                     }
                     //Get subject and body and send the mail
                     $subject = module::get_var("photoannotation", "newcommentsubject", "Someone added a comment to photo of you");
                     $body = module::get_var("photoannotation", "newcommentbody", "Hello %name, please visit %url to read the comment.");
                     $body = str_ireplace(array("%url", "%name"), array($item->abs_url(), $recipient->display_name()), $body);
                     return self::_send_mail($recipient->email, $subject, $body);
                 }
                 break;
             case "updatecomment":
                 //Only send if user has this option enabled
                 if ($notification_settings->comment) {
                     //Don't send if the notification module is active and the user is watching this item
                     if (module::is_active("notification")) {
                         if (notification::is_watching($item, $recipient)) {
                             return false;
                         }
                     }
                     //Get subject and body and send the mail
                     $subject = module::get_var("photoannotation", "updatedcommentsubject", "Someone updated a comment to photo of you");
                     $body = module::get_var("photoannotation", "updatedcommentbody", "Hello %name, please visit %url to read the comment.");
                     $body = str_ireplace(array("%url", "%name"), array($item->abs_url(), $recipient->display_name()), $body);
                     return self::_send_mail($recipient->email, $subject, $body);
                 }
         }
     }
     return false;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:67,代码来源:photo_annotation.php


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