Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_weblinks
  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 weblink.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_weblinks
  17.  * @since       1.5
  18.  */
  19. {
  20.     protected $state;
  21.  
  22.     protected $item;
  23.  
  24.     protected $form;
  25.  
  26.     /**
  27.      * Display the view
  28.      */
  29.     public function display($tpl null)
  30.     {
  31.         $this->state    = $this->get('State');
  32.         $this->item        = $this->get('Item');
  33.         $this->form        = $this->get('Form');
  34.  
  35.         // Check for errors.
  36.         if (count($errors $this->get('Errors')))
  37.         {
  38.             JError::raiseError(500implode("\n"$errors));
  39.             return false;
  40.         }
  41.  
  42.         $this->addToolbar();
  43.         parent::display($tpl);
  44.     }
  45.  
  46.     /**
  47.      * Add the page title and toolbar.
  48.      *
  49.      * @since   1.6
  50.      */
  51.     protected function addToolbar()
  52.     {
  53.         JFactory::getApplication()->input->set('hidemainmenu'true);
  54.  
  55.         $user        JFactory::getUser();
  56.         $isNew        ($this->item->id == 0);
  57.         $checkedOut    !($this->item->checked_out == || $this->item->checked_out == $user->get('id'));
  58.  
  59.         // Since we don't track these assets at the item level, use the category id.
  60.         $canDo        JHelperContent::getActions($this->item->catid0'com_weblinks');
  61.  
  62.         JToolbarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINK')'link weblinks');
  63.  
  64.         // If not checked out, can save the item.
  65.         if (!$checkedOut && ($canDo->get('core.edit')||(count($user->getAuthorisedCategories('com_weblinks''core.create')))))
  66.         {
  67.             JToolbarHelper::apply('weblink.apply');
  68.             JToolbarHelper::save('weblink.save');
  69.         }
  70.         if (!$checkedOut && (count($user->getAuthorisedCategories('com_weblinks''core.create'))))
  71.         {
  72.             JToolbarHelper::save2new('weblink.save2new');
  73.         }
  74.         // If an existing item, can save to a copy.
  75.         if (!$isNew && (count($user->getAuthorisedCategories('com_weblinks''core.create')) 0))
  76.         {
  77.             JToolbarHelper::save2copy('weblink.save2copy');
  78.         }
  79.         if (empty($this->item->id))
  80.         {
  81.             JToolbarHelper::cancel('weblink.cancel');
  82.         }
  83.         else
  84.         {
  85.             if ($this->state->params->get('save_history'0&& $user->authorise('core.edit'))
  86.             {
  87.                 JToolbarHelper::versions('com_weblinks.weblink'$this->item->id);
  88.             }
  89.  
  90.             JToolbarHelper::cancel('weblink.cancel''JTOOLBAR_CLOSE');
  91.         }
  92.  
  93.         JToolbarHelper::divider();
  94.         JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS_EDIT');
  95.     }
  96. }

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