Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  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.  * View class for a list of featured articles.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_content
  17.  * @since       1.6
  18.  */
  19. {
  20.     protected $items;
  21.  
  22.     protected $pagination;
  23.  
  24.     protected $state;
  25.  
  26.     /**
  27.      * Display the view
  28.      *
  29.      * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  30.      *
  31.      * @return  void 
  32.      */
  33.     public function display($tpl null)
  34.     {
  35.         ContentHelper::addSubmenu('featured');
  36.  
  37.         $this->items         = $this->get('Items');
  38.         $this->pagination    = $this->get('Pagination');
  39.         $this->state         = $this->get('State');
  40.         $this->authors       $this->get('Authors');
  41.         $this->filterForm    $this->get('FilterForm');
  42.         $this->activeFilters $this->get('ActiveFilters');
  43.  
  44.         // Check for errors.
  45.         if (count($errors $this->get('Errors')))
  46.         {
  47.             JError::raiseError(500implode("\n"$errors));
  48.  
  49.             return false;
  50.         }
  51.  
  52.         // Levels filter.
  53.         $options    array();
  54.         $options[]    JHtml::_('select.option''1'JText::_('J1'));
  55.         $options[]    JHtml::_('select.option''2'JText::_('J2'));
  56.         $options[]    JHtml::_('select.option''3'JText::_('J3'));
  57.         $options[]    JHtml::_('select.option''4'JText::_('J4'));
  58.         $options[]    JHtml::_('select.option''5'JText::_('J5'));
  59.         $options[]    JHtml::_('select.option''6'JText::_('J6'));
  60.         $options[]    JHtml::_('select.option''7'JText::_('J7'));
  61.         $options[]    JHtml::_('select.option''8'JText::_('J8'));
  62.         $options[]    JHtml::_('select.option''9'JText::_('J9'));
  63.         $options[]    JHtml::_('select.option''10'JText::_('J10'));
  64.  
  65.         $this->f_levels $options;
  66.  
  67.         $this->addToolbar();
  68.         $this->sidebar JHtmlSidebar::render();
  69.         parent::display($tpl);
  70.     }
  71.  
  72.     /**
  73.      * Add the page title and toolbar.
  74.      *
  75.      * @return  void 
  76.      *
  77.      * @since   1.6
  78.      */
  79.     protected function addToolbar()
  80.     {
  81.         $state    $this->get('State');
  82.         $canDo    JHelperContent::getActions($this->state->get('filter.category_id')0'com_content');
  83.  
  84.         JToolbarHelper::title(JText::_('COM_CONTENT_FEATURED_TITLE')'star featured');
  85.  
  86.         if ($canDo->get('core.create'))
  87.         {
  88.             JToolbarHelper::addNew('article.add');
  89.         }
  90.         if ($canDo->get('core.edit'))
  91.         {
  92.             JToolbarHelper::editList('article.edit');
  93.         }
  94.  
  95.         if ($canDo->get('core.edit.state'))
  96.         {
  97.             JToolbarHelper::publish('articles.publish''JTOOLBAR_PUBLISH'true);
  98.             JToolbarHelper::unpublish('articles.unpublish''JTOOLBAR_UNPUBLISH'true);
  99.             JToolbarHelper::custom('featured.delete''remove.png''remove_f2.png''JTOOLBAR_REMOVE'true);
  100.             JToolbarHelper::archiveList('articles.archive');
  101.             JToolbarHelper::checkin('articles.checkin');
  102.         }
  103.  
  104.         if ($state->get('filter.published'== -&& $canDo->get('core.delete'))
  105.         {
  106.             JToolbarHelper::deleteList('''articles.delete''JTOOLBAR_EMPTY_TRASH');
  107.         }
  108.         elseif ($canDo->get('core.edit.state'))
  109.         {
  110.             JToolbarHelper::trash('articles.trash');
  111.         }
  112.  
  113.         if ($canDo->get('core.admin'))
  114.         {
  115.             JToolbarHelper::preferences('com_content');
  116.         }
  117.  
  118.         JToolbarHelper::help('JHELP_CONTENT_FEATURED_ARTICLES');
  119.     }
  120.  
  121.     /**
  122.      * Returns an array of fields the table can be sorted by
  123.      *
  124.      * @return  array  Array containing the field name to sort by as the key and display text as value
  125.      *
  126.      * @since   3.0
  127.      */
  128.     protected function getSortFields()
  129.     {
  130.         return array(
  131.             'fp.ordering' => JText::_('JGRID_HEADING_ORDERING'),
  132.             'a.state' => JText::_('JSTATUS'),
  133.             'a.title' => JText::_('JGLOBAL_TITLE'),
  134.             'category_title' => JText::_('JCATEGORY'),
  135.             'access_level' => JText::_('JGRID_HEADING_ACCESS'),
  136.             'a.created_by' => JText::_('JAUTHOR'),
  137.             'language' => JText::_('JGRID_HEADING_LANGUAGE'),
  138.             'a.created' => JText::_('JDATE'),
  139.             'a.id' => JText::_('JGRID_HEADING_ID')
  140.         );
  141.     }
  142. }

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