fixed inactivity timeout failure
[openemr.git] / interface / main / myadmin / browse_foreigners.php
blobf18ce72f93a52136b21b885bb24a71befb009891
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Get the variables sent or posted to this script and displays the header
7 */
8 require_once('./libraries/grab_globals.lib.php');
10 /**
11 * Gets a core script and starts output buffering work
13 require_once('./libraries/common.lib.php');
15 PMA_checkParameters(array('db', 'table', 'field'));
17 require_once('./libraries/ob.lib.php');
18 if ($cfg['OBGzip']) {
19 $ob_mode = PMA_outBufferModeGet();
20 if ($ob_mode) {
21 PMA_outBufferPre($ob_mode);
24 require_once('./libraries/header_http.inc.php');
25 $field = urldecode($field);
27 /**
28 * Displays the frame
30 // Gets the font sizes to use
31 PMA_setFontSizes();
33 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
34 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
35 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
37 <head>
38 <title>phpMyAdmin</title>
39 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
40 <base<?php if (!empty($cfg['PmaAbsoluteUri'])) echo ' href="' . $cfg['PmaAbsoluteUri'] . '"'; ?> />
41 <link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&amp;js_frame=right" />
42 <script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
43 <script type="text/javascript" language="javascript">
44 self.focus();
45 function formupdate(field, key) {
46 if (opener && opener.document && opener.document.insertForm && opener.document.insertForm.elements['field_' + field + '<?php echo (isset($pk) ? '[multi_edit][' . $pk . ']' : ''); ?>[]']) {
47 opener.document.insertForm.elements['field_' + field + '<?php echo (isset($pk) ? '[multi_edit][' . $pk . ']' : ''); ?>[]'].value = key;
48 self.close();
49 } else {
50 alert('<?php echo PMA_jsFormat($strWindowNotFound); ?>');
53 </script>
54 </head>
56 <body bgcolor="<?php echo $cfg['LeftBgColor']; ?>" style="margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 0px">
57 <?php
58 $per_page = 200;
59 require_once('./libraries/relation.lib.php'); // foreign keys
60 require_once('./libraries/transformations.lib.php'); // Transformations
61 $cfgRelation = PMA_getRelationsParam();
62 $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
64 $override_total = TRUE;
66 if (!isset($pos)) {
67 $pos = 0;
70 $foreign_limit = 'LIMIT ' . $pos . ', ' . $per_page . ' ';
71 if (isset($foreign_navig) && $foreign_navig == $strShowAll) {
72 unset($foreign_limit);
75 require('./libraries/get_foreign.lib.php');
78 <form action="browse_foreigners.php" method="post">
79 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
80 <input type="hidden" name="field" value="<?php echo urlencode($field); ?>" />
81 <?php
82 if (isset($pk)) {
83 $pk_uri = '&amp;pk=' . $pk;
85 <input type="hidden" name="pk" value="<?php echo $pk; ?>" />
86 <?php
87 } else {
88 $pk_uri = '&amp;';
92 <table width="100%">
93 <?php
94 if ($cfg['ShowAll'] && ($the_total > $per_page)) {
95 $showall = '<input type="submit" name="foreign_navig" value="' . $strShowAll . '" />';
96 } else {
97 $showall = '';
100 $session_max_rows = $per_page;
101 $pageNow = @floor($pos / $session_max_rows) + 1;
102 $nbTotalPage = @ceil($the_total / $session_max_rows);
104 if ($the_total > $per_page) {
105 $gotopage = '<br />' . $GLOBALS['strPageNumber']
106 . '<select name="goToPage" onChange="goToUrl(this, \'browse_foreigners.php?field=' . urlencode($field) . '&amp;' . PMA_generate_common_url($db, $table) . $pk_uri . '\');">';
107 if ($nbTotalPage < 200) {
108 $firstPage = 1;
109 $lastPage = $nbTotalPage;
110 } else {
111 $range = 20;
112 $firstPage = ($pageNow - $range < 1 ? 1 : $pageNow - $range);
113 $lastPage = ($pageNow + $range > $nbTotalPage ? $nbTotalPage : $pageNow + $range);
116 for ($i=$firstPage; $i<=$lastPage; $i++){
117 if ($i == $pageNow) {
118 $selected = 'selected="selected"';
119 } else {
120 $selected = '';
122 $gotopage .= ' <option ' . $selected . ' value="' . (($i - 1) * $session_max_rows) . '">' . $i . '</option>' . "\n";
124 } else {
125 $gotopage = '';
128 $header = ' <tr>
129 <th align="left" nowrap="nowrap">' . $strKeyname . '</th>
130 <th>' . $strDescription . '</th>
131 <td align="center" width="20%" valign="top">
132 ' . $showall . '
133 ' . $gotopage . '
134 </td>
135 <th>' . $strDescription . '</th>
136 <th align="left" nowrap="nowrap">' . $strKeyname . '</th>
137 </tr>';
139 echo $header;
141 if (isset($disp) && $disp) {
142 $count = 0;
143 while ($relrow = @PMA_mysql_fetch_array($disp)) {
144 $count++;
145 $bgcolor = ($count % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
147 $key = $relrow[$foreign_field];
148 if (strlen($relrow[$foreign_display]) <= $cfg['LimitChars']) {
149 $value = (($foreign_display != FALSE) ? htmlspecialchars($relrow[$foreign_display]) : '');
150 $vtitle = '';
151 } else {
152 $vtitle = htmlspecialchars($relrow[$foreign_display]);
153 $value = (($foreign_display != FALSE) ? htmlspecialchars(substr($vtitle, 0, $cfg['LimitChars']) . '...') : '');
156 if ($cfg['RepeatCells'] > 0 && $count > $cfg['RepeatCells']) {
157 echo $header;
158 $count = -1;
160 $key_equals_data = isset($data) && $key == $data;
162 <tr>
163 <td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
164 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
165 <td width="20%"><img src="images/spacer.gif" alt="" width="1" height="1"></td>
166 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . $value . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
167 <td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>"><?php echo ($key_equals_data ? '<b>' : '') . '<a href="#" title="' . $strUseThisValue . ($vtitle != '' ? ': ' . $vtitle : '') . '" onclick="formupdate(\'' . md5($field) . '\', \'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($key) . '</a>' . ($key_equals_data ? '</b>' : ''); ?></td>
168 </tr>
169 <?php
170 unset($key_equals_data);
171 } // end while
174 echo $header;
176 </table>
177 </form>
179 </body>
180 </html>
182 <?php
184 * Close MySql connections
186 if (isset($dbh) && $dbh) {
187 @mysql_close($dbh);
189 if (isset($userlink) && $userlink) {
190 @mysql_close($userlink);
195 * Sends bufferized data
197 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
198 && isset($ob_mode) && $ob_mode) {
199 PMA_outBufferPost($ob_mode);