PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 88 lines | 35 code | 13 blank | 40 comment | 4 complexity | 2ae209e7c5e182ffd43f9e6206fe01ca MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: view.html.php 278 2010-09-14 11:11:09Z 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. * ArtoPdf view.
  15. *
  16. * @package NewLifeInIT
  17. * @subpackage com_artofpdf
  18. * @since 1.0
  19. */
  20. class ArtofPdfViewPdf extends JView
  21. {
  22. /**
  23. * @var JObject The data for the record being displayed.
  24. * @since 1.0
  25. */
  26. protected $item;
  27. /**
  28. * @var JObject The model state.
  29. * @since 1.0
  30. */
  31. protected $state;
  32. /**
  33. * Prepare and display the Pdf view.
  34. *
  35. * @return void
  36. * @since 1.0
  37. */
  38. public function display()
  39. {
  40. // Intialiase variables.
  41. $this->item = $this->get('Item');
  42. $this->state = $this->get('State');
  43. // Check for errors.
  44. if (count($errors = $this->get('Errors'))) {
  45. JError::raiseError(500, implode("\n", $errors));
  46. return false;
  47. }
  48. $this->addToolbar();
  49. parent::display();
  50. }
  51. /**
  52. * Add the page title and toolbar.
  53. *
  54. * @return void
  55. * @since 1.0
  56. */
  57. protected function addToolbar()
  58. {
  59. JRequest::setVar('hidemainmenu', true);
  60. $isNew = ($this->item->id == 0);
  61. JToolBarHelper::title(JText::_($isNew ? 'COM_ARTOPDF_ADD_PDF_TITLE' : 'COM_ARTOPDF_EDIT_PDF_TITLE'), 'logo');
  62. // If not checked out, can save the item.
  63. JToolBarHelper::apply('pdf.apply', 'JTOOLBAR_APPLY');
  64. JToolBarHelper::save('pdf.save', 'JTOOLBAR_SAVE');
  65. JToolBarHelper::custom('pdf.save2new', 'new', null, 'JTOOLBAR_SAVE_AND_NEW', false);
  66. // If an existing item, can save to a copy.
  67. JToolBarHelper::custom('pdf.save2copy', 'copy', null, 'JTOOLBAR_SAVE_AS_COPY', false);
  68. if ($isNew) {
  69. JToolBarHelper::cancel('pdf.cancel', 'JTOOLBAR_CLOSE');
  70. }
  71. else {
  72. JToolBarHelper::cancel('pdf.cancel', 'JTOOLBAR_CANCEL');
  73. }
  74. }
  75. }