diff options
-rw-r--r-- | libraries/classes/Display/Export.php | 22 | ||||
-rw-r--r-- | templates/display/export/options_output_charset.twig | 16 |
2 files changed, 20 insertions, 18 deletions
diff --git a/libraries/classes/Display/Export.php b/libraries/classes/Display/Export.php index 7b4e1ce938..f0166fb7f1 100644 --- a/libraries/classes/Display/Export.php +++ b/libraries/classes/Display/Export.php @@ -415,25 +415,11 @@ class Export public static function getHtmlForExportOptionsOutputCharset() { global $cfg; - $html = ' <li><label for="select_charset" class="desc">' - . __('Character set of the file:') . '</label>' . "\n"; - $html .= '<select id="select_charset" name="charset" size="1">'; - foreach (Encoding::listEncodings() as $temp_charset) { - $html .= '<option value="' . $temp_charset . '"'; - if (isset($_GET['charset']) - && ($_GET['charset'] != $temp_charset) - ) { - $html .= ''; - } elseif ((empty($cfg['Export']['charset']) && $temp_charset == 'utf-8') - || $temp_charset == $cfg['Export']['charset'] - ) { - $html .= ' selected="selected"'; - } - $html .= '>' . $temp_charset . '</option>'; - } // end foreach - $html .= '</select></li>'; - return $html; + return Template::get('display/export/options_output_charset')->render([ + 'encodings' => Encoding::listEncodings(), + 'export_charset' => $cfg['Export']['charset'], + ]); } /** diff --git a/templates/display/export/options_output_charset.twig b/templates/display/export/options_output_charset.twig new file mode 100644 index 0000000000..bd316bf916 --- /dev/null +++ b/templates/display/export/options_output_charset.twig @@ -0,0 +1,16 @@ +<li> + <label for="select_charset" class="desc"> + {% trans 'Character set of the file:' %} + </label> + <select id="select_charset" name="charset" size="1"> + {% for charset in encodings %} + <option value="{{ charset }}" + {%- if (export_charset is empty and charset == 'utf-8') + or charset == export_charset %} + selected + {%- endif %}> + {{- charset -}} + </option> + {% endfor %} + </select> +</li> |