PageRenderTime 38ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/contentmanager/code/trunk/administrator/components/com_contentmanager/views/templates/view.html.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 78 lines | 48 code | 9 blank | 21 comment | 4 complexity | b9823143dde8903c0d91d5d96ef2b4b2 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: view.html.php 154 2009-07-01 05:48:13Z eddieajau $
  4. * @copyright Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
  5. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  6. * @link http://www.theartofjoomla.com
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. jimport('joomla.application.component.view');
  11. /**
  12. * @package TAOJ.ContentManager
  13. * @subpackage com_contentmanager
  14. */
  15. class ContentManagerViewTemplates extends JView
  16. {
  17. protected $state;
  18. protected $items;
  19. protected $pagination;
  20. protected $f_published;
  21. /**
  22. * Display the view
  23. */
  24. public function display($tpl = null)
  25. {
  26. $state = $this->get('State');
  27. $items = $this->get('Items');
  28. $pagination = $this->get('Pagination');
  29. // Check for errors.
  30. if (count($errors = $this->get('Errors'))) {
  31. JError::raiseError(500, implode("\n", $errors));
  32. return false;
  33. }
  34. $this->assignRef('state', $state);
  35. $this->assignRef('items', $items);
  36. $this->assignRef('pagination', $pagination);
  37. // Published filter
  38. $options = array();
  39. $options[] = JHtml::_('select.option', '*', 'Any');
  40. $options[] = JHtml::_('select.option', '1', 'Published');
  41. $options[] = JHtml::_('select.option', '0', 'Unpublished');
  42. $options[] = JHtml::_('select.option', '-2', 'Trash');
  43. $this->assign('f_published', $options);
  44. $this->_setToolbar();
  45. parent::display($tpl);
  46. }
  47. /**
  48. * Display the toolbar
  49. *
  50. * @access private
  51. */
  52. protected function _setToolbar()
  53. {
  54. $state = $this->get('State');
  55. JToolBarHelper::title(JText::_('ContMan_Page_Editor_Templates'), 'logo');
  56. JToolBarHelper::custom('templates.publish', 'publish.png', 'publish_f2.png', 'Publish', true);
  57. JToolBarHelper::custom('templates.unpublish', 'unpublish.png', 'unpublish_f2.png', 'Unpublish', true);
  58. if ($state->get('filter.published') == -2) {
  59. JToolBarHelper::deleteList('', 'templates.delete');
  60. }
  61. else {
  62. JToolBarHelper::trash('templates.trash');
  63. }
  64. JToolBarHelper::custom('template.edit', 'edit.png', 'edit_f2.png', 'Edit', true);
  65. JToolBarHelper::custom('template.edit', 'new.png', 'new_f2.png', 'New', false);
  66. JToolBarHelper::divider();
  67. JToolBarHelper::preferences('com_contentmanager', 400, 600, 'ContMan_Toolbar_options');
  68. }
  69. }