Joomla! PHP Cross Reference Web Portals

Source: /administrator/components/com_newsfeeds/views/newsfeeds/view.html.php - 144 lines - 4471 bytes - Summary - Text - Print

   1  <?php
   2  /**
   3   * @package     Joomla.Administrator
   4   * @subpackage  com_newsfeeds
   5   *
   6   * @copyright   Copyright (C) 2005 - 2012 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  class NewsfeedsViewNewsfeeds extends JViewLegacy
  20  {
  21      protected $items;
  22  
  23      protected $pagination;
  24  
  25      protected $state;
  26  
  27      /**
  28       * Display the view
  29       */
  30  	public function display($tpl = null)
  31      {
  32          $this->items        = $this->get('Items');
  33          $this->pagination    = $this->get('Pagination');
  34          $this->state        = $this->get('State');
  35  
  36          NewsfeedsHelper::addSubmenu('newsfeeds');
  37  
  38          // Check for errors.
  39          if (count($errors = $this->get('Errors'))) {
  40              JError::raiseError(500, implode("\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    = NewsfeedsHelper::getActions($state->get('filter.category_id'));
  58          $user    = JFactory::getUser();
  59          // Get the toolbar object instance
  60          $bar = JToolBar::getInstance('toolbar');
  61          JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEEDS'), 'newsfeeds.png');
  62          if (count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
  63              JToolbarHelper::addNew('newsfeed.add');
  64          }
  65          if ($canDo->get('core.edit')) {
  66              JToolbarHelper::editList('newsfeed.edit');
  67          }
  68          if ($canDo->get('core.edit.state')) {
  69              JToolbarHelper::publish('newsfeeds.publish', 'JTOOLBAR_PUBLISH', true);
  70              JToolbarHelper::unpublish('newsfeeds.unpublish', 'JTOOLBAR_UNPUBLISH', true);
  71              JToolbarHelper::archiveList('newsfeeds.archive');
  72          }
  73          if ($canDo->get('core.admin')) {
  74              JToolbarHelper::checkin('newsfeeds.checkin');
  75              }
  76          if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
  77              JToolbarHelper::deleteList('', 'newsfeeds.delete', 'JTOOLBAR_EMPTY_TRASH');
  78          } elseif ($canDo->get('core.edit.state')) {
  79              JToolbarHelper::trash('newsfeeds.trash');
  80          }
  81          // Add a batch button
  82          if ($user->authorise('core.edit'))
  83          {
  84              JHtml::_('bootstrap.modal', 'collapseModal');
  85              $title = JText::_('JTOOLBAR_BATCH');
  86              $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">
  87                          <i class=\"icon-checkbox-partial\" title=\"$title\"></i>
  88                          $title</button>";
  89              $bar->appendButton('Custom', $dhtml, 'batch');
  90          }
  91          if ($canDo->get('core.admin')) {
  92              JToolbarHelper::preferences('com_newsfeeds');
  93          }
  94          JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS');
  95  
  96          JHtmlSidebar::setAction('index.php?option=com_newsfeeds&view=newsfeeds');
  97  
  98          JHtmlSidebar::addFilter(
  99              JText::_('JOPTION_SELECT_PUBLISHED'),
 100              'filter_published',
 101              JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
 102          );
 103  
 104          JHtmlSidebar::addFilter(
 105              JText::_('JOPTION_SELECT_CATEGORY'),
 106              'filter_category_id',
 107              JHtml::_('select.options', JHtml::_('category.options', 'com_newsfeeds'), 'value', 'text', $this->state->get('filter.category_id'))
 108          );
 109  
 110          JHtmlSidebar::addFilter(
 111              JText::_('JOPTION_SELECT_ACCESS'),
 112              'filter_access',
 113              JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
 114          );
 115  
 116          JHtmlSidebar::addFilter(
 117              JText::_('JOPTION_SELECT_LANGUAGE'),
 118              'filter_language',
 119              JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
 120          );
 121      }
 122  
 123      /**
 124       * Returns an array of fields the table can be sorted by
 125       *
 126       * @return  array  Array containing the field name to sort by as the key and display text as value
 127       *
 128       * @since   3.0
 129       */
 130  	protected function getSortFields()
 131      {
 132          return array(
 133              'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
 134              'a.published' => JText::_('JSTATUS'),
 135              'a.name' => JText::_('JGLOBAL_TITLE'),
 136              'category_title' => JText::_('JCATEGORY'),
 137              'a.access' => JText::_('JGRID_HEADING_ACCESS'),
 138              'numarticles' => JText::_('COM_NEWSFEEDS_NUM_ARTICLES_HEADING'),
 139              'a.cache_time' => JText::_('COM_NEWSFEEDS_CACHE_TIME_HEADING'),
 140              'a.language' => JText::_('JGRID_HEADING_LANGUAGE'),
 141              'a.id' => JText::_('JGRID_HEADING_ID')
 142          );
 143      }
 144  }

title

Description

title

Description

title

Description

title

title

Body