private function build_view() { $modules_activated = ModulesManager::get_activated_modules_map_sorted_by_localized_name(); $modules_installed = ModulesManager::get_installed_modules_map_sorted_by_localized_name(); foreach ($modules_installed as $module) { $configuration = $module->get_configuration(); $author = $configuration->get_author(); $author_email = $configuration->get_author_email(); $author_website = $configuration->get_author_website(); if (!in_array($module, $modules_activated)) { $this->view->assign_block_vars('modules_not_activated', array('C_AUTHOR' => !empty($author), 'C_AUTHOR_WEBSITE' => !empty($author_website), 'ID' => $module->get_id(), 'NAME' => ucfirst($configuration->get_name()), 'ICON' => $module->get_id(), 'VERSION' => $module->get_installed_version(), 'AUTHOR' => $author, 'AUTHOR_EMAIL' => $author_email, 'AUTHOR_WEBSITE' => $author_website, 'DESCRIPTION' => $configuration->get_description(), 'COMPATIBILITY' => $configuration->get_compatibility(), 'PHP_VERSION' => $configuration->get_php_version(), 'C_MODULE_ACTIVE' => $module->is_activated())); } else { $this->view->assign_block_vars('modules_activated', array('C_AUTHOR' => !empty($author), 'C_AUTHOR_WEBSITE' => !empty($author_website), 'ID' => $module->get_id(), 'NAME' => ucfirst($configuration->get_name()), 'ICON' => $module->get_id(), 'VERSION' => $module->get_installed_version(), 'AUTHOR' => $author, 'AUTHOR_EMAIL' => $author_email, 'AUTHOR_WEBSITE' => $author_website, 'DESCRIPTION' => $configuration->get_description(), 'COMPATIBILITY' => $configuration->get_compatibility(), 'PHP_VERSION' => $configuration->get_php_version(), 'C_MODULE_ACTIVE' => $module->is_activated())); } } $this->view->put_all(array('C_MODULES_ACTIVATED' => count($modules_activated) > 0, 'C_MODULES_NOT_ACTIVATED' => count($modules_installed) - count($modules_activated) > 0)); }
{ return get_feeds_children($feed_cat->get_children(), $module_id, $feed_type, $feed_url_edit, $level + 1); } function get_feeds_children(array $children, $module_id, $feed_type, $feed_url_edit = '', $level) { if (!empty($children)) { foreach ($children as $id => $feed_cat) { $url = $feed_cat->get_url($feed_type); $urls[] = array('name' => $feed_cat->get_category_name(), 'url' => $url, 'level' => $level, 'feed_name' => $feed_type, 'selected' => $feed_url_edit == $url); } return array_merge($urls, get_feeds_children($feed_cat->get_children(), $module_id, $feed_type, $feed_url_edit, $level + 1)); } return array(); } $feeds_modules = AppContext::get_extension_provider_service()->get_providers(FeedProvider::EXTENSION_POINT); foreach (ModulesManager::get_installed_modules_map_sorted_by_localized_name() as $id => $module) { if (array_key_exists($module->get_id(), $feeds_modules)) { $list = $feeds_modules[$module->get_id()]->get_extension_point(FeedProvider::EXTENSION_POINT); $list = $list->get_feeds_list(); foreach ($list->get_feeds_list() as $feed_type => $object) { $urls = get_feeds($object, $module->get_id(), $feed_type, $feed_url); $root[0] = array('name' => $object->get_category_name(), 'url' => $object->get_url($feed_type), 'level' => 0, 'feed_name' => null, 'selected' => $feed_url == $object->get_url($feed_type)); } $urls = array_merge($root, $urls); $tpl->assign_block_vars('modules', array('NAME' => ucfirst($module->get_configuration()->get_name()))); foreach ($urls as $url) { $tpl->assign_block_vars('modules.feeds_urls', array('URL' => $url['url'], 'NAME' => $url['name'], 'SPACE' => str_repeat('--', $url['level']), 'FEED_NAME' => $url['feed_name'] != 'master' ? $url['feed_name'] : null, 'SELECTED' => $url['selected'] ? ' selected="selected"' : '')); } } } $locations = '';
/** * @desc Adds to the site map all maps of the installed modules * @param int $auth_mode AUTH_GUEST or AUTH_USERS, it depends if you want to display only the public pages or also the private ones. */ private function build_modules_maps($auth_mode = self::AUTH_PUBLIC) { $providers = AppContext::get_extension_provider_service()->get_providers(SitemapExtensionPoint::EXTENSION_POINT); foreach (ModulesManager::get_installed_modules_map_sorted_by_localized_name() as $id => $module) { if (array_key_exists($module->get_id(), $providers)) { $sitemap_provider = $providers[$module->get_id()]->sitemap(); if ($auth_mode == self::AUTH_PUBLIC) { $module_map = $sitemap_provider->get_public_sitemap(); } else { $module_map = $sitemap_provider->get_user_sitemap(); } $this->add($module_map); } } }
private function list_modules_home_page() { $providers = array_keys(AppContext::get_extension_provider_service()->get_providers(HomePageExtensionPoint::EXTENSION_POINT)); $options = array(new FormFieldSelectChoiceOption($this->lang['general-config.other_start_page'], 'other')); $installed_modules = ModulesManager::get_installed_modules_map_sorted_by_localized_name(); foreach ($installed_modules as $id => $module) { if (in_array($module->get_id(), $providers)) { $options[] = new FormFieldSelectChoiceOption($module->get_configuration()->get_name(), $module->get_id()); } } if (empty($options)) { $options[] = new FormFieldSelectChoiceOption($this->lang['no_module_starteable'], ''); } return $options; }
private function build_select() { $extensions_point = array_keys(CommentsProvidersService::get_extension_point()); $modules = array(new FormFieldSelectChoiceOption(LangLoader::get_message('view_all_comments', 'admin'), '')); foreach (ModulesManager::get_installed_modules_map_sorted_by_localized_name() as $module) { if (in_array($module->get_id(), $extensions_point)) { $modules[] = new FormFieldSelectChoiceOption($module->get_configuration()->get_name(), $module->get_id()); } } return $modules; }
/** * Returns all the unauthorized search providers ids (unauthorized in search config and module not authorized for reading) * @return string[] The unauthorized search providers ids */ public function get_all_unauthorized_providers() { $modules_without_read_authorization[] = array(); foreach (ModulesManager::get_installed_modules_map_sorted_by_localized_name() as $id => $module) { $authorizations_class = ucfirst($module->get_id()) . 'AuthorizationsService'; if (class_exists($authorizations_class) && method_exists($authorizations_class, 'check_authorizations') && method_exists($authorizations_class, 'read') && !$authorizations_class::check_authorizations()->read()) { $modules_without_read_authorization[] = $module->get_id(); } } return array_merge($this->get_property(self::unauthorized_providers), $modules_without_read_authorization); }