Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_banners
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. JLoader::register('BannersHelper'JPATH_COMPONENT '/helpers/banners.php');
  13.  
  14. /**
  15.  * View to edit a banner.
  16.  *
  17.  * @package     Joomla.Administrator
  18.  * @subpackage  com_banners
  19.  * @since       1.5
  20.  */
  21. {
  22.     protected $form;
  23.  
  24.     protected $item;
  25.  
  26.     protected $state;
  27.  
  28.     /**
  29.      * Display the view
  30.      */
  31.     public function display($tpl null)
  32.     {
  33.         // Initialiase variables.
  34.         $this->form        = $this->get('Form');
  35.         $this->item        = $this->get('Item');
  36.         $this->state    = $this->get('State');
  37.  
  38.         // Check for errors.
  39.         if (count($errors $this->get('Errors')))
  40.         {
  41.             JError::raiseError(500implode("\n"$errors));
  42.             return false;
  43.         }
  44.  
  45.         $this->addToolbar();
  46.         JHtml::_('jquery.framework');
  47.         JHtml::_('script''media/com_banners/banner.js');
  48.         parent::display($tpl);
  49.     }
  50.  
  51.     /**
  52.      * Add the page title and toolbar.
  53.      *
  54.      * @since   1.6
  55.      */
  56.     protected function addToolbar()
  57.     {
  58.         JFactory::getApplication()->input->set('hidemainmenu'true);
  59.  
  60.         $user        JFactory::getUser();
  61.         $userId        $user->get('id');
  62.         $isNew        ($this->item->id == 0);
  63.         $checkedOut    !($this->item->checked_out == || $this->item->checked_out == $userId);
  64.  
  65.         // Since we don't track these assets at the item level, use the category id.
  66.         $canDo        JHelperContent::getActions($this->item->catid0'com_banners');
  67.  
  68.         JToolbarHelper::title($isNew JText::_('COM_BANNERS_MANAGER_BANNER_NEW'JText::_('COM_BANNERS_MANAGER_BANNER_EDIT')'bookmark banners');
  69.  
  70.         // If not checked out, can save the item.
  71.         if (!$checkedOut && ($canDo->get('core.edit'|| count($user->getAuthorisedCategories('com_banners''core.create')) 0))
  72.         {
  73.             JToolbarHelper::apply('banner.apply');
  74.             JToolbarHelper::save('banner.save');
  75.  
  76.             if ($canDo->get('core.create'))
  77.             {
  78.                 JToolbarHelper::save2new('banner.save2new');
  79.             }
  80.         }
  81.  
  82.         // If an existing item, can save to a copy.
  83.         if (!$isNew && $canDo->get('core.create'))
  84.         {
  85.             JToolbarHelper::save2copy('banner.save2copy');
  86.         }
  87.  
  88.         if (empty($this->item->id))
  89.         {
  90.             JToolbarHelper::cancel('banner.cancel');
  91.         }
  92.         else
  93.         {
  94.             if ($this->state->params->get('save_history'0&& $user->authorise('core.edit'))
  95.             {
  96.                 JToolbarHelper::versions('com_banners.banner'$this->item->id);
  97.             }
  98.  
  99.             JToolbarHelper::cancel('banner.cancel''JTOOLBAR_CLOSE');
  100.         }
  101.  
  102.         JToolbarHelper::divider();
  103.         JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT');
  104.     }
  105. }

Documentation generated on Tue, 19 Nov 2013 15:17:52 +0100 by phpDocumentor 1.4.3