Source for file newsfeed.php

Documentation is available at newsfeed.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.  * Newsfeed controller class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_newsfeeds
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * Method override to check if you can add a new record.
  22.      *
  23.      * @param   array  $data  An array of input data.
  24.      *
  25.      * @return  boolean 
  26.      *
  27.      * @since   1.6
  28.      */
  29.     protected function allowAdd($data array())
  30.     {
  31.         $user JFactory::getUser();
  32.         $categoryId JArrayHelper::getValue($data'catid'$this->input->getInt('filter_category_id')'int');
  33.         $allow null;
  34.  
  35.         if ($categoryId)
  36.         {
  37.             // If the category has been passed in the URL check it.
  38.             $allow $user->authorise('core.create'$this->option . '.category.' $categoryId);
  39.         }
  40.  
  41.         if ($allow === null)
  42.         {
  43.             // In the absence of better information, revert to the component permissions.
  44.             return parent::allowAdd($data);
  45.         }
  46.         else
  47.         {
  48.             return $allow;
  49.         }
  50.     }
  51.  
  52.     /**
  53.      * Method to check if you can edit a record.
  54.      *
  55.      * @param   array   $data  An array of input data.
  56.      * @param   string  $key   The name of the key for the primary key.
  57.      *
  58.      * @return  boolean 
  59.      *
  60.      * @since   1.6
  61.      */
  62.     protected function allowEdit($data array()$key 'id')
  63.     {
  64.         $user JFactory::getUser();
  65.         $recordId = (int) isset($data[$key]$data[$key0;
  66.         $categoryId 0;
  67.  
  68.         if ($recordId)
  69.         {
  70.             $categoryId = (int) $this->getModel()->getItem($recordId)->catid;
  71.         }
  72.  
  73.         if ($categoryId)
  74.         {
  75.             // The category has been set. Check the category permissions.
  76.             return $user->authorise('core.edit'$this->option . '.category.' $categoryId);
  77.         }
  78.         else
  79.         {
  80.             // Since there is no asset tracking, revert to the component permissions.
  81.             return parent::allowEdit($data$key);
  82.         }
  83.     }
  84.  
  85.     /**
  86.      * Method to run batch operations.
  87.      *
  88.      * @param   object  $model  The model.
  89.      *
  90.      * @return  boolean   True if successful, false otherwise and internal error is set.
  91.      *
  92.      * @since   2.5
  93.      */
  94.     public function batch($model null)
  95.     {
  96.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  97.  
  98.         // Set the model
  99.         $model $this->getModel('Newsfeed'''array());
  100.  
  101.         // Preset the redirect
  102.         $this->setRedirect(JRoute::_('index.php?option=com_newsfeeds&view=newsfeeds' $this->getRedirectToListAppend()false));
  103.  
  104.         return parent::batch($model);
  105.     }
  106.  
  107.     /**
  108.      * Function that allows child controller access to model data after the data has been saved.
  109.      *
  110.      * @param   JModelLegacy  $model      The data model object.
  111.      * @param   array         $validData  The validated data.
  112.      *
  113.      * @return  void 
  114.      *
  115.      * @since   3.1
  116.      */
  117.     protected function postSaveHook(JModelLegacy $model$validData array())
  118.     {
  119.  
  120.     }
  121. }

Documentation generated on Tue, 19 Nov 2013 15:09:27 +0100 by phpDocumentor 1.4.3