Ejemplo n.º 1
0
 /**
  *  This method is called by all rss feed generator method (common to all methods) using generate_rss method
  *
  * @param $res string The user id of the user for getting RssFeed of the content. FIXME: from the code, it looks like this has to be a DB result object (returned from Dal::query).
  * @return $result string This string contains the content of RssFeed file
  */
 public function get_rss_feed($res, $user_id = 0)
 {
     // Collecting all $no_of_items rows in an array $row
     while ($row[] = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
     }
     $result = RssFeedHelper::generate_rss($row, (int) $user_id);
     return $result;
 }
Ejemplo n.º 2
0
 /**
  *  Add a new item to rss_helper object.
  *
  * @param $content_collection_id string The id of the content collection for which Rssfeed is Generated
  * @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_content_collection($collection_id, $no_of_items = 10)
 {
     Logger::log("Enter: ContentCollection::get__feed_for_content_collection()");
     if (!$collection_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 items from table cotents for generation of RssFeed
     $sql = 'SELECT C.content_id AS content_id, C.author_id AS author_id, C.type AS type, C.body AS body, C.created AS created, C.changed AS changed, C.collection_id AS ccid FROM {contents} AS C WHERE C.collection_id = ? ORDER BY C.created DESC LIMIT ?';
     $data = array($collection_id, $no_of_items);
     $res = Dal::query($sql, $data);
     // Collecting all $no_of_items rows in an array $row
     while ($row[] = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
     }
     $new_rss = new RssFeedHelper();
     $generated_rss_feed = $new_rss->generate_rss($row);
     Logger::log("Exit: ContentCollection::get__feed_for_content_collection()");
     return $generated_rss_feed;
 }