PageRenderTime 33ms CodeModel.GetById 23ms app.highlight 4ms RepoModel.GetById 3ms app.codeStats 1ms

/administrator/components/com_cache/views/cache/view.html.php

https://bitbucket.org/eternaware/joomus
PHP | 71 lines | 41 code | 9 blank | 21 comment | 3 complexity | 7f10911c42e5bdd4657539185863cf22 MD5 | raw file
Possible License(s): LGPL-2.1
 1<?php
 2/**
 3 * @package     Joomla.Administrator
 4 * @subpackage  com_cache
 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.txt
 8 */
 9
10defined('_JEXEC') or die;
11
12/**
13 * HTML View class for the Cache component
14 *
15 * @package     Joomla.Administrator
16 * @subpackage  com_cache
17 * @since       1.6
18 */
19class CacheViewCache extends JViewLegacy
20{
21	protected $client;
22	protected $data;
23	protected $pagination;
24	protected $state;
25
26	public function display($tpl = null)
27	{
28		$this->data			= $this->get('Data');
29		$this->client		= $this->get('Client');
30		$this->pagination	= $this->get('Pagination');
31		$this->state		= $this->get('State');
32
33		// Check for errors.
34		if (count($errors = $this->get('Errors'))) {
35			JError::raiseError(500, implode("\n", $errors));
36			return false;
37		}
38
39		$this->addToolbar();
40		parent::display($tpl);
41	}
42
43	/**
44	 * Add the page title and toolbar.
45	 *
46	 * @since	1.6
47	 */
48	protected function addToolbar()
49	{
50		$user = JFactory::getUser();
51		$condition = ($this->client->name == 'site');
52
53		JToolbarHelper::title(JText::_('COM_CACHE_CLEAR_CACHE'), 'clear.png');
54		JToolbarHelper::custom('delete', 'delete.png', 'delete_f2.png', 'JTOOLBAR_DELETE', true);
55		JToolbarHelper::divider();
56		if (JFactory::getUser()->authorise('core.admin', 'com_cache')) {
57			JToolbarHelper::preferences('com_cache');
58		}
59		JToolbarHelper::divider();
60		JToolbarHelper::help('JHELP_SITE_MAINTENANCE_CLEAR_CACHE');
61
62		JSubMenuHelper::setAction('index.php?option=com_cache');
63
64		JSubMenuHelper::addFilter(
65			// @todo We need an actual label here
66			'',
67			'filter_client_id',
68			JHtml::_('select.options', CacheHelper::getClientOptions(), 'value', 'text', $this->state->get('clientId'))
69		);
70	}
71}