Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_newsfeeds
  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 newsfeed.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_newsfeeds
  17.  * @since       1.6
  18.  */
  19. {
  20.     protected $item;
  21.  
  22.     protected $form;
  23.  
  24.     protected $state;
  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.         if ($this->getLayout(== 'modal')
  43.         {
  44.             $this->form->setFieldAttribute('language''readonly''true');
  45.             $this->form->setFieldAttribute('catid''readonly''true');
  46.         }
  47.  
  48.         $this->addToolbar();
  49.         parent::display($tpl);
  50.     }
  51.  
  52.     /**
  53.      * Add the page title and toolbar.
  54.      *
  55.      * @since   1.6
  56.      */
  57.     protected function addToolbar()
  58.     {
  59.         JFactory::getApplication()->input->set('hidemainmenu'true);
  60.  
  61.         $user        JFactory::getUser();
  62.         $isNew        ($this->item->id == 0);
  63.         $checkedOut    !($this->item->checked_out == || $this->item->checked_out == $user->get('id'));
  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_newsfeeds');
  67.  
  68.         JToolbarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEED')'feed newsfeeds');
  69.  
  70.         // If not checked out, can save the item.
  71.         if (!$checkedOut && ($canDo->get('core.edit'|| count($user->getAuthorisedCategories('com_newsfeeds''core.create')) 0))
  72.         {
  73.             JToolbarHelper::apply('newsfeed.apply');
  74.             JToolbarHelper::save('newsfeed.save');
  75.         }
  76.         if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds''core.create')) 0)
  77.         {
  78.             JToolbarHelper::save2new('newsfeed.save2new');
  79.         }
  80.         // If an existing item, can save to a copy.
  81.         if (!$isNew && $canDo->get('core.create'))
  82.         {
  83.             JToolbarHelper::save2copy('newsfeed.save2copy');
  84.         }
  85.  
  86.         if (empty($this->item->id))
  87.         {
  88.             JToolbarHelper::cancel('newsfeed.cancel');
  89.         }
  90.         else
  91.         {
  92.             if ($this->state->params->get('save_history'0&& $user->authorise('core.edit'))
  93.             {
  94.                 JToolbarHelper::versions('com_newsfeeds.newsfeed'$this->item->id);
  95.             }
  96.  
  97.             JToolbarHelper::cancel('newsfeed.cancel''JTOOLBAR_CLOSE');
  98.         }
  99.  
  100.         JToolbarHelper::divider();
  101.         JToolbarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
  102.     }
  103. }

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