PageRenderTime 25ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/administrator/components/com_templates/views/templates/view.html.php

https://bitbucket.org/saltwaterdev/offshorefinancial.com
PHP | 109 lines | 47 code | 16 blank | 46 comment | 4 complexity | 66177e077667bf55eb61e496aa5e7667 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, 0BSD, MIT, Apache-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_templates
  5. *
  6. * @copyright Copyright (C) 2005 - 2017 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. * View class for a list of template styles.
  12. *
  13. * @since 1.6
  14. */
  15. class TemplatesViewTemplates extends JViewLegacy
  16. {
  17. /**
  18. * @var array
  19. * @since 1.6
  20. */
  21. protected $items;
  22. /**
  23. * @var object
  24. * @since 1.6
  25. */
  26. protected $pagination;
  27. /**
  28. * @var object
  29. * @since 1.6
  30. */
  31. protected $state;
  32. /**
  33. * @var string
  34. * @since 3.2
  35. */
  36. protected $file;
  37. /**
  38. * Execute and display a template script.
  39. *
  40. * @param string $tpl The name of the template file to parse; automatically searches through the template paths.
  41. *
  42. * @return mixed A string if successful, otherwise an Error object.
  43. *
  44. * @since 1.6
  45. */
  46. public function display($tpl = null)
  47. {
  48. $this->items = $this->get('Items');
  49. $this->pagination = $this->get('Pagination');
  50. $this->state = $this->get('State');
  51. $this->total = $this->get('Total');
  52. $this->filterForm = $this->get('FilterForm');
  53. $this->activeFilters = $this->get('ActiveFilters');
  54. $this->preview = JComponentHelper::getParams('com_templates')->get('template_positions_display');
  55. $this->file = base64_encode('home');
  56. TemplatesHelper::addSubmenu('templates');
  57. // Check for errors.
  58. if (count($errors = $this->get('Errors')))
  59. {
  60. throw new Exception(implode("\n", $errors), 500);
  61. }
  62. $this->addToolbar();
  63. return parent::display($tpl);
  64. }
  65. /**
  66. * Add the page title and toolbar.
  67. *
  68. * @return void
  69. *
  70. * @since 1.6
  71. */
  72. protected function addToolbar()
  73. {
  74. $canDo = JHelperContent::getActions('com_templates');
  75. // Set the title.
  76. if ((int) $this->get('State')->get('client_id') === 1)
  77. {
  78. JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES_ADMIN'), 'eye thememanager');
  79. }
  80. else
  81. {
  82. JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES_SITE'), 'eye thememanager');
  83. }
  84. if ($canDo->get('core.admin') || $canDo->get('core.options'))
  85. {
  86. JToolbarHelper::preferences('com_templates');
  87. JToolbarHelper::divider();
  88. }
  89. JToolbarHelper::help('JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES');
  90. JHtmlSidebar::setAction('index.php?option=com_templates&view=templates');
  91. $this->sidebar = JHtmlSidebar::render();
  92. }
  93. }