/** * It gives the rss feed of contents of given ids. * * @param $content_id array The content ids of the contents for getting RssFeed * @return $generated_rss_feed string This string contains the content of RssFeed file */ public static function get_feed_for_content($content_ids) { Logger::log("Enter: Content::get_feed_for_content()"); $sql = "SELECT * FROM {contents} WHERE content_id IN (" . $content_ids[0]; for ($i = 1; $i < count($content_ids); $i++) { $sql .= ", " . $content_ids[$i]; } $sql .= ")"; $data = array(); $res = Dal::query($sql, $data); $new_rss = new RssFeedHelper(); $generated_rss_feed = $new_rss->get_rss_feed($res); Logger::log("Exit: Content::get_feed_for_content()"); return $generated_rss_feed; }
/** * get rss feed of blogs for a user. * * @param $user_id string The user id of the user for getting RssFeed of the blogpost * @param $no_of_items string The No of latest items for which Rssfeed is Generated * @return $generated_rss_feed string This string contains the content of RssFeed file */ public static function get_feed_for_user($user_id, $no_of_items = 10) { global $TB_CONTENTS; Logger::log("Enter: BlogPost::get_feed_for_user()"); // Check if user id given if (!$user_id) { Logger::log(" Throwing exception REQUIRED_PARAMETERS_MISSING | Message: Required variable not specified", LOGGER_ERROR); throw new PAException(REQUIRED_PARAMETERS_MISSING, "Required variable not specified"); } //Query for selecting all title, description from table cotents for generation of RssFeed $sql = "SELECT * FROM {contents} WHERE author_id = ? AND type = 1 AND is_active = 1 ORDER BY changed DESC LIMIT ?"; $data = array($user_id, $no_of_items); $res = Dal::query($sql, $data); $new_rss = new RssFeedHelper(); $generated_rss_feed = $new_rss->get_rss_feed($res, $user_id); Logger::log("Exit: BlogPost::get_feed_for_user()"); return $generated_rss_feed; }