Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_templates
  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 template style.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_templates
  17.  * @since       1.6
  18.  */
  19. {
  20.     protected $item;
  21.  
  22.     protected $form;
  23.  
  24.     protected $state;
  25.  
  26.     /**
  27.      * Execute and display a template script.
  28.      *
  29.      * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  30.      *
  31.      * @return  mixed  A string if successful, otherwise a Error object.
  32.      */
  33.     public function display($tpl null)
  34.     {
  35.         $this->item  = $this->get('Item');
  36.         $this->state = $this->get('State');
  37.         $this->form  = $this->get('Form');
  38.  
  39.         // Check for errors.
  40.         if (count($errors $this->get('Errors')))
  41.         {
  42.             JError::raiseError(500implode("\n"$errors));
  43.  
  44.             return false;
  45.         }
  46.  
  47.         $this->addToolbar();
  48.  
  49.         return parent::display($tpl);
  50.     }
  51.  
  52.     /**
  53.      * Add the page title and toolbar.
  54.      *
  55.      * @return  void 
  56.      *
  57.      * @since   1.6
  58.      */
  59.     protected function addToolbar()
  60.     {
  61.         JFactory::getApplication()->input->set('hidemainmenu'true);
  62.  
  63.         $isNew ($this->item->id == 0);
  64.         $canDo TemplatesHelper::getActions();
  65.  
  66.         JToolbarHelper::title(
  67.             $isNew JText::_('COM_TEMPLATES_MANAGER_ADD_STYLE')
  68.             : JText::_('COM_TEMPLATES_MANAGER_EDIT_STYLE')'eye thememanager'
  69.         );
  70.  
  71.         // If not checked out, can save the item.
  72.         if ($canDo->get('core.edit'))
  73.         {
  74.             JToolbarHelper::apply('style.apply');
  75.             JToolbarHelper::save('style.save');
  76.         }
  77.  
  78.         // If an existing item, can save to a copy.
  79.         if (!$isNew && $canDo->get('core.create'))
  80.         {
  81.             JToolbarHelper::save2copy('style.save2copy');
  82.         }
  83.  
  84.         if (empty($this->item->id))
  85.         {
  86.             JToolbarHelper::cancel('style.cancel');
  87.         }
  88.         else
  89.         {
  90.             JToolbarHelper::cancel('style.cancel''JTOOLBAR_CLOSE');
  91.         }
  92.  
  93.         JToolbarHelper::divider();
  94.  
  95.         // Get the help information for the template item.
  96.         $lang JFactory::getLanguage();
  97.         $help $this->get('Help');
  98.  
  99.         if ($lang->hasKey($help->url))
  100.         {
  101.             $debug $lang->setDebug(false);
  102.             $url JText::_($help->url);
  103.             $lang->setDebug($debug);
  104.         }
  105.         else
  106.         {
  107.             $url null;
  108.         }
  109.  
  110.         JToolbarHelper::help($help->keyfalse$url);
  111.     }
  112. }

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