/** * Class constructor * * @param array $config Configuration parameters */ public function __construct($config = array()) { // Make sure $config is an array if (is_object($config)) { $config = (array) $config; } elseif (!is_array($config)) { $config = array(); } parent::__construct($config); $this->config = $config; // Get the input if (array_key_exists('input', $config)) { if ($config['input'] instanceof FOFInput) { $this->input = $config['input']; } else { $this->input = new FOFInput($config['input']); } } else { $this->input = new FOFInput(); } if (!array_key_exists('option', $this->config)) { $this->config['option'] = $this->input->getCmd('option', 'com_foobar'); } if (!array_key_exists('view', $this->config)) { $this->config['view'] = $this->input->getCmd('view', 'cpanel'); } $this->lists = new FOFUtilsObject(); if (!FOFPlatform::getInstance()->isCli()) { $platform = FOFPlatform::getInstance(); $perms = (object) array('create' => $platform->authorise('core.create', $this->input->getCmd('option', 'com_foobar')), 'edit' => $platform->authorise('core.edit', $this->input->getCmd('option', 'com_foobar')), 'editown' => $platform->authorise('core.edit.own', $this->input->getCmd('option', 'com_foobar')), 'editstate' => $platform->authorise('core.edit.state', $this->input->getCmd('option', 'com_foobar')), 'delete' => $platform->authorise('core.delete', $this->input->getCmd('option', 'com_foobar'))); $this->aclperms = $perms; $this->perms = $perms; } }
/** * Class constructor * * @param array $config Configuration parameters */ public function __construct($config = array()) { list($isCli, ) = FOFDispatcher::isCliAdmin(); // Make sure $config is an array if (is_object($config)) { $config = (array) $config; } elseif (!is_array($config)) { $config = array(); } parent::__construct($config); $this->config = $config; // Get the input if (array_key_exists('input', $config)) { if ($config['input'] instanceof FOFInput) { $this->input = $config['input']; } else { $this->input = new FOFInput($config['input']); } } else { $this->input = new FOFInput(); } $this->lists = new JObject(); if (!$isCli) { $user = JFactory::getUser(); $perms = (object) array('create' => $user->authorise('core.create', $this->input->getCmd('option', 'com_foobar')), 'edit' => $user->authorise('core.edit', $this->input->getCmd('option', 'com_foobar')), 'editstate' => $user->authorise('core.edit.state', $this->input->getCmd('option', 'com_foobar')), 'delete' => $user->authorise('core.delete', $this->input->getCmd('option', 'com_foobar'))); $this->assign('aclperms', $perms); $this->perms = $perms; } }