當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。