Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_weblinks
  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 WebLinks component
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_weblinks
  17.  * @since       1.5
  18.  */
  19. {
  20.     /**
  21.      * Execute and display a template script.
  22.      *
  23.      * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  24.      *
  25.      * @return  mixed  A string if successful, otherwise a Error object.
  26.      */
  27.     public function display($tpl null)
  28.     {
  29.         parent::commonCategoryDisplay();
  30.  
  31.         // Prepare the data.
  32.         // Compute the weblink slug & link url.
  33.         foreach ($this->items as $item)
  34.         {
  35.             $item->slug    $item->alias ($item->id.':'.$item->alias$item->id;
  36.  
  37.             if ($item->params->get('count_clicks'$this->params->get('count_clicks')) == 1)
  38.             {
  39.                 $item->link JRoute::_('index.php?option=com_weblinks&task=weblink.go&id='$item->id);
  40.             }
  41.             else
  42.             {
  43.                 $item->link $item->url;
  44.             }
  45.  
  46.             $temp new JRegistry;
  47.             $temp->loadString($item->params);
  48.             $item->params clone($this->params);
  49.             $item->params->merge($temp);
  50.         }
  51.  
  52.         return parent::display($tpl);
  53.     }
  54.  
  55.     /**
  56.      * Prepares the document
  57.      *
  58.      * @return  void 
  59.      */
  60.     protected function prepareDocument()
  61.     {
  62.         $app        JFactory::getApplication();
  63.         $menus        $app->getMenu();
  64.         $pathway    $app->getPathway();
  65.         $title         null;
  66.  
  67.         // Because the application sets a default page title,
  68.         // we need to get it from the menu item itself
  69.         $menu $menus->getActive();
  70.  
  71.         if ($menu)
  72.         {
  73.             $this->params->def('page_heading'$this->params->get('page_title'$menu->title));
  74.         }
  75.         else
  76.         {
  77.             $this->params->def('page_heading'JText::_('COM_WEBLINKS_DEFAULT_PAGE_TITLE'));
  78.         }
  79.  
  80.         $id = (int) @$menu->query['id'];
  81.  
  82.         if ($menu && ($menu->query['option'!= 'com_weblinks' || $id != $this->category->id))
  83.         {
  84.             $this->params->set('page_subheading'$this->category->title);
  85.             $path array(array('title' => $this->category->title'link' => ''));
  86.             $category $this->category->getParent();
  87.  
  88.             while (($menu->query['option'!= 'com_weblinks' || $id != $category->id&& $category->id 1)
  89.             {
  90.                 $path[array('title' => $category->title'link' => WeblinksHelperRoute::getCategoryRoute($category->id));
  91.                 $category $category->getParent();
  92.             }
  93.  
  94.             $path array_reverse($path);
  95.  
  96.             foreach ($path as $item)
  97.             {
  98.                 $pathway->addItem($item['title']$item['link']);
  99.             }
  100.         }
  101.  
  102.         parent::addFeed();
  103.     }
  104. }

Documentation generated on Tue, 19 Nov 2013 15:16:55 +0100 by phpDocumentor 1.4.3