diff --git a/libraries/classes/Display/Export.php b/libraries/classes/Display/Export.php index ab53769201..0e96872b00 100644 --- a/libraries/classes/Display/Export.php +++ b/libraries/classes/Display/Export.php @@ -34,7 +34,7 @@ class Export * * @return string */ - public static function exportCheckboxCheck($str) + private static function exportCheckboxCheck($str) { if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) { return ' checked="checked"'; @@ -165,16 +165,14 @@ class Export } /** - * Returns HTML for the options in teplate dropdown + * Returns HTML for the options in template dropdown * - * @param string $export_type export type - server, database, or table + * @param string $exportType export type - server, database, or table * * @return string HTML for the options in teplate dropdown */ - public static function getOptionsForExportTemplates($export_type) + private static function getOptionsForExportTemplates($exportType) { - $ret = ''; - // Get the relation settings $cfgRelation = Relation::getRelationsParam(); @@ -183,24 +181,25 @@ class Export . Util::backquote($cfgRelation['export_templates']) . " WHERE `username` = " . "'" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) - . "' AND `export_type` = '" . $GLOBALS['dbi']->escapeString($export_type) . "'" + . "' AND `export_type` = '" . $GLOBALS['dbi']->escapeString($exportType) . "'" . " ORDER BY `template_name`;"; $result = Relation::queryAsControlUser($query); - if (!$result) { - return $ret; - } - while ($row = $GLOBALS['dbi']->fetchAssoc($result, DatabaseInterface::CONNECT_CONTROL)) { - $ret .= ''; } - return $ret; + return Template::get('display/export/template_options')->render([ + 'templates' => $templates, + 'selected_template' => !empty($_GET['template_id']) ? $_GET['template_id'] : null, + ]); } /** diff --git a/templates/display/export/template_options.twig b/templates/display/export/template_options.twig new file mode 100644 index 0000000000..ddcd4f5b55 --- /dev/null +++ b/templates/display/export/template_options.twig @@ -0,0 +1,7 @@ + + +{% for template in templates %} + +{% endfor %}