[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/components/com_contact/views/category/ -> view.feed.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: view.feed.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Contact
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant to the
   9   * GNU General Public License, and as distributed it includes or is derivative
  10   * of works licensed under the GNU General Public License or other free or open
  11   * source software licenses. See COPYRIGHT.php for copyright notices and
  12   * details.
  13   */
  14  
  15  // Check to ensure this file is included in Joomla!
  16  defined('_JEXEC') or die( 'Restricted access' );
  17  
  18  jimport('joomla.application.component.view');
  19  
  20  /**
  21   * @pacakge Joomla
  22   * @subpackage    Contacts
  23   */
  24  class ContactViewCategory extends JView
  25  {
  26  	function display()
  27      {
  28          global $mainframe;
  29  
  30          $db            =& JFactory::getDBO();
  31          $document    =& JFactory::getDocument();
  32          $document->link = JRoute::_('index.php?option=com_contact&view=category&catid='.JRequest::getVar('catid',null, '', 'int'));
  33          
  34          $siteEmail = $mainframe->getCfg('mailfrom');
  35          $fromName = $mainframe->getCfg('fromname');
  36          $document->editor = $fromName;
  37          $document->editorEmail = $siteEmail;
  38                  
  39          $limit         = JRequest::getVar('limit', $mainframe->getCfg('feed_limit'), '', 'int');
  40          $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
  41          $catid      = JRequest::getVar('catid', 0, '', 'int');
  42  
  43          $where        = ' WHERE a.published = 1';
  44  
  45          if ( $catid ) {
  46              $where .= ' AND a.catid = '. (int) $catid;
  47          }
  48  
  49          $query = 'SELECT'
  50          . ' a.name AS title,'
  51          . ' CONCAT( a.con_position, \' - \', a.misc ) AS description,'
  52          . ' "" AS date,'
  53          . ' c.title AS category,'
  54          . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'
  55          . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as catslug'
  56          . ' FROM #__contact_details AS a'
  57          . ' LEFT JOIN #__categories AS c ON c.id = a.catid'
  58          . $where
  59          . ' ORDER BY a.catid, a.ordering'
  60          ;
  61          $db->setQuery( $query, 0, $limit );
  62          $rows = $db->loadObjectList();
  63  
  64          foreach ( $rows as $row )
  65          {
  66              // strip html from feed item title
  67              $title = $this->escape( $row->title );
  68              $title = html_entity_decode( $title );
  69  
  70              // url link to article
  71              $link = JRoute::_('index.php?option=com_contact&view=contact&id='. $row->slug .'&catid='.$row->catslug );
  72  
  73              // strip html from feed item description text
  74              $description = $row->description;
  75              $date = ( $row->date ? date( 'r', strtotime($row->date) ) : '' );
  76  
  77              // load individual item creator class
  78              $item = new JFeedItem();
  79              $item->title         = $title;
  80              $item->link         = $link;
  81              $item->description     = $description;
  82              $item->date            = $date;
  83              $item->category       = $row->category;
  84  
  85              // loads item info into rss array
  86              $document->addItem( $item );
  87          }
  88      }
  89  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1