Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_newsfeeds
  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 newsfeeds.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_newsfeeds
  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.     public function display($tpl null)
  30.     {
  31.         $this->items        = $this->get('Items');
  32.         $this->pagination    = $this->get('Pagination');
  33.         $this->state        = $this->get('State');
  34.  
  35.         NewsfeedsHelper::addSubmenu('newsfeeds');
  36.  
  37.         // Check for errors.
  38.         if (count($errors $this->get('Errors')))
  39.         {
  40.             JError::raiseError(500implode("\n"$errors));
  41.             return false;
  42.         }
  43.  
  44.         $this->addToolbar();
  45.         $this->sidebar JHtmlSidebar::render();
  46.         parent::display($tpl);
  47.     }
  48.  
  49.     /**
  50.      * Add the page title and toolbar.
  51.      *
  52.      * @since   1.6
  53.      */
  54.     protected function addToolbar()
  55.     {
  56.         $state    $this->get('State');
  57.         $canDo    JHelperContent::getActions($state->get('filter.category_id')0'com_newsfeeds');
  58.         $user    JFactory::getUser();
  59.  
  60.         // Get the toolbar object instance
  61.         $bar JToolBar::getInstance('toolbar');
  62.         JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS')'feed newsfeeds');
  63.  
  64.         if (count($user->getAuthorisedCategories('com_newsfeeds''core.create')) 0)
  65.         {
  66.             JToolbarHelper::addNew('newsfeed.add');
  67.         }
  68.         if ($canDo->get('core.edit'))
  69.         {
  70.             JToolbarHelper::editList('newsfeed.edit');
  71.         }
  72.         if ($canDo->get('core.edit.state'))
  73.         {
  74.             JToolbarHelper::publish('newsfeeds.publish''JTOOLBAR_PUBLISH'true);
  75.             JToolbarHelper::unpublish('newsfeeds.unpublish''JTOOLBAR_UNPUBLISH'true);
  76.             JToolbarHelper::archiveList('newsfeeds.archive');
  77.         }
  78.         if ($canDo->get('core.admin'))
  79.         {
  80.             JToolbarHelper::checkin('newsfeeds.checkin');
  81.             }
  82.         if ($state->get('filter.published'== -&& $canDo->get('core.delete'))
  83.         {
  84.             JToolbarHelper::deleteList('''newsfeeds.delete''JTOOLBAR_EMPTY_TRASH');
  85.         elseif ($canDo->get('core.edit.state'))
  86.         {
  87.             JToolbarHelper::trash('newsfeeds.trash');
  88.         }
  89.         // Add a batch button
  90.         if ($user->authorise('core.create''com_newsfeeds'&& $user->authorise('core.edit''com_newsfeeds'&& $user->authorise('core.edit.state''com_newsfeeds'))
  91.         {
  92.             JHtml::_('bootstrap.modal''collapseModal');
  93.             $title JText::_('JTOOLBAR_BATCH');
  94.  
  95.             // Instantiate a new JLayoutFile instance and render the batch button
  96.             $layout new JLayoutFile('joomla.toolbar.batch');
  97.  
  98.             $dhtml $layout->render(array('title' => $title));
  99.             $bar->appendButton('Custom'$dhtml'batch');
  100.         }
  101.         if ($canDo->get('core.admin'))
  102.         {
  103.             JToolbarHelper::preferences('com_newsfeeds');
  104.         }
  105.         JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
  106.  
  107.         JHtmlSidebar::setAction('index.php?option=com_newsfeeds&view=newsfeeds');
  108.  
  109.         JHtmlSidebar::addFilter(
  110.             JText::_('JOPTION_SELECT_PUBLISHED'),
  111.             'filter_published',
  112.             JHtml::_('select.options'JHtml::_('jgrid.publishedOptions')'value''text'$this->state->get('filter.published')true)
  113.         );
  114.  
  115.         JHtmlSidebar::addFilter(
  116.             JText::_('JOPTION_SELECT_CATEGORY'),
  117.             'filter_category_id',
  118.             JHtml::_('select.options'JHtml::_('category.options''com_newsfeeds')'value''text'$this->state->get('filter.category_id'))
  119.         );
  120.  
  121.         JHtmlSidebar::addFilter(
  122.             JText::_('JOPTION_SELECT_ACCESS'),
  123.             'filter_access',
  124.             JHtml::_('select.options'JHtml::_('access.assetgroups')'value''text'$this->state->get('filter.access'))
  125.         );
  126.  
  127.         JHtmlSidebar::addFilter(
  128.             JText::_('JOPTION_SELECT_LANGUAGE'),
  129.             'filter_language',
  130.             JHtml::_('select.options'JHtml::_('contentlanguage.existing'truetrue)'value''text'$this->state->get('filter.language'))
  131.         );
  132.  
  133.         JHtmlSidebar::addFilter(
  134.         JText::_('JOPTION_SELECT_TAG'),
  135.         'filter_tag',
  136.         JHtml::_('select.options'JHtml::_('tag.options'truetrue)'value''text'$this->state->get('filter.tag'))
  137.         );
  138.     }
  139.  
  140.     /**
  141.      * Returns an array of fields the table can be sorted by
  142.      *
  143.      * @return  array  Array containing the field name to sort by as the key and display text as value
  144.      *
  145.      * @since   3.0
  146.      */
  147.     protected function getSortFields()
  148.     {
  149.         return array(
  150.             'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
  151.             'a.published' => JText::_('JSTATUS'),
  152.             'a.name' => JText::_('JGLOBAL_TITLE'),
  153.             'category_title' => JText::_('JCATEGORY'),
  154.             'a.access' => JText::_('JGRID_HEADING_ACCESS'),
  155.             'numarticles' => JText::_('COM_NEWSFEEDS_NUM_ARTICLES_HEADING'),
  156.             'a.cache_time' => JText::_('COM_NEWSFEEDS_CACHE_TIME_HEADING'),
  157.             'a.language' => JText::_('JGRID_HEADING_LANGUAGE'),
  158.             'a.id' => JText::_('JGRID_HEADING_ID')
  159.         );
  160.     }
  161. }

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