Source for file level.php

Documentation is available at level.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_users
  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.  * User view level controller class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_users
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * @var        string    The prefix to use with controller messages.
  22.      * @since   1.6
  23.      */
  24.     protected $text_prefix = 'COM_USERS_LEVEL';
  25.  
  26.     /**
  27.      * Method to check if you can save a new or existing record.
  28.      *
  29.      * Overrides JControllerForm::allowSave to check the core.admin permission.
  30.      *
  31.      * @param   array  An array of input data.
  32.      * @param   string    The name of the key for the primary key.
  33.      *
  34.      * @return  boolean 
  35.      * @since   1.6
  36.      */
  37.     protected function allowSave($data$key 'id')
  38.     {
  39.         return (JFactory::getUser()->authorise('core.admin'$this->option&& parent::allowSave($data$key));
  40.     }
  41.  
  42.     /**
  43.      * Method to remove a record.
  44.      */
  45.     public function delete()
  46.     {
  47.         // Check for request forgeries.
  48.         JSession::checkToken(or jexit(JText::_('JInvalid_Token'));
  49.  
  50.         $ids  $this->input->get('cid'array()'array');
  51.  
  52.         if (!JFactory::getUser()->authorise('core.admin'$this->option))
  53.         {
  54.             JError::raiseError(500JText::_('JERROR_ALERTNOAUTHOR'));
  55.             jexit();
  56.         }
  57.         elseif (empty($ids))
  58.         {
  59.             JError::raiseWarning(500JText::_('COM_USERS_NO_LEVELS_SELECTED'));
  60.         }
  61.         else
  62.         {
  63.             // Get the model.
  64.             $model $this->getModel();
  65.  
  66.             JArrayHelper::toInteger($ids);
  67.  
  68.             // Remove the items.
  69.             if (!$model->delete($ids))
  70.             {
  71.                 JError::raiseWarning(500$model->getError());
  72.             }
  73.             else {
  74.                 $this->setMessage(JText::plural('COM_USERS_N_LEVELS_DELETED'count($ids)));
  75.             }
  76.         }
  77.  
  78.         $this->setRedirect('index.php?option=com_users&view=levels');
  79.     }
  80. }

Documentation generated on Tue, 19 Nov 2013 15:06:59 +0100 by phpDocumentor 1.4.3