Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_languages
  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 Languages View class for the Languages component
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_languages
  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.         LanguagesHelper::addSubmenu('languages');
  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.         require_once JPATH_COMPONENT.'/helpers/languages.php';
  57.         $canDo    LanguagesHelper::getActions();
  58.  
  59.         JToolbarHelper::title(JText::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE')'comments-2 langmanager');
  60.  
  61.         if ($canDo->get('core.create'))
  62.         {
  63.             JToolbarHelper::addNew('language.add');
  64.         }
  65.  
  66.         if ($canDo->get('core.edit'))
  67.         {
  68.             JToolbarHelper::editList('language.edit');
  69.             JToolbarHelper::divider();
  70.         }
  71.  
  72.         if ($canDo->get('core.edit.state'))
  73.         {
  74.             if ($this->state->get('filter.published'!= 2)
  75.             {
  76.                 JToolbarHelper::publishList('languages.publish');
  77.                 JToolbarHelper::unpublishList('languages.unpublish');
  78.             }
  79.         }
  80.  
  81.         if ($this->state->get('filter.published'== -&& $canDo->get('core.delete'))
  82.         {
  83.             JToolbarHelper::deleteList('''languages.delete''JTOOLBAR_EMPTY_TRASH');
  84.             JToolbarHelper::divider();
  85.         elseif ($canDo->get('core.edit.state'))
  86.         {
  87.             JToolbarHelper::trash('languages.trash');
  88.             JToolbarHelper::divider();
  89.         }
  90.  
  91.         if ($canDo->get('core.admin'))
  92.         {
  93.             // Add install languages link to the lang installer component
  94.             $bar JToolbar::getInstance('toolbar');
  95.             $bar->appendButton('Link''upload''COM_LANGUAGES_INSTALL''index.php?option=com_installer&view=languages');
  96.             JToolbarHelper::divider();
  97.  
  98.             JToolbarHelper::preferences('com_languages');
  99.             JToolbarHelper::divider();
  100.         }
  101.  
  102.         JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_CONTENT');
  103.  
  104.         JHtmlSidebar::setAction('index.php?option=com_languages&view=languages');
  105.  
  106.         JHtmlSidebar::addFilter(
  107.             JText::_('JOPTION_SELECT_PUBLISHED'),
  108.             'filter_published',
  109.             JHtml::_('select.options'JHtml::_('jgrid.publishedOptions')'value''text'$this->state->get('filter.published')true)
  110.         );
  111.  
  112.         JHtmlSidebar::addFilter(
  113.             JText::_('JOPTION_SELECT_ACCESS'),
  114.             'filter_access',
  115.             JHtml::_('select.options'JHtml::_('access.assetgroups')'value''text'$this->state->get('filter.access'))
  116.         );
  117.     }
  118.  
  119.     /**
  120.      * Returns an array of fields the table can be sorted by
  121.      *
  122.      * @return  array  Array containing the field name to sort by as the key and display text as value
  123.      *
  124.      * @since   3.0
  125.      */
  126.     protected function getSortFields()
  127.     {
  128.         return array(
  129.                 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
  130.                 'a.published' => JText::_('JSTATUS'),
  131.                 'a.title' => JText::_('JGLOBAL_TITLE'),
  132.                 'a.title_native' => JText::_('COM_LANGUAGES_HEADING_TITLE_NATIVE'),
  133.                 'a.lang_code' => JText::_('COM_LANGUAGES_FIELD_LANG_TAG_LABEL'),
  134.                 'a.sef' => JText::_('COM_LANGUAGES_FIELD_LANG_CODE_LABEL'),
  135.                 'a.image' => JText::_('COM_LANGUAGES_HEADING_LANG_IMAGE'),
  136.                 'a.access' => JText::_('JGRID_HEADING_ACCESS'),
  137.                 'a.lang_id' => JText::_('JGRID_HEADING_ID')
  138.         );
  139.     }
  140. }

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