/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

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