Fix for the Open in New Window in Patient/Client->Patients search gui, take 2.
[openemr.git] / phpmyadmin / libraries / display_select_lang.lib.php
blob70c319ab0d64ac09f8eccf9fd7c2d9afa6bd69cf
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Code for displaying language selection
6 * @version $Id$
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Sorts available languages by their true english names
15 * @param array the array to be sorted
16 * @param mixed a required parameter
17 * @return the sorted array
18 * @access private
20 function PMA_language_cmp(&$a, &$b) {
21 return (strcmp($a[1], $b[1]));
22 } // end of the 'PMA_language_cmp()' function
24 /**
25 * Displays for for language selection
27 * @access public
29 function PMA_select_language($use_fieldset = FALSE, $show_doc = TRUE) {
30 global $cfg, $lang;
33 <form method="post" action="index.php" target="_parent">
34 <?php
35 if (isset($GLOBALS['collation_connection'])) {
36 echo ' <input type="hidden" name="collation_connection" value="'
37 . htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n";
39 if (isset($GLOBALS['convcharset'])) {
40 echo ' <input type="hidden" name="convcharset" value="'
41 . htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n";
43 if (strlen($GLOBALS['db'])) {
44 echo ' <input type="hidden" name="db" value="'
45 . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
47 if (strlen($GLOBALS['table'])) {
48 echo ' <input type="hidden" name="table" value="'
49 . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
51 if (isset($GLOBALS['server'])) {
52 echo ' <input type="hidden" name="server" value="'
53 . ((int)$GLOBALS['server']) . '" />' . "\n";
56 // For non-English, display "Language" with emphasis because it's
57 // not a proper word in the current language; we show it to help
58 // people recognize the dialog
59 $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - <em>Language</em>' : '');
60 if ($show_doc) {
61 $language_title .= ' <a href="./translators.html" target="documentation">' .
62 ($cfg['ReplaceHelpImg'] ?
63 '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' :
64 '(*)') . '</a>';
66 if ($use_fieldset) {
67 echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
68 } else {
69 echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
73 <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
74 <?php
76 uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
77 foreach ($GLOBALS['available_languages'] AS $id => $tmplang) {
78 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
80 // Include native name if non empty
81 if (!empty($tmplang[3])) {
82 $lang_name = $tmplang[3] . ' - '
83 . $lang_name;
86 // Include charset if it makes sense
87 if (!defined('PMA_REMOVED_NON_UTF_8')) {
88 $lang_name .= ' (' . substr($id, strpos($id, '-') + 1) . ')';
91 //Is current one active?
92 if ($lang == $id) {
93 $selected = ' selected="selected"';
94 } else {
95 $selected = '';
98 echo ' ';
99 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
100 . '</option>' . "\n";
104 </select>
105 <?php
106 if ($use_fieldset) {
107 echo '</fieldset>';
111 <noscript>
112 <?php
113 if ($use_fieldset) {
114 echo '<fieldset class="tblFooters">';
118 <input type="submit" value="Go" />
119 <?php
120 if ($use_fieldset) {
121 echo '</fieldset>';
125 </noscript>
126 </form>
127 <?php
128 } // End of function PMA_select_language