/pdf/code/trunk/administrator/components/com_artofpdf/views/pdf/view.html.php
PHP | 88 lines | 35 code | 13 blank | 40 comment | 4 complexity | 2ae209e7c5e182ffd43f9e6206fe01ca MD5 | raw file
- <?php
- /**
- * @version $Id: view.html.php 278 2010-09-14 11:11:09Z eddieajau $
- * @package NewLifeInIT
- * @subpackage com_artofpdf
- * @copyright Copyright 2010 New Life in IT Pty Ltd. All rights reserved.
- * @license GNU General Public License version 2 or later.
- * @link http://www.theartofjoomla.com
- */
- // No direct access
- defined('_JEXEC') or die;
- jimport('joomla.application.component.view');
- /**
- * ArtoPdf view.
- *
- * @package NewLifeInIT
- * @subpackage com_artofpdf
- * @since 1.0
- */
- class ArtofPdfViewPdf extends JView
- {
- /**
- * @var JObject The data for the record being displayed.
- * @since 1.0
- */
- protected $item;
- /**
- * @var JObject The model state.
- * @since 1.0
- */
- protected $state;
- /**
- * Prepare and display the Pdf view.
- *
- * @return void
- * @since 1.0
- */
- public function display()
- {
- // Intialiase variables.
- $this->item = $this->get('Item');
- $this->state = $this->get('State');
- // Check for errors.
- if (count($errors = $this->get('Errors'))) {
- JError::raiseError(500, implode("\n", $errors));
- return false;
- }
- $this->addToolbar();
- parent::display();
- }
- /**
- * Add the page title and toolbar.
- *
- * @return void
- * @since 1.0
- */
- protected function addToolbar()
- {
- JRequest::setVar('hidemainmenu', true);
- $isNew = ($this->item->id == 0);
- JToolBarHelper::title(JText::_($isNew ? 'COM_ARTOPDF_ADD_PDF_TITLE' : 'COM_ARTOPDF_EDIT_PDF_TITLE'), 'logo');
- // If not checked out, can save the item.
- JToolBarHelper::apply('pdf.apply', 'JTOOLBAR_APPLY');
- JToolBarHelper::save('pdf.save', 'JTOOLBAR_SAVE');
- JToolBarHelper::custom('pdf.save2new', 'new', null, 'JTOOLBAR_SAVE_AND_NEW', false);
- // If an existing item, can save to a copy.
- JToolBarHelper::custom('pdf.save2copy', 'copy', null, 'JTOOLBAR_SAVE_AS_COPY', false);
- if ($isNew) {
- JToolBarHelper::cancel('pdf.cancel', 'JTOOLBAR_CLOSE');
- }
- else {
- JToolBarHelper::cancel('pdf.cancel', 'JTOOLBAR_CANCEL');
- }
- }
- }