예제 #1
0
 /**
  * Retrieve search coverage configuration
  * @param String $coverage
  * @return Array
  */
 private function getConfiguration($coverage)
 {
     $configurations = array('articles' => array('language' => 'com_content', 'modelfile' => 'components/com_content/models/articles.php', 'viewfile' => 'articles', 'modelname' => 'ContentModelArticles', 'order' => 'a.title'), 'components' => array('tabs' => array('com_banners' => array('title' => 'Banners', 'language' => 'com_banners', 'modelfile' => 'components/com_banners/models/banners.php', 'viewfile' => 'banners_items', 'modelname' => 'BannersModelBanners', 'order' => 'name'), 'com_banners_categories' => array('title' => 'Banners Categories', 'language' => 'com_categories', 'modelfile' => 'components/com_categories/models/categories.php', 'viewfile' => 'categories', 'modelname' => 'CategoriesModelCategories', 'order' => 'a.lft', 'filters' => array('filter.extension' => 'com_banners')), 'com_banners_clients' => array('title' => 'Banners Clients', 'language' => 'com_banners', 'modelfile' => 'components/com_banners/models/clients.php', 'viewfile' => 'banners_clients', 'modelname' => 'BannersModelClients', 'order' => 'a.name'), 'com_contact' => array('title' => 'Contacts', 'language' => 'com_contact', 'modelfile' => 'components/com_contact/models/contacts.php', 'viewfile' => 'contacts_items', 'modelname' => 'ContactModelContacts', 'order' => 'name'), 'com_contact_categories' => array('title' => 'Contacts Categories', 'language' => 'com_categories', 'modelfile' => 'components/com_categories/models/categories.php', 'viewfile' => 'categories', 'modelname' => 'CategoriesModelCategories', 'order' => 'a.lft', 'filters' => array('filter.extension' => 'com_contact')), 'com_messages' => array('title' => 'Messages', 'language' => 'com_messages', 'modelfile' => 'components/com_messages/models/messages.php', 'viewfile' => 'messages', 'modelname' => 'MessagesModelMessages', 'order' => 'a.date_time'), 'com_newsfeeds' => array('title' => 'Feeds', 'language' => 'com_newsfeeds', 'modelfile' => 'components/com_newsfeeds/models/newsfeeds.php', 'viewfile' => 'feeds', 'modelname' => 'NewsfeedsModelNewsfeeds', 'order' => 'a.name'), 'com_newsfeeds_categories' => array('title' => 'Feeds Categories', 'language' => 'com_categories', 'modelfile' => 'components/com_categories/models/categories.php', 'viewfile' => 'categories', 'modelname' => 'CategoriesModelCategories', 'order' => 'a.lft', 'filters' => array('filter.extension' => 'com_newsfeeds')), 'com_weblinks' => array('title' => 'Web Links', 'language' => 'com_weblinks', 'modelfile' => 'components/com_weblinks/models/weblinks.php', 'viewfile' => 'weblinks', 'modelname' => 'WeblinksModelWeblinks', 'order' => 'a.title'), 'com_weblinks_categories' => array('title' => 'Web Links Categories', 'language' => 'com_categories', 'modelfile' => 'components/com_categories/models/categories.php', 'viewfile' => 'categories', 'modelname' => 'CategoriesModelCategories', 'order' => 'a.lft', 'filters' => array('filter.extension' => 'com_weblinks')))), 'categories' => array('language' => 'com_categories', 'modelfile' => 'components/com_categories/models/categories.php', 'viewfile' => 'categories', 'modelname' => 'CategoriesModelCategories', 'order' => 'a.lft'), 'modules' => array('language' => 'com_modules', 'modelfile' => 'components/com_modules/models/modules.php', 'viewfile' => 'modules', 'modelname' => 'ModulesModelModules', 'order' => 'a.title'), 'plugins' => array('language' => 'com_plugins', 'modelfile' => 'components/com_plugins/models/plugins.php', 'viewfile' => 'plugins', 'modelname' => 'PluginsModelPlugins', 'order' => 'a.title'), 'menus' => array('language' => 'com_menus', 'modelfile' => 'components/com_poweradmin/models/menusearch.php', 'viewfile' => 'menus', 'modelname' => 'PowerAdminModelMenuSearch', 'order' => 'a.lft'), 'templates' => array('language' => 'com_templates', 'modelfile' => 'components/com_templates/models/styles.php', 'viewfile' => 'templates', 'modelname' => 'TemplatesModelStyles', 'order' => 'a.title'), 'users' => array('language' => 'com_users', 'modelfile' => 'components/com_users/models/users.php', 'viewfile' => 'users', 'modelname' => 'UsersModelUsers', 'order' => 'a.name'));
     $supportedExtConfigs = JSNPaExtensionsHelper::getExtConfigurations(str_ireplace(JSN_3RD_EXTENSION_STRING . '-', '', $coverage));
     if (count($supportedExtConfigs)) {
         foreach ($supportedExtConfigs as $key => $config) {
             $configurations[JSN_3RD_EXTENSION_STRING . '-' . strtolower($key)] = $config;
         }
     }
     if (!isset($configurations[$coverage])) {
         return null;
     }
     $config = $configurations[$coverage];
     if (!isset($config['tabs'])) {
         return $config;
     }
     $this->tabs = array();
     foreach ($config['tabs'] as $key => $tab) {
         if ($coverage == 'components') {
             continue;
         }
         $model = $this->getItemModel($tab, $this->state, $key);
         $total = $model->getTotal();
         if ($total > 0) {
             $this->tabs[$key] = array('title' => "{$tab['title']} ({$total})", 'selected' => false);
         }
     }
     $selectedTab = $this->app->getUserStateFromRequest("components.selected", 'tab', null);
     if ($selectedTab == null || !isset($this->tabs[$selectedTab])) {
         $tabKeys = array_keys($this->tabs);
         $selectedTab = array_shift($tabKeys);
         $this->app->setUserState('components.selected', $selectedTab);
     }
     if (empty($this->tabs)) {
         return null;
     }
     $this->tabs[$selectedTab]['selected'] = true;
     return $config['tabs'][$selectedTab];
 }
예제 #2
0
 /**
  * Sets the value of a user state variable.
  *
  * @param  string  $stateName   The path of the state.
  * @param  string  $stateValue  The value of the variable.
  * @return mixed                The previous state, if one existed.
  */
 function setUserState($stateName, $stateValue)
 {
     return $this->_baseFramework->setUserState($stateName, $stateValue);
 }
예제 #3
0
 /**
  * Grabs the login form return url and sets it to all available cb login forms on the page
  *
  * @param JApplication $app
  */
 private function setReturnURL($app)
 {
     if (!$this->getUserIsGuest()) {
         return;
     }
     static $cache = 0;
     if (!$cache++) {
         if ($this->params->get('return_urls', 1)) {
             $redirect = $app->getUserState('users.login.form.return', null);
             if (!$redirect) {
                 $data = $app->getUserState('users.login.form.data', array());
                 $redirect = isset($data['return']) ? $data['return'] : null;
                 if ($redirect) {
                     $data['return'] = null;
                     $app->setUserState('users.login.form.data', $data);
                 }
             } else {
                 $app->setUserState('users.login.form.return', null);
             }
             if ($redirect) {
                 $document = JFactory::getDocument();
                 $js = "function cbLoginReturn() {" . "var pageForms = document.forms;" . "if ( pageForms ) for ( i = 0; i < pageForms.length; i++ ) {" . "if ( pageForms[i].id == 'login-form' ) {" . "pageForms[i].return.value = '" . addslashes('B:' . base64_encode($redirect)) . "';" . "}" . "}" . "}" . "if ( window.addEventListener ) {" . "window.addEventListener( 'load', cbLoginReturn, false );" . "} else if ( window.attachEvent ) {" . "window.attachEvent( 'onload', cbLoginReturn );" . "}";
                 $document->addScriptDeclaration($js);
             }
         }
     }
 }