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 client.
  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.      * @var  JObject  Object containing permissions for the item
  30.      */
  31.     protected $canDo;
  32.  
  33.     /**
  34.      * Display the view
  35.      */
  36.     public function display($tpl null)
  37.     {
  38.         $this->form    = $this->get('Form');
  39.         $this->item    = $this->get('Item');
  40.         $this->state    = $this->get('State');
  41.         $this->canDo = JHelperContent::getActions(00'com_banners');
  42.  
  43.         // Check for errors.
  44.         if (count($errors $this->get('Errors')))
  45.         {
  46.             JError::raiseError(500implode("\n"$errors));
  47.             return false;
  48.         }
  49.  
  50.         $this->addToolbar();
  51.         parent::display($tpl);
  52.     }
  53.  
  54.     /**
  55.      * Add the page title and toolbar.
  56.      *
  57.      * @since   1.6
  58.      */
  59.     protected function addToolbar()
  60.     {
  61.         JFactory::getApplication()->input->set('hidemainmenu'true);
  62.  
  63.         $user        JFactory::getUser();
  64.         $isNew        ($this->item->id == 0);
  65.         $checkedOut    !($this->item->checked_out == || $this->item->checked_out == $user->get('id'));
  66.         $canDo        $this->canDo;
  67.  
  68.         JToolbarHelper::title($isNew JText::_('COM_BANNERS_MANAGER_CLIENT_NEW'JText::_('COM_BANNERS_MANAGER_CLIENT_EDIT')'bookmark banners-clients');
  69.  
  70.         // If not checked out, can save the item.
  71.         if (!$checkedOut && ($canDo->get('core.edit')||$canDo->get('core.create')))
  72.         {
  73.             JToolbarHelper::apply('client.apply');
  74.             JToolbarHelper::save('client.save');
  75.         }
  76.         if (!$checkedOut && $canDo->get('core.create')) {
  77.  
  78.             JToolbarHelper::save2new('client.save2new');
  79.         }
  80.         // If an existing item, can save to a copy.
  81.         if (!$isNew && $canDo->get('core.create'))
  82.         {
  83.             JToolbarHelper::save2copy('client.save2copy');
  84.         }
  85.  
  86.         if (empty($this->item->id))
  87.         {
  88.             JToolbarHelper::cancel('client.cancel');
  89.         }
  90.         else
  91.         {
  92.             if ($this->state->params->get('save_history'0&& $user->authorise('core.edit'))
  93.             {
  94.                 JToolbarHelper::versions('com_banners.client'$this->item->id);
  95.             }
  96.  
  97.             JToolbarHelper::cancel('client.cancel''JTOOLBAR_CLOSE');
  98.         }
  99.  
  100.         JToolbarHelper::divider();
  101.         JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS_EDIT');
  102.     }
  103. }

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