/** * Generates the list of available Export Types in tab format. * * @param array $params * @param object $smarty */ function smarty_function_export_type_tabs($params, &$smarty) { $defaultExportType = Core::getDefaultExportType(); $exportTypes = Core::$exportTypePlugins; echo "<ul>"; foreach ($exportTypes as $exportType) { $name = $exportType->getName(); $exportTypeClass = get_class($exportType); $class = $defaultExportType == $exportTypeClass ? "gdSelected gdDefaultExportType" : ""; $exportTargets = implode(",", $exportType->getCompatibleExportTargets()); echo "<li data-export-type=\"{$exportTypeClass}\" data-compatible-export-targets=\"{$exportTargets}\" id=\"gdExportType_{$exportTypeClass}\" class=\"{$class}\">{$name}</li>"; } echo "</ul>"; }
/** * With 3.2.2, users can now customize the plugins they want to use, so Core::getDefaultExportType() is no longer * sufficient to figure out what tab should be selected in the UI on page load. This is now used instead. */ public function getDefaultExportType() { $defaultExportType = Core::getDefaultExportType(); $exportTypes = $this->getExportTypePlugins(); // if the default export type isn't selected for this particular user, select the first in the list. Assumption // if that there's always at least one Export Type $found = false; foreach ($exportTypes as $exportType) { $exportTypeClass = get_class($exportType); if ($exportTypeClass == $defaultExportType) { $found = true; break; } } if (!$found) { $defaultExportType = get_class($exportTypes[0]); } return $defaultExportType; }
$exportTypeJSModules = ExportTypePluginHelper::getExportTypeJSResources($exportTypes, "string"); $exportTypeCssIncludes = ExportTypePluginHelper::getExportTypeCSSIncludes($exportTypes); $dataTypeJSModules = DataTypePluginHelper::getDataTypeJSResources($dataTypes, "string"); $dataTypeCssIncludes = DataTypePluginHelper::getDataTypeCSSIncludes($dataTypes); $cssIncludes = $exportTypeCssIncludes . "\n" . $dataTypeCssIncludes; // used in the settings page $pageParams["allCountryPlugins"] = Core::$countryPlugins; $pageParams["allExportTypes"] = $exportTypes; $pageParams["allDataTypes"] = $dataTypes; $pageParams["allTranslations"] = Core::$translations->getList(); $useMinifiedResources = Core::isUsingMinifiedResources(); $pageParams["useMinifiedResources"] = $useMinifiedResources; if ($useMinifiedResources) { $pageParams["minifiedResourcePaths"] = Minification::getMinifiedResourcePaths(); } $pageParams["dataTypeJSModules"] = $dataTypeJSModules; $pageParams["exportTypeJSModules"] = $exportTypeJSModules; $pageParams["exportTypeAdditionalSettings"] = $exportTypeAdditionalSettings; $pageParams["settings"] = $settings; $pageParams["cssIncludes"] = $cssIncludes; $pageParams["codeMirrorIncludes"] = ExportTypePluginHelper::getExportTypeCodeMirrorModes($exportTypes); $pageParams["defaultExportType"] = Core::getDefaultExportType(); $pageParams["defaultNumRows"] = Core::getDefaultNumRows(); if (Core::checkIsLoggedIn()) { $pageParams["isLoggedIn"] = true; $pageParams["accountType"] = Core::$user->getAccountType(); } else { $pageParams["isLoggedIn"] = false; $pageParams["accountType"] = ""; } Templates::displayPage("resources/templates/index.tpl", $pageParams);