Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_contact
  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.  * Frontpage View class
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_contact
  17.  * @since       1.6
  18.  */
  19. {
  20.     protected $state;
  21.  
  22.     protected $items;
  23.  
  24.     protected $category;
  25.  
  26.     protected $categories;
  27.  
  28.     protected $pagination;
  29.  
  30.     /**
  31.      * Display the view
  32.      *
  33.      * @return  mixed  False on error, null otherwise.
  34.      */
  35.     public function display($tpl null)
  36.     {
  37.         $app        JFactory::getApplication();
  38.         $params        $app->getParams();
  39.  
  40.         // Get some data from the models
  41.         $state        $this->get('State');
  42.         $items        $this->get('Items');
  43.         $category    $this->get('Category');
  44.         $children    $this->get('Children');
  45.         $parent     $this->get('Parent');
  46.         $pagination    $this->get('Pagination');
  47.  
  48.         // Check for errors.
  49.         if (count($errors $this->get('Errors')))
  50.         {
  51.             JError::raiseWarning(500implode("\n"$errors));
  52.             return false;
  53.         }
  54.  
  55.         // Prepare the data.
  56.         // Compute the contact slug.
  57.         for ($i 0$n count($items)$i $n$i++)
  58.         {
  59.             $item        &$items[$i];
  60.             $item->slug    $item->alias ($item->id.':'.$item->alias$item->id;
  61.             $temp        new JRegistry;
  62.             $temp->loadString($item->params);
  63.             $item->params clone($params);
  64.             $item->params->merge($temp);
  65.             if ($item->params->get('show_email'0== 1)
  66.             {
  67.                 $item->email_to trim($item->email_to);
  68.                 if (!empty($item->email_to&& JMailHelper::isEmailAddress($item->email_to))
  69.                 {
  70.                     $item->email_to JHtml::_('email.cloak'$item->email_to);
  71.                 else {
  72.                     $item->email_to '';
  73.                 }
  74.             }
  75.         }
  76.  
  77.         // Escape strings for HTML output
  78.         $this->pageclass_sfx htmlspecialchars($params->get('pageclass_sfx'));
  79.  
  80.         $maxLevel         $params->get('maxLevel'-1);
  81.         $this->maxLevel   &$maxLevel;
  82.         $this->state      = &$state;
  83.         $this->items      = &$items;
  84.         $this->category   = &$category;
  85.         $this->children   &$children;
  86.         $this->params     &$params;
  87.         $this->parent     &$parent;
  88.         $this->pagination = &$pagination;
  89.  
  90.         $this->_prepareDocument();
  91.  
  92.         parent::display($tpl);
  93.     }
  94.  
  95.     /**
  96.      * Prepares the document
  97.      */
  98.     protected function _prepareDocument()
  99.     {
  100.         $app        JFactory::getApplication();
  101.         $menus        $app->getMenu();
  102.         $title         null;
  103.  
  104.         // Because the application sets a default page title,
  105.         // we need to get it from the menu item itself
  106.         $menu $menus->getActive();
  107.         if ($menu)
  108.         {
  109.             $this->params->def('page_heading'$this->params->get('page_title'$menu->title));
  110.         }
  111.         else
  112.         {
  113.             $this->params->def('page_heading'JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE'));
  114.         }
  115.  
  116.         $title $this->params->get('page_title''');
  117.         if (empty($title))
  118.         {
  119.             $title $app->getCfg('sitename');
  120.         }
  121.         elseif ($app->getCfg('sitename_pagetitles'0== 1)
  122.         {
  123.             $title JText::sprintf('JPAGETITLE'$app->getCfg('sitename')$title);
  124.         }
  125.         elseif ($app->getCfg('sitename_pagetitles'0== 2)
  126.         {
  127.             $title JText::sprintf('JPAGETITLE'$title$app->getCfg('sitename'));
  128.         }
  129.         $this->document->setTitle($title);
  130.  
  131.         if ($this->params->get('menu-meta_description'))
  132.         {
  133.             $this->document->setDescription($this->params->get('menu-meta_description'));
  134.         }
  135.  
  136.         if ($this->params->get('menu-meta_keywords'))
  137.         {
  138.             $this->document->setMetadata('keywords'$this->params->get('menu-meta_keywords'));
  139.         }
  140.  
  141.         if ($this->params->get('robots'))
  142.         {
  143.             $this->document->setMetadata('robots'$this->params->get('robots'));
  144.         }
  145.     }
  146. }

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