public function display()
 {
     $category = $this->getService('com://site/weblinks.model.categories')->getItem();
     $items = $this->getService('com://site/weblinks.model.weblinks')->catid(KRequest::get('get.id', 'int'))->getList();
     $xml = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
     $xml .= '<rss version="2.0">' . PHP_EOL;
     $xml .= '<channel>' . PHP_EOL;
     $xml .= '	<title>' . $category->title . '</title>' . PHP_EOL;
     $xml .= '	<description><![CDATA[' . $category->description . ']]></description>' . PHP_EOL;
     $xml .= '	<link>' . KRequest::url() . '</link>' . PHP_EOL;
     $xml .= '	<lastBuildDate>' . date('r') . '</lastBuildDate>' . PHP_EOL;
     $xml .= '	<generator>' . JURI::base() . '</generator>' . PHP_EOL;
     $xml .= '	<language>' . JFactory::getLanguage()->getTag() . '</language>' . PHP_EOL;
     foreach ($items as $item) {
         $xml .= '	<item>' . PHP_EOL;
         $xml .= '		<title>' . htmlspecialchars($item->title) . '</title>' . PHP_EOL;
         $xml .= '		<link>' . JURI::base() . JRoute::_('index.php?option=com_weblinks&view=weblink&id=' . $item->id) . '</link>' . PHP_EOL;
         $xml .= '		<guid>' . JURI::base() . JRoute::_('index.php?option=com_weblinks&view=weblink&id=' . $item->id) . '</guid>' . PHP_EOL;
         $xml .= '		<description><![CDATA[' . htmlspecialchars($item->description) . ']]></description>' . PHP_EOL;
         $xml .= '		<category>' . $category->title . '</category>' . PHP_EOL;
         $xml .= '		<pubDate>' . date('r', strtotime($item->date)) . '</pubDate>' . PHP_EOL;
         $xml .= '	</item>' . PHP_EOL;
     }
     $xml .= '</channel>' . PHP_EOL;
     $xml .= '</rss>';
     $this->output = $xml;
     return parent::display();
 }
Exemple #2
0
 public function display()
 {
     $items = $this->getModel()->getList();
     $root = KRequest::url()->get(KHttpUri::PART_BASE ^ KHttpUri::PART_PATH);
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
     $xml .= '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">';
     $xml .= '<channel>';
     $xml .= '<title>Posts RSS feed</title>';
     $xml .= '<description>RSS description</description>';
     $xml .= '<generator>' . JURI::base() . '</generator>';
     foreach ($items as $item) {
         $xml .= '<item>';
         $xml .= '<title>' . htmlspecialchars($item->title) . '</title>';
         $xml .= '<link>' . $root . JRoute::_('index.php?option=com_ninjaboard&view=topic&id=' . $item->ninjaboard_topic_id . '&post=' . $item->id . '#p' . $item->id) . '</link>';
         $xml .= '<description>' . htmlspecialchars(KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->text))) . '</description>';
         $xml .= '<guid isPermaLink="false">' . $item->uuid . '</guid>';
         $xml .= '<media:title>' . htmlspecialchars($item->title) . '</media:title> ';
         $xml .= '<media:content url="' . $root . JRoute::_('index.php?option=com_ninjaboard&view=avatar&id=' . $item->created_by . '&format=file') . '"/>';
         $xml .= '</item>';
     }
     $xml .= '</channel>';
     $xml .= '</rss>';
     $this->output = $xml;
     return parent::display();
 }
 public function display($tpl = null)
 {
     $prefix = $this->getClassName('prefix');
     //Set the main stylesheet for the component
     KViewHelper::_('stylesheet', $prefix . '.css', 'media/com_' . $prefix . '/css/');
     parent::display($tpl);
 }
Exemple #4
0
 public function display()
 {
     $model = $this->getModel();
     $descendants = array();
     $descendants[] = $model->getItem()->id;
     $config = new KConfig();
     if ($params = JFactory::getApplication()->getMenu()->getActive()->params) {
         $config->append($params->toArray());
     }
     if ($config->show_subcategories) {
         $descendants = array_merge($descendants, $model->getItem()->getDescendants(array('level' => 1))->getColumn('id'));
     }
     $articles = $this->getService('com://site/articles.model.articles')->category_id($descendants)->limit(20)->getList();
     $doc = JFactory::getDocument();
     foreach ($articles as $article) {
         $item = new JFeedItem();
         $item->title = $article->title;
         $item->link = $this->createRoute('option=com_articles&view=article&date=' . date('Y-m-d', strtotime($article->publish_up)) . '&id=' . $article->id . '&slug=' . $article->slug . '&format=html');
         $item->description = $article->introtext;
         $item->date = $article->publish_up;
         $category = json_decode($article->ancestors)->category;
         if (is_numeric($category)) {
             $item->category = $this->getService('com://site/makundi.model.categories')->id($category)->getItem()->title;
         }
         $doc->addItem($item);
     }
     return parent::display();
 }
Exemple #5
0
 /**
  * Return the views output
  * 
  * If the view 'output' variable is empty the output will be generated based on
  * the model data, if it set it will be returned instead.
  *
  *  @return string 	The output of the view
  */
 public function display()
 {
     if (empty($this->output)) {
         $model = $this->getModel();
         if (KInflector::isPlural($this->getName())) {
             $data = $model->getList();
         } else {
             $data = $model->getItem();
         }
         $this->output = json_encode($data->toArray());
     }
     return parent::display();
 }
 /**
  * Return the views output
  *
  * If the view 'output' variable is empty the output will be generated based on the
  * model data, if it set it will be returned instead.
  *
  * If the model contains a callback state, the callback value will be used to apply
  * padding to the JSON output.
  *
  *  @return string 	The output of the view
  */
 public function display()
 {
     if (empty($this->output)) {
         $this->output = KInflector::isPlural($this->getName()) ? $this->_getList() : $this->_getItem();
     }
     if (!is_string($this->output)) {
         $this->output = json_encode($this->output);
     }
     //Handle JSONP
     if (!empty($this->_padding)) {
         $this->output = $this->_padding . '(' . $this->output . ');';
     }
     return parent::display();
 }
Exemple #7
0
 public function display()
 {
     $articles = $this->getModel()->limit(20)->getList();
     $doc = JFactory::getDocument();
     foreach ($articles as $article) {
         $item = new JFeedItem();
         $item->title = $article->title;
         $item->link = $this->createRoute('option=com_articles&view=article&date=' . date('Y-m-d', strtotime($article->publish_up)) . '&id=' . $article->id . '&slug=' . $article->slug . '&format=html');
         $item->description = $article->introtext;
         $item->date = $article->publish_up;
         $category = json_decode($article->ancestors)->category;
         if (is_numeric($category)) {
             $item->category = $this->getService('com://site/makundi.model.categories')->id($category)->getItem()->title;
         }
         $doc->addItem($item);
     }
     return parent::display();
 }
Exemple #8
0
 public function display()
 {
     $items = $this->getModel()->limit(20)->getList();
     $doc = JFactory::getDocument();
     foreach ($items as $item) {
         $item = $this->getService($item->identifier)->id($item->row)->getItem();
         $option = $item->getIdentifier()->package;
         $view = KInflector::singularize($item->getIdentifier()->name);
         $feed_item = new JFeedItem();
         $feed_item->title = $item->title;
         $feed_item->link = $this->createRoute('option=com_' . $option . '&view=' . $view . '&id=' . $item->id . '&format=html');
         $feed_item->description = $item->introtext;
         $feed_item->date = $item->publish_up;
         if ($item->isRelationable() && $item->category) {
             $feed_item->category = $item->category->title;
         }
         $doc->addItem($feed_item);
     }
     return parent::display();
 }
 /**
  * Return the views output
  *
  * @param  boolean 	If TRUE apply write filters. Default FALSE.
  * @return string   The output of the view
  */
 public function display()
 {
     if (empty($this->output)) {
         //Load the template object
         $this->output = $this->getTemplate()->loadIdentifier($this->_layout, $this->_data)->render($this->_auto_filter);
     }
     return parent::display();
 }
Exemple #10
0
 /**
  * Return the views output
  *
  * @return string 	The output of the view
  */
 public function display()
 {
     if (empty($this->output)) {
         $this->output = $this->getTemplate()->loadIdentifier($this->_layout, $this->_data)->render();
     }
     return parent::display();
 }
Exemple #11
0
	/**
	 * Return the views output
	 *
	 * If the view 'output' variable is empty the output will be generated based on the
	 * model data, if it set it will be returned instead.
	 *
	 * If the model contains a callback state, the callback value will be used to apply
	 * padding to the JSON output.
 	 *
	 *  @return string 	The output of the view
	 */
    public function display()
    {
        if(empty($this->output))
        {
            $model = $this->getModel();

            if(KInflector::isPlural($this->getName())) {
                $data = array_values($model->getList()->toArray());
            } else {
                $data = $model->getItem()->toArray();
            }

            $this->output = $data;
        }

        if (!is_string($this->output)) {
        	$this->output = json_encode($this->output);
        }

        //Handle JSONP
        if(!empty($this->_padding)) {
            $this->output     = $this->_padding.'('.$this->output.');';
        }

        return parent::display();
    }