| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 4 * @license GNU General Public License version 2 or later; see LICENSE.txt 5 */ 6 7 // No direct access 8 defined('_JEXEC') or die; 9 10 jimport('joomla.application.component.view'); 11 12 /** 13 * Categories view class for the Category package. 14 * 15 * @package Joomla.Administrator 16 * @subpackage com_categories 17 * @since 1.6 18 */ 19 class CategoriesViewCategories extends JView 20 { 21 protected $items; 22 protected $pagination; 23 protected $state; 24 25 /** 26 * Display the view 27 */ 28 public function display($tpl = null) 29 { 30 $this->state = $this->get('State'); 31 $this->items = $this->get('Items'); 32 $this->pagination = $this->get('Pagination'); 33 34 // Check for errors. 35 if (count($errors = $this->get('Errors'))) { 36 JError::raiseError(500, implode("\n", $errors)); 37 return false; 38 } 39 40 // Preprocess the list of items to find ordering divisions. 41 foreach ($this->items as &$item) { 42 $this->ordering[$item->parent_id][] = $item->id; 43 } 44 45 // Levels filter. 46 $options = array(); 47 $options[] = JHtml::_('select.option', '1', JText::_('J1')); 48 $options[] = JHtml::_('select.option', '2', JText::_('J2')); 49 $options[] = JHtml::_('select.option', '3', JText::_('J3')); 50 $options[] = JHtml::_('select.option', '4', JText::_('J4')); 51 $options[] = JHtml::_('select.option', '5', JText::_('J5')); 52 $options[] = JHtml::_('select.option', '6', JText::_('J6')); 53 $options[] = JHtml::_('select.option', '7', JText::_('J7')); 54 $options[] = JHtml::_('select.option', '8', JText::_('J8')); 55 $options[] = JHtml::_('select.option', '9', JText::_('J9')); 56 $options[] = JHtml::_('select.option', '10', JText::_('J10')); 57 58 $this->assign('f_levels', $options); 59 60 $this->addToolbar(); 61 parent::display($tpl); 62 } 63 64 /** 65 * Add the page title and toolbar. 66 * 67 * @since 1.6 68 */ 69 protected function addToolbar() 70 { 71 // Initialise variables. 72 $categoryId = $this->state->get('filter.category_id'); 73 $component = $this->state->get('filter.component'); 74 $section = $this->state->get('filter.section'); 75 $canDo = null; 76 $user = JFactory::getUser(); 77 78 // Avoid nonsense situation. 79 if ($component == 'com_categories') { 80 return; 81 } 82 83 // Need to load the menu language file as mod_menu hasn't been loaded yet. 84 $lang = JFactory::getLanguage(); 85 $lang->load($component, JPATH_BASE, null, false, false) 86 || $lang->load($component, JPATH_ADMINISTRATOR.'/components/'.$component, null, false, false) 87 || $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false) 88 || $lang->load($component, JPATH_ADMINISTRATOR.'/components/'.$component, $lang->getDefault(), false, false); 89 90 // Load the category helper. 91 require_once JPATH_COMPONENT.'/helpers/categories.php'; 92 93 // Get the results for each action. 94 $canDo = CategoriesHelper::getActions($component, $categoryId); 95 96 // If a component categories title string is present, let's use it. 97 if ($lang->hasKey($component_title_key = strtoupper($component.($section?"_$section":'')).'_CATEGORIES_TITLE')) { 98 $title = JText::_($component_title_key); 99 } 100 // Else if the component section string exits, let's use it 101 elseif ($lang->hasKey($component_section_key = strtoupper($component.($section?"_$section":'')))) { 102 $title = JText::sprintf( 'COM_CATEGORIES_CATEGORIES_TITLE', $this->escape(JText::_($component_section_key))); 103 } 104 // Else use the base title 105 else { 106 $title = JText::_('COM_CATEGORIES_CATEGORIES_BASE_TITLE'); 107 } 108 109 // Load specific css component 110 JHtml::_('stylesheet', $component.'/administrator/categories.css', array(), true); 111 112 // Prepare the toolbar. 113 JToolBarHelper::title($title, 'categories '.substr($component, 4).($section?"-$section":'').'-categories'); 114 115 if ($canDo->get('core.create') || (count($user->getAuthorisedCategories($component, 'core.create'))) > 0 ) { 116 JToolBarHelper::addNew('category.add'); 117 } 118 119 if ($canDo->get('core.edit' ) || $canDo->get('core.edit.own')) { 120 JToolBarHelper::editList('category.edit'); 121 JToolBarHelper::divider(); 122 } 123 124 if ($canDo->get('core.edit.state')) { 125 JToolBarHelper::publish('categories.publish', 'JTOOLBAR_PUBLISH', true); 126 JToolBarHelper::unpublish('categories.unpublish', 'JTOOLBAR_UNPUBLISH', true); 127 JToolBarHelper::divider(); 128 JToolBarHelper::archiveList('categories.archive'); 129 } 130 131 if (JFactory::getUser()->authorise('core.admin')) { 132 JToolBarHelper::checkin('categories.checkin'); 133 } 134 135 if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete', $component)) { 136 JToolBarHelper::deleteList('', 'categories.delete', 'JTOOLBAR_EMPTY_TRASH'); 137 } 138 elseif ($canDo->get('core.edit.state')) { 139 JToolBarHelper::trash('categories.trash'); 140 JToolBarHelper::divider(); 141 } 142 143 if ($canDo->get('core.admin')) { 144 JToolBarHelper::custom('categories.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false); 145 JToolBarHelper::preferences($component); 146 JToolBarHelper::divider(); 147 } 148 149 // Compute the ref_key if it does exist in the component 150 if (!$lang->hasKey($ref_key = strtoupper($component.($section?"_$section":'')).'_CATEGORIES_HELP_KEY')) { 151 $ref_key = 'JHELP_COMPONENTS_'.strtoupper(substr($component, 4).($section?"_$section":'')).'_CATEGORIES'; 152 } 153 154 // Get help for the categories view for the component by 155 // -remotely searching in a language defined dedicated URL: *component*_HELP_URL 156 // -locally searching in a component help file if helpURL param exists in the component and is set to '' 157 // -remotely searching in a component URL if helpURL param exists in the component and is NOT set to '' 158 if ($lang->hasKey($lang_help_url = strtoupper($component).'_HELP_URL')) { 159 $debug = $lang->setDebug(false); 160 $url = JText::_($lang_help_url); 161 $lang->setDebug($debug); 162 } 163 else { 164 $url = null; 165 } 166 JToolBarHelper::help($ref_key, JComponentHelper::getParams( $component )->exists('helpURL'), $url); 167 } 168 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Apr 3 11:40:28 2012 | Cross-referenced by PHPXref 0.7.1 |