diff --git a/libraries/classes/Display/Export.php b/libraries/classes/Display/Export.php index ab53769201..ecd6420e5c 100644 --- a/libraries/classes/Display/Export.php +++ b/libraries/classes/Display/Export.php @@ -32,15 +32,12 @@ class Export * * @param string $str option name * - * @return string + * @return boolean */ - public static function exportCheckboxCheck($str) + private static function checkboxCheck($str) { - if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) { - return ' checked="checked"'; - } - - return null; + return isset($GLOBALS['cfg']['Export'][$str]) + && $GLOBALS['cfg']['Export'][$str]; } /** @@ -165,16 +162,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 +178,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, + ]); } /** @@ -212,194 +208,87 @@ class Export { global $cfg; if (isset($_GET['quick_or_custom'])) { - $export_method = $_GET['quick_or_custom']; + $exportMethod = $_GET['quick_or_custom']; } else { - $export_method = $cfg['Export']['method']; + $exportMethod = $cfg['Export']['method']; } - if ($export_method == 'custom-no-form') { - return ''; - } - - $html = '
'; - $html .= '

' . __('Export method:') . '

'; - $html .= '