diff options
author | Atul Pratap Singh <atulpratapsingh05@gmail.com> | 2012-07-05 22:30:12 +0400 |
---|---|---|
committer | Atul Pratap Singh <atulpratapsingh05@gmail.com> | 2012-07-05 22:30:12 +0400 |
commit | f5d15946f3d02156d86f50a63fd521de746d0bea (patch) | |
tree | e7a47d346e6734050ac92a1284d7253ddc20a59b /db_qbe.php | |
parent | 4ce4dee2da0ad39906664d1721b19460c7853302 (diff) |
Form function to display tables select list
Diffstat (limited to 'db_qbe.php')
-rw-r--r-- | db_qbe.php | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/db_qbe.php b/db_qbe.php index efe1ab29d0..6e8d9b6823 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -454,6 +454,39 @@ function PMA_dbQbeGetTableFooters() return $html_output; } +/** + * Provides a select list of database tables + * + * @param array $table_names Names of all the tables + * + * @return HTML for table select list + */ +function PMA_dbQbeGetTablesList($table_names) +{ + $html_output = '<div class="floatleft">'; + $html_output .= '<fieldset>'; + $html_output .= '<legend>' . __('Use Tables') . '</legend>'; + // Build the options list for each table name + $options = ''; + $numTableListOptions = 0; + foreach ($table_names as $key => $val) { + $options .= '<option value="' . htmlspecialchars($key) . '"' . $val . '>' + . (str_replace(' ', ' ', htmlspecialchars($key))) . '</option>'; + $numTableListOptions++; + } + $html_output .= '<select name="TableList[]" multiple="multiple" id="listTable"' + . ' size="' . (($numTableListOptions > 30) ? '15' : '7') . '">'; + $html_output .= $options; + $html_output .= '</select>'; + $html_output .= '</fieldset>'; + $html_output .= '<fieldset class="tblFooters">'; + $html_output .= '<input type="submit" name="modify" value="' + . __('Update Query') . '" />'; + $html_output .= '</fieldset>'; + $html_output .= '</div>'; + return $html_output; +} + if ($cfgRelation['designerwork']) { $url = 'pmd_general.php' . PMA_generate_common_url( array_merge( @@ -720,8 +753,6 @@ for ($x = 0; $x < $col; $x++) { ?> </tr> </table> - -<!-- Other controls --> <?php $w--; $url_params['db'] = $db; @@ -733,33 +764,11 @@ echo PMA_generate_common_hidden_inputs($url_params); <?php echo PMA_dbQbeGetTableFooters(); +echo PMA_dbQbeGetTablesList($tbl_names); ?> <div class="floatleft"> <fieldset> - <legend><?php echo __('Use Tables'); ?></legend> -<?php -$options = ''; -$numTableListOptions = 0; -foreach ($tbl_names as $key => $val) { - $options .= ' '; - $options .= '<option value="' . htmlspecialchars($key) . '"' . $val . '>' - . str_replace(' ', ' ', htmlspecialchars($key)) . '</option>' . "\n"; - $numTableListOptions++; -} -?> - <select name="TableList[]" multiple="multiple" id="listTable" - size="<?php echo ($numTableListOptions > 30) ? '15' : '7'; ?>"> - <?php echo $options; ?> - </select> - </fieldset> - <fieldset class="tblFooters"> - <input type="submit" name="modify" value="<?php echo __('Update Query'); ?>" /> - </fieldset> -</div> - -<div class="floatleft"> - <fieldset> <legend><?php echo sprintf(__('SQL query on database <b>%s</b>:'), $common_functions->getDbLink($db)); ?> </legend> <textarea cols="80" name="sql_query" id="textSqlquery" |