Source for file featured.php

Documentation is available at featured.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_content
  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. require_once __DIR__ . '/articles.php';
  13.  
  14. /**
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_content
  17.  */
  18. {
  19.     /**
  20.      * Removes an item
  21.      */
  22.     public function delete()
  23.     {
  24.         // Check for request forgeries
  25.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  26.  
  27.         $user JFactory::getUser();
  28.         $ids  $this->input->get('cid'array()'array');
  29.  
  30.         // Access checks.
  31.         foreach ($ids as $i => $id)
  32.         {
  33.             if (!$user->authorise('core.delete''com_content.article.'.(int) $id))
  34.             {
  35.                 // Prune items that you can't delete.
  36.                 unset($ids[$i]);
  37.                 JError::raiseNotice(403JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
  38.             }
  39.         }
  40.  
  41.         if (empty($ids))
  42.         {
  43.             JError::raiseWarning(500JText::_('JERROR_NO_ITEMS_SELECTED'));
  44.         }
  45.         else
  46.         {
  47.             // Get the model.
  48.             $model $this->getModel();
  49.  
  50.             // Remove the items.
  51.             if (!$model->featured($ids0))
  52.             {
  53.                 JError::raiseWarning(500$model->getError());
  54.             }
  55.         }
  56.  
  57.         $this->setRedirect('index.php?option=com_content&view=featured');
  58.     }
  59.  
  60.     /**
  61.      * Method to publish a list of articles.
  62.      *
  63.      * @return  void 
  64.      * @since   1.0
  65.      */
  66.     public function publish()
  67.     {
  68.         parent::publish();
  69.  
  70.         $this->setRedirect('index.php?option=com_content&view=featured');
  71.     }
  72.  
  73.     /**
  74.      * Method to get a model object, loading it if required.
  75.      *
  76.      * @param   string  $name    The model name. Optional.
  77.      * @param   string  $prefix  The class prefix. Optional.
  78.      * @param   array   $config  Configuration array for model. Optional.
  79.      *
  80.      * @return  object  The model.
  81.      *
  82.      * @since   1.6
  83.      */
  84.     public function getModel($name 'Feature'$prefix 'ContentModel'$config array('ignore_request' => true))
  85.     {
  86.         $model parent::getModel($name$prefix$config);
  87.         return $model;
  88.     }
  89. }

Documentation generated on Tue, 19 Nov 2013 15:02:52 +0100 by phpDocumentor 1.4.3