/** * Return a list of coverages that use to generate select box * @return Array */ private function getCoverages() { $coverages = array(); foreach (PoweradminHelper::getSearchCoverages() as $coverage) { if ($coverage == 'adminmenus') { continue; } $coverages[] = array('value' => $coverage, 'text' => JText::_('PLG_JSNADMINBAR_SEARCH_COVERAGE_' . strtoupper(str_replace(JSN_3RD_EXTENSION_STRING . '-', '', $coverage)), true)); } return $coverages; }
/** * Return parameters for client side as JSON format * @return string */ private function _getJSConfiguration() { $input = $this->_application->input; $defaultStyles = $this->_getDefaultStyles(); $installedComponents = PoweradminHelper::getInstalledComponents(); $supportedExtList = JSNPaExtensionsHelper::getSupportedExtList(); if (!$this->_params->get('search_coverage')) { $coverages = PoweradminHelper::getSearchCoverages(); } else { $coverages = json_decode($this->_params->get('search_coverage', PoweradminHelper::getSearchCoverages())); } foreach ($supportedExtList as $_supportedExt => $value) { $supportedExtAlias = str_replace('com_', JSN_3RD_EXTENSION_STRING . '-', $_supportedExt); $_extShortName = str_ireplace('com_', '', $_supportedExt); $_plg = JPluginHelper::getPlugin('jsnpoweradmin', $_extShortName); if (in_array($_supportedExt, $installedComponents) && !in_array($_supportedExt, $coverages) && !count($_plg) && !in_array($supportedExtAlias, explode(',', $this->_params->get('search_coverage_order')))) { array_push($coverages, JSN_3RD_EXTENSION_NOT_INSTALLED_STRING . '-' . $_extShortName); } if (in_array($_supportedExt, $installedComponents) && count($_plg) && !in_array($supportedExtAlias, explode(',', $this->_params->get('search_coverage_order')))) { array_push($coverages, JSN_3RD_EXTENSION_NOT_ENABLED_STRING . '-' . $_extShortName); } } $logoFile = $this->_params->get('logo_file', 'administrator/components/com_poweradmin/assets/images/logo-jsnpoweradmin.png'); $logoFile = $logoFile == 'N/A' ? '' : JURI::root(true) . '/' . $logoFile; $canInstall = $this->_user->authorise('core.manage', 'com_installer'); // Get editors $curEditor = JFactory::getUser()->getParam('editor'); $editorOptions = array(); foreach ($this->_getEditorOptions() as $option) { $_isAtive = $curEditor == $option->value ? true : false; $editorOptions[] = array('value' => $option->value, 'name' => $option->text, 'active' => $_isAtive); } $conf = array('currentUrl' => $_SERVER["REQUEST_URI"], 'baseUrl' => JURI::base(true) . '/', 'rootUrl' => JURI::root(true) . '/', 'userId' => $this->_user->id, 'protected' => $this->_getProtectedComponents(), 'defaultStyles' => $defaultStyles, 'logoFile' => $logoFile, 'logoLink' => $this->_params->get('logo_link', 'http://www.joomlashine.com/joomla-extensions/jsn-poweradmin.html'), 'logoLinkTarget' => $this->_params->get('logo_target', '_blank'), 'logoTitle' => JText::_($this->_params->get('logo_slogan', JText::_('PLG_JSNADMINBAR_CONFIG_LOGO_SLOGAN_DEFAULT'))), 'allowUninstall' => $this->_params->get('allow_uninstall', true) && $canInstall, 'linkTarget' => $this->_target, 'preloadImages' => array('bg-overlay.png', 'loader.gif', 'dark-loader.gif', 'ui-window-buttons.png'), 'pinned' => $this->_params->get('pinned_bar', true), 'sessionInfinite' => $this->_params->get('admin_session_timer_infinite', false), 'warningTime' => $this->_params->get('session_timeout_warning', 1), 'disableWarning' => $this->_params->get('admin_session_timeout_warning_disabled', false), 'searchCoverages' => $coverages, 'sitemenu' => array('preview' => $this->_preview->getPreviewLink(), 'manager' => JRoute::_('index.php?option=com_poweradmin&view=rawmode', false)), 'usermenu' => array('messages' => $this->_getMessagesCount(), 'profileLink' => "index.php?option=com_admin&task=profile.edit&id={$this->_user->id}&tmpl=component", 'messageLink' => "index.php?option=com_messages", 'logoutLink' => "index.php?option=com_login&task=logout&" . JSession::getFormToken() . "=1"), 'history' => array('url' => 'index.php?option=com_poweradmin&task=history.load'), 'spotlight' => array('limit' => $this->_params->get('search_result_num', 10)), 'urlparams' => array('option' => $input->getVar('option', ''), 'task' => $input->getVar('task', ''), 'view' => $input->getVar('view', ''), 'layout' => $input->getVar('layout', ''), 'id' => $input->getInt('id', 0)), 'editors' => $editorOptions); return json_encode($conf); }
/** * Method to get the field options. * * @return array The field option objects. * * @since 11.1 */ protected function getOptions() { JSNFactory::localimport('helpers.poweradmin'); // Initialize variables. $options = array(); //get predefined search coverages $options = PoweradminHelper::getSearchCoverages(); return $options; }