Пример #1
0
 /**
  * Method override to check if you can add a new record.
  *
  * @param	array	An array of input data.
  *
  * @return 	boolean
  */
 protected function _allowAdd($data = array())
 {
     // Initialise variables.
     $user = JFactory::getUser();
     $categoryId = JArrayHelper::getValue($data, 'catid', JRequest::getInt('filter_category_id'), 'int');
     $allow = null;
     if ($categoryId) {
         // If the category has been passed in the URL check it.
         $allow = $user->authorise('core.create', 'com_content.category.' . $categoryId);
     }
     if ($allow === null) {
         // In the absense of better information, revert to the component permissions.
         return parent::_allowAdd();
     } else {
         return $allow;
     }
 }