PageRenderTime 36ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/pdf/code/trunk/administrator/components/com_artofpdf/views/pdfs/view.html.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 106 lines | 42 code | 19 blank | 45 comment | 4 complexity | fc64525e46cd61793f10a7ef2139fe76 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: view.html.php 289 2010-09-28 01:51:29Z eddieajau $
  4. * @package NewLifeInIT
  5. * @subpackage com_artofpdf
  6. * @copyright Copyright 2010 New Life in IT Pty Ltd. All rights reserved.
  7. * @license GNU General Public License version 2 or later.
  8. * @link http://www.theartofjoomla.com
  9. */
  10. // No direct access
  11. defined('_JEXEC') or die;
  12. jimport('joomla.application.component.view');
  13. /**
  14. * ArtofPdf view.
  15. *
  16. * @package NewLifeInIT
  17. * @subpackage com_artofpdf
  18. * @since 1.0
  19. */
  20. class ArtofPdfViewPdfs extends JView
  21. {
  22. /**
  23. * @var array The array of records to display in the list.
  24. * @since 1.0
  25. */
  26. protected $items;
  27. /**
  28. * @var JPagination The pagination object for the list.
  29. * @since 1.0
  30. */
  31. protected $pagination;
  32. /**
  33. * @var JObject The model state.
  34. * @since 1.0
  35. */
  36. protected $state;
  37. /**
  38. * Prepare and display the Pdfs view.
  39. *
  40. * @return void
  41. * @since 1.0
  42. */
  43. public function display()
  44. {
  45. ArtofPdfHelper::addSubmenu($this->getName());
  46. // Initialise variables.
  47. $this->items = $this->get('Items');
  48. $this->pagination = $this->get('Pagination');
  49. $this->state = $this->get('State');
  50. // Check for errors.
  51. if (count($errors = $this->get('Errors'))) {
  52. JError::raiseError(500, implode("\n", $errors));
  53. return false;
  54. }
  55. // Add the toolbar and display the view layout.
  56. $this->addToolbar();
  57. parent::display();
  58. }
  59. /**
  60. * Add the page title and toolbar.
  61. *
  62. * @return void
  63. * @since 1.0
  64. */
  65. protected function addToolbar()
  66. {
  67. // Initialise variables.
  68. $state = $this->get('State');
  69. JToolBarHelper::title(JText::_('COM_ARTOFPDF_PDFS_TITLE'), 'logo');
  70. JToolBarHelper::custom('pdf.make', 'pdf', null, 'COM_ARTOFPDF_TOOLBAR_PDF', true);
  71. JToolBarHelper::addNew('pdf.add', 'JTOOLBAR_NEW');
  72. JToolBarHelper::editList('pdf.edit', 'JTOOLBAR_EDIT');
  73. JToolBarHelper::custom('pdfs.duplicate', 'copy', null, 'JTOOLBAR_COPY', true);
  74. JToolBarHelper::publishList('pdfs.publish', 'JTOOLBAR_PUBLISH');
  75. JToolBarHelper::unpublishList('pdfs.unpublish', 'JTOOLBAR_UNPUBLISH');
  76. if ($state->get('filter.state') == -2) {
  77. JToolBarHelper::deleteList('', 'pdfs.delete','JTOOLBAR_EMPTY_TRASH');
  78. }
  79. else {
  80. JToolBarHelper::trash('pdfs.trash','JTOOLBAR_TRASH');
  81. }
  82. JToolBarHelper::preferences('com_artofpdf');
  83. // We can't use the toolbar helper here because there is no generic popup button.
  84. JToolBar::getInstance('toolbar')
  85. ->appendButton('Popup', 'help', 'COM_ARTOFPDF_ABOUT', 'index.php?option=com_artofpdf&view=about&tmpl=component');
  86. }
  87. }