/administrator/components/com_finder/views/filters/view.html.php
PHP | 103 lines | 58 code | 12 blank | 33 comment | 5 complexity | 989c7ccf41aa0ff5d626280caaaf3bb3 MD5 | raw file
Possible License(s): LGPL-2.1
1<?php 2/** 3 * @package Joomla.Administrator 4 * @subpackage com_finder 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 8 */ 9 10defined('_JEXEC') or die; 11 12/** 13 * Filters view class for Finder. 14 * 15 * @package Joomla.Administrator 16 * @subpackage com_finder 17 * @since 2.5 18 */ 19class FinderViewFilters extends JViewLegacy 20{ 21 /** 22 * Method to display the view. 23 * 24 * @param string $tpl A template file to load. [optional] 25 * 26 * @return mixed A string if successful, otherwise a JError object. 27 * 28 * @since 2.5 29 */ 30 public function display($tpl = null) 31 { 32 // Load the view data. 33 $this->items = $this->get('Items'); 34 $this->pagination = $this->get('Pagination'); 35 $this->total = $this->get('Total'); 36 $this->state = $this->get('State'); 37 38 FinderHelper::addSubmenu('filters'); 39 40 // Check for errors. 41 if (count($errors = $this->get('Errors'))) 42 { 43 JError::raiseError(500, implode("\n", $errors)); 44 return false; 45 } 46 47 JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); 48 49 // Configure the toolbar. 50 $this->addToolbar(); 51 52 parent::display($tpl); 53 } 54 55 /** 56 * Method to configure the toolbar for this view. 57 * 58 * @return void 59 * 60 * @since 2.5 61 */ 62 protected function addToolbar() 63 { 64 $canDo = FinderHelper::getActions(); 65 66 JToolbarHelper::title(JText::_('COM_FINDER_FILTERS_TOOLBAR_TITLE'), 'finder'); 67 $toolbar = JToolbar::getInstance('toolbar'); 68 69 if ($canDo->get('core.create')) 70 { 71 JToolbarHelper::addNew('filter.add'); 72 JToolbarHelper::editList('filter.edit'); 73 JToolbarHelper::divider(); 74 } 75 if ($canDo->get('core.edit.state')) 76 { 77 JToolbarHelper::publishList('filters.publish'); 78 JToolbarHelper::unpublishList('filters.unpublish'); 79 JToolbarHelper::divider(); 80 } 81 if ($canDo->get('core.delete')) 82 { 83 JToolbarHelper::deleteList('', 'filters.delete'); 84 JToolbarHelper::divider(); 85 } 86 if ($canDo->get('core.admin')) 87 { 88 JToolbarHelper::preferences('com_finder'); 89 } 90 JToolbarHelper::divider(); 91 $toolbar->appendButton('Popup', 'stats', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350); 92 JToolbarHelper::divider(); 93 JToolbarHelper::help('JHELP_COMPONENTS_FINDER_MANAGE_SEARCH_FILTERS'); 94 95 JSubMenuHelper::setAction('index.php?option=com_finder&view=filters'); 96 97 JSubMenuHelper::addFilter( 98 JText::_('COM_FINDER_INDEX_FILTER_BY_STATE'), 99 'filter_state', 100 JHtml::_('select.options', JHtml::_('finder.statelist'), 'value', 'text', $this->state->get('filter.state')) 101 ); 102 } 103}