[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_content/controllers/ -> featured.php (source)

   1  <?php
   2  /**
   3   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   4   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  
   7  // no direct access
   8  defined('_JEXEC') or die;
   9  
  10  jimport('joomla.application.component.controller');
  11  
  12  require_once dirname(__FILE__).'/articles.php';
  13  
  14  /**
  15   * @package        Joomla.Administrator
  16   * @subpackage    com_content
  17   */
  18  class ContentControllerFeatured extends ContentControllerArticles
  19  {
  20      /**
  21       * Removes an item
  22       */
  23  	function delete()
  24      {
  25          // Check for request forgeries
  26          JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
  27  
  28          // Initialise variables.
  29          $user    = JFactory::getUser();
  30          $ids    = JRequest::getVar('cid', array(), '', 'array');
  31  
  32          // Access checks.
  33          foreach ($ids as $i => $id)
  34          {
  35              if (!$user->authorise('core.delete', 'com_content.article.'.(int) $id))
  36              {
  37                  // Prune items that you can't delete.
  38                  unset($ids[$i]);
  39                  JError::raiseNotice(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
  40              }
  41          }
  42  
  43          if (empty($ids)) {
  44              JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
  45          }
  46          else {
  47              // Get the model.
  48              $model = $this->getModel();
  49  
  50              // Remove the items.
  51              if (!$model->featured($ids, 0)) {
  52                  JError::raiseWarning(500, $model->getError());
  53              }
  54          }
  55  
  56          $this->setRedirect('index.php?option=com_content&view=featured');
  57      }
  58  
  59      /**
  60       * Method to publish a list of articles.
  61       *
  62       * @return    void
  63       * @since    1.0
  64       */
  65  	function publish()
  66      {
  67          parent::publish();
  68  
  69          $this->setRedirect('index.php?option=com_content&view=featured');
  70      }
  71  
  72      /**
  73       * Method to get a model object, loading it if required.
  74       *
  75       * @param   string  $name    The model name. Optional.
  76       * @param   string  $prefix  The class prefix. Optional.
  77       * @param   array   $config  Configuration array for model. Optional.
  78       *
  79       * @return  object  The model.
  80       *
  81       * @since   1.6
  82       */
  83  	public function getModel($name = 'Feature', $prefix = 'ContentModel', $config = array('ignore_request' => true))
  84      {
  85          $model = parent::getModel($name, $prefix, $config);
  86          return $model;
  87      }
  88  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1