[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/components/com_weblinks/views/category/ -> view.html.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: view.html.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @subpackage    Weblinks
   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
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and 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   * HTML View class for the WebLinks component
  22   *
  23   * @static
  24   * @package        Joomla
  25   * @subpackage    Weblinks
  26   * @since 1.0
  27   */
  28  class WeblinksViewCategory extends JView
  29  {
  30  	function display( $tpl = null )
  31      {
  32          global $mainframe;
  33  
  34          // Initialize some variables
  35          $document    = &JFactory::getDocument();
  36          $uri         = &JFactory::getURI();
  37          $pathway    = &$mainframe->getPathway();
  38  
  39          // Get the parameters of the active menu item
  40          $menus = &JSite::getMenu();
  41          $menu  = $menus->getActive();
  42  
  43          // Get some data from the model
  44          $items        = &$this->get('data' );
  45          $total        = &$this->get('total');
  46          $pagination    = &$this->get('pagination');
  47          $category    = &$this->get('category' );
  48          $state        = &$this->get('state');
  49  
  50          $model =& JModel::getInstance('categories', 'weblinksmodel');
  51          $categories = $model->getData();
  52  
  53          // Get the page/component configuration
  54          $params = &$mainframe->getParams();
  55  
  56          $category->total = $total;
  57  
  58          // Add alternate feed link
  59          if($params->get('show_feed_link', 1) == 1)
  60          {
  61              $link    = '&view=category&id='.$category->slug.'&format=feed&limitstart=';
  62              $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
  63              $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs);
  64              $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
  65              $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
  66          }
  67  
  68          $menus    = &JSite::getMenu();
  69          $menu    = $menus->getActive();
  70  
  71          // because the application sets a default page title, we need to get it
  72          // right from the menu item itself
  73          if (is_object( $menu )) {
  74              $menu_params = new JParameter( $menu->params );
  75              if (!$menu_params->get( 'page_title')) {
  76                  $params->set('page_title', $category->title);
  77              }
  78          } else {
  79              $params->set('page_title',    $category->title);
  80          }
  81          $document->setTitle( $params->get( 'page_title' ) );
  82  
  83          //set breadcrumbs
  84          if(is_object($menu) && $menu->query['view'] != 'category') {
  85              $pathway->addItem($category->title, '');
  86          }
  87  
  88          // Prepare category description
  89          $category->description = JHTML::_('content.prepare', $category->description);
  90  
  91          // table ordering
  92          $lists['order_Dir'] = $state->get('filter_order_dir');
  93          $lists['order'] = $state->get('filter_order');
  94  
  95          // Set some defaults if not set for params
  96          $params->def('comp_description', JText::_('WEBLINKS_DESC'));
  97          // Define image tag attributes
  98          if (isset( $category->image ) && $category->image != '')
  99          {
 100              $attribs['align']  = $category->image_position;
 101              $attribs['hspace'] = 6;
 102  
 103              // Use the static HTML library to build the image tag
 104              $category->image = JHTML::_('image', 'images/stories/'.$category->image, JText::_('Web Links'), $attribs);
 105          }
 106  
 107          // icon in table display
 108          if ( $params->get( 'link_icons' ) <> -1 ) {
 109              $image = JHTML::_('image.site',  $params->get('link_icons', 'weblink.png'), '/images/M_images/', $params->get( 'weblink_icons' ), '/images/M_images/', 'Link' );
 110          }
 111  
 112          $k = 0;
 113          $count = count($items);
 114          for($i = 0; $i < $count; $i++)
 115          {
 116              $item =& $items[$i];
 117  
 118              $link = JRoute::_( 'index.php?view=weblink&catid='.$category->slug.'&id='. $item->slug);
 119  
 120              $menuclass = 'category'.$this->escape($params->get( 'pageclass_sfx' ));
 121  
 122              $itemParams = new JParameter($item->params);
 123              switch ($itemParams->get('target', $params->get('target')))
 124              {
 125                  // cases are slightly different
 126                  case 1:
 127                      // open in a new window
 128                      $item->link = '<a href="'. $link .'" target="_blank" class="'. $menuclass .'">'. $this->escape($item->title) .'</a>';
 129                      break;
 130  
 131                  case 2:
 132                      // open in a popup window
 133                      $item->link = "<a href=\"#\" onclick=\"javascript: window.open('". $link ."', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\">". $this->escape($item->title) ."</a>\n";
 134                      break;
 135  
 136                  default:
 137                      // formerly case 2
 138                      // open in parent window
 139                      $item->link = '<a href="'. $link .'" class="'. $menuclass .'">'. $this->escape($item->title) .'</a>';
 140                      break;
 141              }
 142  
 143              $item->image = $image;
 144  
 145              $item->odd        = $k;
 146              $item->count    = $i;
 147              $k = 1 - $k;
 148          }
 149  
 150          $count = count($categories);
 151          for($i = 0; $i < $count; $i++)
 152          {
 153              $cat =& $categories[$i];
 154              $cat->link = JRoute::_('index.php?option=com_weblinks&view=category&id='. $cat->slug);
 155          }
 156  
 157          $this->assignRef('lists',        $lists);
 158          $this->assignRef('params',        $params);
 159          $this->assignRef('category',    $category);
 160          $this->assignRef('categories', $categories);
 161          $this->assignRef('items',        $items);
 162          $this->assignRef('pagination',    $pagination);
 163  
 164          $this->assign('action',    $uri->toString());
 165  
 166          parent::display($tpl);
 167      }
 168  }


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