/** * Delete stream items given the app type. * * @since 1.0 * @access public * @param */ public function delete($contextId, $contextType, $actorId = '', $verb = '') { // Load dispatcher. $dispatcher = ES::dispatcher(); $args = array($contextId, $contextType, $verb); // Trigger onBeforeStreamDelete $dispatcher->trigger(SOCIAL_APPS_GROUP_USER, 'onBeforeStreamDelete', $args); $dispatcher->trigger(SOCIAL_APPS_GROUP_GROUP, 'onBeforeStreamDelete', $args); $dispatcher->trigger(SOCIAL_APPS_GROUP_EVENT, 'onBeforeStreamDelete', $args); $model = FD::model('Stream'); $model->delete($contextId, $contextType, $actorId, $verb); // Trigger onAfterStreamDelete $dispatcher->trigger(SOCIAL_APPS_GROUP_USER, 'onAfterStreamDelete', $args); $dispatcher->trigger(SOCIAL_APPS_GROUP_GROUP, 'onAfterStreamDelete', $args); $dispatcher->trigger(SOCIAL_APPS_GROUP_EVENT, 'onAfterStreamDelete', $args); }
/** * Retrieves a list of notification items. * * @since 1.0 * @access public * @param bool To aggregate the notification items or not. * @return Array An array of @SocialTableNotification */ public function getItems($options = array()) { $model = ES::model('Notifications'); $items = $model->getItems($options); if (!$items) { return false; } // Retrieve applications and trigger onNotificationLoad $dispatcher = ES::dispatcher(); $result = array(); // Trigger apps foreach ($items as $item) { // Add a `since` column to the result so that user's could use the `since` time format. $item->since = FD::date($item->created)->toLapsed(); $args = array(&$item); // @trigger onNotificationLoad $dispatcher->trigger(SOCIAL_APPS_GROUP_USER, 'onNotificationLoad', $args); // @trigger onNotificationLoad $dispatcher->trigger(SOCIAL_APPS_GROUP_GROUP, 'onNotificationLoad', $args); // @trigger onNotificationLoad $dispatcher->trigger(SOCIAL_APPS_GROUP_EVENT, 'onNotificationLoad', $args); // If an app lets us know that they want to exclude the stream, we should exclude it. if (isset($item->exclude) && $item->exclude) { continue; } // Let's format the item title. $this->formatItem($item); $result[] = $item; } // Group up items. if (isset($options['group']) && $options['group'] == SOCIAL_NOTIFICATION_GROUP_ITEMS) { $result = $this->group($result); } return $result; }