static function item_deleted($item) { notification::send_item_deleted($item); if (notification::is_watching($item)) { notification::remove_watch($item); } }
static function item_deleted($item) { try { notification::send_item_deleted($item); if (notification::is_watching($item)) { notification::remove_watch($item); } } catch (Exception $e) { Kohana_Log::add("error", "@todo notification_event::item_deleted() failed"); Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } }
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)); }
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()); }