| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Joomla.Administrator 4 * @subpackage com_content 5 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 6 * @license GNU General Public License version 2 or later; see LICENSE.txt 7 */ 8 9 // No direct access. 10 defined('_JEXEC') or die; 11 12 jimport('joomla.application.component.controlleradmin'); 13 14 /** 15 * Articles list controller class. 16 * 17 * @package Joomla.Administrator 18 * @subpackage com_content 19 * @since 1.6 20 */ 21 class ContentControllerArticles extends JControllerAdmin 22 { 23 /** 24 * Constructor. 25 * 26 * @param array $config An optional associative array of configuration settings. 27 28 * @return ContentControllerArticles 29 * @see JController 30 * @since 1.6 31 */ 32 public function __construct($config = array()) 33 { 34 // Articles default form can come from the articles or featured view. 35 // Adjust the redirect view on the value of 'view' in the request. 36 if (JRequest::getCmd('view') == 'featured') { 37 $this->view_list = 'featured'; 38 } 39 parent::__construct($config); 40 41 $this->registerTask('unfeatured', 'featured'); 42 } 43 44 /** 45 * Method to toggle the featured setting of a list of articles. 46 * 47 * @return void 48 * @since 1.6 49 */ 50 function featured() 51 { 52 // Check for request forgeries 53 JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); 54 55 // Initialise variables. 56 $user = JFactory::getUser(); 57 $ids = JRequest::getVar('cid', array(), '', 'array'); 58 $values = array('featured' => 1, 'unfeatured' => 0); 59 $task = $this->getTask(); 60 $value = JArrayHelper::getValue($values, $task, 0, 'int'); 61 62 // Access checks. 63 foreach ($ids as $i => $id) 64 { 65 if (!$user->authorise('core.edit.state', 'com_content.article.'.(int) $id)) { 66 // Prune items that you can't change. 67 unset($ids[$i]); 68 JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); 69 } 70 } 71 72 if (empty($ids)) { 73 JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED')); 74 } 75 else { 76 // Get the model. 77 $model = $this->getModel(); 78 79 // Publish the items. 80 if (!$model->featured($ids, $value)) { 81 JError::raiseWarning(500, $model->getError()); 82 } 83 } 84 85 $this->setRedirect('index.php?option=com_content&view=articles'); 86 } 87 88 /** 89 * Proxy for getModel. 90 * 91 * @param string $name The name of the model. 92 * @param string $prefix The prefix for the PHP class name. 93 * 94 * @return JModel 95 * @since 1.6 96 */ 97 public function getModel($name = 'Article', $prefix = 'ContentModel', $config = array('ignore_request' => true)) 98 { 99 $model = parent::getModel($name, $prefix, $config); 100 101 return $model; 102 } 103 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Apr 3 11:40:28 2012 | Cross-referenced by PHPXref 0.7.1 |