Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_content
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * HTML View class for the Content component
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_content
  17.  * @since       1.5
  18.  */
  19. {
  20.     protected $state = null;
  21.  
  22.     protected $item = null;
  23.  
  24.     protected $items = null;
  25.  
  26.     protected $pagination = null;
  27.  
  28.     public function display($tpl null)
  29.     {
  30.         $user        JFactory::getUser();
  31.  
  32.         $state         $this->get('State');
  33.         $items         $this->get('Items');
  34.         $pagination    $this->get('Pagination');
  35.  
  36.         // Get the page/component configuration
  37.         $params &$state->params;
  38.  
  39.         foreach ($items as $item)
  40.         {
  41.             $item->catslug ($item->category_alias($item->catid ':' $item->category_alias$item->catid;
  42.             $item->parent_slug ($item->parent_alias($item->parent_id ':' $item->parent_alias$item->parent_id;
  43.  
  44.             // No link for ROOT category
  45.             if ($item->parent_alias == 'root')
  46.             {
  47.                 $item->parent_slug null;
  48.             }
  49.         }
  50.  
  51.         $form new stdClass;
  52.         // Month Field
  53.         $months array(
  54.             '' => JText::_('COM_CONTENT_MONTH'),
  55.             '01' => JText::_('JANUARY_SHORT'),
  56.             '02' => JText::_('FEBRUARY_SHORT'),
  57.             '03' => JText::_('MARCH_SHORT'),
  58.             '04' => JText::_('APRIL_SHORT'),
  59.             '05' => JText::_('MAY_SHORT'),
  60.             '06' => JText::_('JUNE_SHORT'),
  61.             '07' => JText::_('JULY_SHORT'),
  62.             '08' => JText::_('AUGUST_SHORT'),
  63.             '09' => JText::_('SEPTEMBER_SHORT'),
  64.             '10' => JText::_('OCTOBER_SHORT'),
  65.             '11' => JText::_('NOVEMBER_SHORT'),
  66.             '12' => JText::_('DECEMBER_SHORT')
  67.         );
  68.         $form->monthField JHtml::_(
  69.             'select.genericlist',
  70.             $months,
  71.             'month',
  72.             array(
  73.                 'list.attr' => 'size="1" class="inputbox"',
  74.                 'list.select' => $state->get('filter.month'),
  75.                 'option.key' => null
  76.             )
  77.         );
  78.         // Year Field
  79.         $years array();
  80.         $years[JHtml::_('select.option'nullJText::_('JYEAR'));
  81.         for ($i 2000$i <= 2020$i++)
  82.         {
  83.             $years[JHtml::_('select.option'$i$i);
  84.         }
  85.         $form->yearField JHtml::_(
  86.             'select.genericlist',
  87.             $years,
  88.             'year',
  89.             array('list.attr' => 'size="1" class="inputbox"''list.select' => $state->get('filter.year'))
  90.         );
  91.         $form->limitField $pagination->getLimitBox();
  92.  
  93.         //Escape strings for HTML output
  94.         $this->pageclass_sfx htmlspecialchars($params->get('pageclass_sfx'));
  95.  
  96.         $this->filter     $state->get('list.filter');
  97.         $this->form       &$form;
  98.         $this->items      = &$items;
  99.         $this->params     &$params;
  100.         $this->user       &$user;
  101.         $this->pagination = &$pagination;
  102.  
  103.         $this->_prepareDocument();
  104.  
  105.         parent::display($tpl);
  106.     }
  107.  
  108.     /**
  109.      * Prepares the document
  110.      */
  111.     protected function _prepareDocument()
  112.     {
  113.         $app        JFactory::getApplication();
  114.         $menus        $app->getMenu();
  115.         $title         null;
  116.  
  117.         // Because the application sets a default page title,
  118.         // we need to get it from the menu item itself
  119.         $menu $menus->getActive();
  120.         if ($menu)
  121.         {
  122.             $this->params->def('page_heading'$this->params->get('page_title'$menu->title));
  123.         }
  124.         else
  125.         {
  126.             $this->params->def('page_heading'JText::_('JGLOBAL_ARTICLES'));
  127.         }
  128.  
  129.         $title $this->params->get('page_title''');
  130.         if (empty($title))
  131.         {
  132.             $title $app->getCfg('sitename');
  133.         }
  134.         elseif ($app->getCfg('sitename_pagetitles'0== 1)
  135.         {
  136.             $title JText::sprintf('JPAGETITLE'$app->getCfg('sitename')$title);
  137.         }
  138.         elseif ($app->getCfg('sitename_pagetitles'0== 2)
  139.         {
  140.             $title JText::sprintf('JPAGETITLE'$title$app->getCfg('sitename'));
  141.         }
  142.         $this->document->setTitle($title);
  143.  
  144.         if ($this->params->get('menu-meta_description'))
  145.         {
  146.             $this->document->setDescription($this->params->get('menu-meta_description'));
  147.         }
  148.  
  149.         if ($this->params->get('menu-meta_keywords'))
  150.         {
  151.             $this->document->setMetadata('keywords'$this->params->get('menu-meta_keywords'));
  152.         }
  153.  
  154.         if ($this->params->get('robots'))
  155.         {
  156.             $this->document->setMetadata('robots'$this->params->get('robots'));
  157.         }
  158.     }
  159. }

Documentation generated on Tue, 19 Nov 2013 15:17:18 +0100 by phpDocumentor 1.4.3