Пример #1
0
 /**
  *
  * @param mixed $handler_id The ID of the handler.
  * @param array &$data The local request data.
  */
 public function _show_rss($handler_id, array &$data)
 {
     $qb = net_nemein_wiki_wikipage::new_query_builder();
     $qb->add_constraint('topic.component', '=', midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT));
     $qb->add_constraint('topic', 'INTREE', $this->_topic->id);
     $qb->add_order('metadata.revised', 'DESC');
     $qb->set_limit($this->_config->get('rss_count'));
     $result = $qb->execute();
     foreach ($result as $wikipage) {
         if ($wikipage->topic == $this->_topic->id) {
             $node = $data['node'];
         } else {
             $node = $data['nap']->get_node($wikipage->topic);
         }
         $item = new FeedItem();
         $item->title = $wikipage->title;
         if ($wikipage->name == 'index') {
             $item->link = "{$node[MIDCOM_NAV_FULLURL]}";
         } else {
             $item->link = "{$node[MIDCOM_NAV_FULLURL]}{$wikipage->name}/";
         }
         $item->date = $wikipage->metadata->revised;
         try {
             $author = new midcom_db_person($wikipage->metadata->revisor);
             $item->author = $author->name;
         } catch (midcom_error $e) {
             $e->log();
         }
         $parser = new net_nemein_wiki_parser($wikipage);
         $item->description = $parser->get_html();
         $data['rss_creator']->addItem($item);
     }
     $data['rss'] = $data['rss_creator']->createFeed('RSS2.0');
     echo $data['rss'];
 }