joomla_test/administrator/components/com_menus/views/menus/view.html.php

90 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2020-01-02 22:20:31 +07:00
<?php
/**
* @package Joomla.Administrator
* @subpackage com_menus
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* The HTML Menus Menu Menus View.
*
* @package Joomla.Administrator
* @subpackage com_menus
* @since 1.6
*/
class MenusViewMenus extends JViewLegacy
{
protected $items;
protected $modules;
protected $pagination;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->modules = $this->get('Modules');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
MenusHelper::addSubmenu('menus');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT.'/helpers/menus.php';
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
JToolbarHelper::title(JText::_('COM_MENUS_VIEW_MENUS_TITLE'), 'menumgr.png');
if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('menu.add');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('menu.edit');
}
if ($canDo->get('core.delete'))
{
JToolbarHelper::divider();
JToolbarHelper::deleteList('', 'menus.delete');
}
JToolbarHelper::custom('menus.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false);
if ($canDo->get('core.admin'))
{
JToolbarHelper::divider();
JToolbarHelper::preferences('com_menus');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER');
}
}