| [ 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_banners 5 * 6 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 // No direct access 11 defined('_JEXEC') or die; 12 13 jimport('joomla.application.component.controllerform'); 14 15 /** 16 * Banner controller class. 17 * 18 * @package Joomla.Administrator 19 * @subpackage com_banners 20 * @since 1.6 21 */ 22 class BannersControllerBanner extends JControllerForm 23 { 24 /** 25 * @var string The prefix to use with controller messages. 26 * @since 1.6 27 */ 28 protected $text_prefix = 'COM_BANNERS_BANNER'; 29 30 /** 31 * Method override to check if you can add a new record. 32 * 33 * @param array $data An array of input data. 34 * 35 * @return boolean 36 * 37 * @since 1.6 38 */ 39 protected function allowAdd($data = array()) 40 { 41 // Initialise variables. 42 $user = JFactory::getUser(); 43 $categoryId = JArrayHelper::getValue($data, 'catid', JRequest::getInt('filter_category_id'), 'int'); 44 $allow = null; 45 46 if ($categoryId) 47 { 48 // If the category has been passed in the URL check it. 49 $allow = $user->authorise('core.create', $this->option . '.category.' . $categoryId); 50 } 51 52 if ($allow === null) 53 { 54 // In the absence of better information, revert to the component permissions. 55 return parent::allowAdd($data); 56 } 57 else 58 { 59 return $allow; 60 } 61 } 62 63 /** 64 * Method override to check if you can edit an existing record. 65 * 66 * @param array $data An array of input data. 67 * @param string $key The name of the key for the primary key. 68 * 69 * @return boolean 70 * 71 * @since 1.6 72 */ 73 protected function allowEdit($data = array(), $key = 'id') 74 { 75 // Initialise variables. 76 $user = JFactory::getUser(); 77 $recordId = (int) isset($data[$key]) ? $data[$key] : 0; 78 $categoryId = 0; 79 80 if ($recordId) 81 { 82 $categoryId = (int) $this->getModel()->getItem($recordId)->catid; 83 } 84 85 if ($categoryId) 86 { 87 // The category has been set. Check the category permissions. 88 return $user->authorise('core.edit', $this->option . '.category.' . $categoryId); 89 } 90 else 91 { 92 // Since there is no asset tracking, revert to the component permissions. 93 return parent::allowEdit($data, $key); 94 } 95 } 96 97 /** 98 * Method to run batch operations. 99 * 100 * @param string $model The model 101 * 102 * @return boolean True on success. 103 * 104 * @since 2.5 105 */ 106 public function batch($model = null) 107 { 108 JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); 109 110 // Set the model 111 $model = $this->getModel('Banner', '', array()); 112 113 // Preset the redirect 114 $this->setRedirect(JRoute::_('index.php?option=com_banners&view=banners' . $this->getRedirectToListAppend(), false)); 115 116 return parent::batch($model); 117 } 118 119 }
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 |