Source for file articles.php

Documentation is available at articles.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. /**
  13.  * Articles list controller class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_content
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * Constructor.
  22.      *
  23.      * @param   array  $config    An optional associative array of configuration settings.
  24.  
  25.      * @return  ContentControllerArticles 
  26.      * @see     JController
  27.      * @since   1.6
  28.      */
  29.     public function __construct($config array())
  30.     {
  31.         parent::__construct($config);
  32.  
  33.         // Articles default form can come from the articles or featured view.
  34.         // Adjust the redirect view on the value of 'view' in the request.
  35.         if ($this->input->get('view'== 'featured')
  36.         {
  37.             $this->view_list = 'featured';
  38.         }
  39.  
  40.         $this->registerTask('unfeatured',    'featured');
  41.     }
  42.  
  43.     /**
  44.      * Method to toggle the featured setting of a list of articles.
  45.      *
  46.      * @return  void 
  47.      * @since   1.6
  48.      */
  49.     public function featured()
  50.     {
  51.         // Check for request forgeries
  52.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  53.  
  54.         $user   JFactory::getUser();
  55.         $ids    $this->input->get('cid'array()'array');
  56.         $values array('featured' => 1'unfeatured' => 0);
  57.         $task   $this->getTask();
  58.         $value  JArrayHelper::getValue($values$task0'int');
  59.  
  60.         // Access checks.
  61.         foreach ($ids as $i => $id)
  62.         {
  63.             if (!$user->authorise('core.edit.state''com_content.article.'.(int) $id))
  64.             {
  65.                 // Prune items that you can't change.
  66.                 unset($ids[$i]);
  67.                 JError::raiseNotice(403JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
  68.             }
  69.         }
  70.  
  71.         if (empty($ids))
  72.         {
  73.             JError::raiseWarning(500JText::_('JERROR_NO_ITEMS_SELECTED'));
  74.         }
  75.         else
  76.         {
  77.             // Get the model.
  78.             $model $this->getModel();
  79.  
  80.             // Publish the items.
  81.             if (!$model->featured($ids$value))
  82.             {
  83.                 JError::raiseWarning(500$model->getError());
  84.             }
  85.         }
  86.  
  87.         $this->setRedirect('index.php?option=com_content&view=articles');
  88.     }
  89.  
  90.     /**
  91.      * Proxy for getModel.
  92.      *
  93.      * @param   string    $name    The name of the model.
  94.      * @param   string    $prefix    The prefix for the PHP class name.
  95.      *
  96.      * @return  JModel 
  97.      * @since   1.6
  98.      */
  99.     public function getModel($name 'Article'$prefix 'ContentModel'$config array('ignore_request' => true))
  100.     {
  101.         $model parent::getModel($name$prefix$config);
  102.  
  103.         return $model;
  104.     }
  105.  
  106.     /**
  107.      * Function that allows child controller access to model data
  108.      * after the item has been deleted.
  109.      *
  110.      * @param   JModelLegacy  $model  The data model object.
  111.      * @param   integer       $ids    The array of ids for items being deleted.
  112.      *
  113.      * @return  void 
  114.      *
  115.      * @since   12.2
  116.      */
  117.     protected function postDeleteHook(JModelLegacy $model$ids null)
  118.     {
  119.     }
  120.  
  121. }

Documentation generated on Tue, 19 Nov 2013 14:53:59 +0100 by phpDocumentor 1.4.3