Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_modules
  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. /**
  13.  * View to edit a module.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_modules
  17.  * @since       1.6
  18.  */
  19. {
  20.     protected $form;
  21.  
  22.     protected $item;
  23.  
  24.     protected $state;
  25.  
  26.     /**
  27.      * Display the view
  28.      */
  29.     public function display($tpl null)
  30.     {
  31.         $this->form        = $this->get('Form');
  32.         $this->item        = $this->get('Item');
  33.         $this->state    = $this->get('State');
  34.         $this->canDo    ModulesHelper::getActions($this->item->id);
  35.  
  36.         // Check for errors.
  37.         if (count($errors $this->get('Errors')))
  38.         {
  39.             JError::raiseError(500implode("\n"$errors));
  40.             return false;
  41.         }
  42.  
  43.         $this->addToolbar();
  44.         parent::display($tpl);
  45.     }
  46.  
  47.     /**
  48.      * Add the page title and toolbar.
  49.      *
  50.      * @since   1.6
  51.      */
  52.     protected function addToolbar()
  53.     {
  54.         JFactory::getApplication()->input->set('hidemainmenu'true);
  55.  
  56.         $user        JFactory::getUser();
  57.         $isNew        ($this->item->id == 0);
  58.         $checkedOut    !($this->item->checked_out == || $this->item->checked_out == $user->get('id'));
  59.         $canDo        ModulesHelper::getActions($this->item->id);
  60.  
  61.         JToolbarHelper::title(JText::sprintf('COM_MODULES_MANAGER_MODULE'JText::_($this->item->module))'cube module');
  62.  
  63.         // For new records, check the create permission.
  64.         if ($isNew && $canDo->get('core.create'))
  65.         {
  66.             JToolbarHelper::apply('module.apply');
  67.             JToolbarHelper::save('module.save');
  68.             JToolbarHelper::save2new('module.save2new');
  69.             JToolbarHelper::cancel('module.cancel');
  70.         }
  71.         else
  72.         {
  73.             // Can't save the record if it's checked out.
  74.             if (!$checkedOut)
  75.             {
  76.                 // Since it's an existing record, check the edit permission.
  77.                 if ($canDo->get('core.edit'))
  78.                 {
  79.                     JToolbarHelper::apply('module.apply');
  80.                     JToolbarHelper::save('module.save');
  81.  
  82.                     // We can save this record, but check the create permission to see if we can return to make a new one.
  83.                     if ($canDo->get('core.create'))
  84.                     {
  85.                         JToolbarHelper::save2new('module.save2new');
  86.                     }
  87.                 }
  88.             }
  89.  
  90.             // If checked out, we can still save
  91.             if ($canDo->get('core.create'))
  92.             {
  93.                 JToolbarHelper::save2copy('module.save2copy');
  94.             }
  95.  
  96.             JToolbarHelper::cancel('module.cancel''JTOOLBAR_CLOSE');
  97.         }
  98.  
  99.         // Get the help information for the menu item.
  100.         $lang JFactory::getLanguage();
  101.  
  102.         $help $this->get('Help');
  103.         if ($lang->hasKey($help->url))
  104.         {
  105.             $debug $lang->setDebug(false);
  106.             $url JText::_($help->url);
  107.             $lang->setDebug($debug);
  108.         }
  109.         else
  110.         {
  111.             $url null;
  112.         }
  113.         JToolbarHelper::help($help->keyfalse$url);
  114.     }
  115. }

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