- md5
- a40335543492dd34b141598f3a5b082a
- sha1
- f08f9343779320fb03e79ae2b1b84903b4651e1b
- sha256
- 178908f23dd19fcd1c7fd4d1bec2ec35c6735a8aeec0b9cf562d47712b038ec8
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View class for a list of banners.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class BannersViewBanners extends JViewLegacy
{
protected $categories;
protected $items;
protected $pagination;
protected $state;
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 1.6
*/
public function display($tpl = null)
{
// Initialise variables.
$this->categories = $this->get('CategoryOrders');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
require_once JPATH_COMPONENT . '/models/fields/bannerclient.php';
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/banners.php';
$canDo = BannersHelper::getActions($this->state->get('filter.category_id'));
$user = JFactory::getUser();
JToolBarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'banners.png');
if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)
{
JToolBarHelper::addNew('banner.add');
}
if (($canDo->get('core.edit')))
{
JToolBarHelper::editList('banner.edit');
}
if ($canDo->get('core.edit.state'))
{
if ($this->state->get('filter.state') != 2)
{
JToolBarHelper::divider();
JToolBarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if ($this->state->get('filter.state') != -1)
{
JToolBarHelper::divider();
if ($this->state->get('filter.state') != 2)
{
JToolBarHelper::archiveList('banners.archive');
}
elseif ($this->state->get('filter.state') == 2)
{
JToolBarHelper::unarchiveList('banners.publish');
}
}
}
if ($canDo->get('core.edit.state'))
{
JToolBarHelper::checkin('banners.checkin');
}
if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete'))
{
JToolBarHelper::deleteList('', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
}
elseif ($canDo->get('core.edit.state'))
{
JToolBarHelper::trash('banners.trash');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin'))
{
JToolBarHelper::preferences('com_banners');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS');
}
}
The same content is in 11 releases, Joomla 2.5.18 to 2.5.28. See them all, or every version of this file.