[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/components/com_finder/views/search/ -> view.feed.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.Site
   4   * @subpackage  com_finder
   5   *
   6   * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   7   * @license     GNU General Public License version 2 or later; see LICENSE
   8   */
   9  
  10  defined('_JEXEC') or die;
  11  
  12  jimport('joomla.application.component.view');
  13  
  14  /**
  15   * Search feed view class for the Finder package.
  16   *
  17   * @package     Joomla.Site
  18   * @subpackage  com_finder
  19   * @since       2.5
  20   */
  21  class FinderViewSearch extends JView
  22  {
  23      /**
  24       * Method to display the view.
  25       *
  26       * @param   string  $tpl  A template file to load. [optional]
  27       *
  28       * @return  mixed  JError object on failure, void on success.
  29       *
  30       * @since   2.5
  31       */
  32  	public function display($tpl = null)
  33      {
  34          // Get the application
  35          $app = JFactory::getApplication();
  36          // Adjust the list limit to the feed limit.
  37          $app->input->set('limit', $app->getCfg('feed_limit'));
  38  
  39          // Get view data.
  40          $state = $this->get('State');
  41          $params = $state->get('params');
  42          $query = $this->get('Query');
  43          $results = $this->get('Results');
  44  
  45          // Push out the query data.
  46          JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
  47          $suggested = JHtml::_('query.suggested', $query);
  48          $explained = JHtml::_('query.explained', $query);
  49  
  50          // Set the document title.
  51          $title = $params->get('page_title', '');
  52  
  53          if (empty($title))
  54          {
  55              $title = $app->getCfg('sitename');
  56          }
  57          elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
  58          {
  59              $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
  60          }
  61          elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
  62          {
  63              $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
  64          }
  65  
  66          $this->document->setTitle($title);
  67  
  68          // Configure the document description.
  69          if (!empty($explained))
  70          {
  71              $this->document->setDescription(html_entity_decode(strip_tags($explained), ENT_QUOTES, 'UTF-8'));
  72          }
  73  
  74          // Set the document link.
  75          $this->document->link = JRoute::_($query->toURI());
  76  
  77          // Convert the results to feed entries.
  78          foreach ($results as $result)
  79          {
  80              // Convert the result to a feed entry.
  81              $item = new JFeedItem;
  82              $item->title = $result->title;
  83              $item->link = JRoute::_($result->route);
  84              $item->description = $result->description;
  85              $item->date = intval($result->start_date) ? JHtml::date($result->start_date, 'l d F Y') : $result->indexdate;
  86  
  87              // Get the taxonomy data.
  88              $taxonomy = $result->getTaxonomy();
  89  
  90              // Add the category to the feed if available.
  91              if (isset($taxonomy['Category']))
  92              {
  93                  $node = array_pop($taxonomy['Category']);
  94                  $item->category = $node->title;
  95              }
  96  
  97              // loads item info into rss array
  98              $this->document->addItem($item);
  99          }
 100      }
 101  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1