diff options
author | Casiva Agustin <casivaagustin@gmail.com> | 2012-05-03 02:33:53 +0400 |
---|---|---|
committer | Casiva Agustin <casivaagustin@gmail.com> | 2012-05-03 02:33:53 +0400 |
commit | 20de7a00117e723326287e444c3cf8de339bf2ce (patch) | |
tree | a9d279715a2b18b3f42346e4daa1501908b735b9 /db_tables_search.php | |
parent | 9a00dafc0482b560bc98f571eacc76ce91f90ace (diff) |
Add Ajax suport to Fast filter in order to search the term in all database tables
Diffstat (limited to 'db_tables_search.php')
-rw-r--r-- | db_tables_search.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/db_tables_search.php b/db_tables_search.php new file mode 100644 index 0000000000..87b8fe2700 --- /dev/null +++ b/db_tables_search.php @@ -0,0 +1,51 @@ +<?php + +/* vim: set expandtab sw=4 ts=4 sts=4: */ + +require_once 'libraries/common.inc.php'; +require_once 'libraries/common.lib.php'; + +$db = $_GET['db']; +$table_term = $_GET['table']; +$common_url_query = PMA_generate_common_url($GLOBALS['db']); +$tables_full = PMA_getTableList($db); +$tables_response = array(); + +foreach ($tables_full as $key => $table) { + if (strpos($key, $table_term) !== FALSE) { + $link = '<li class="ajax_table"><a class="tableicon" title="' + . htmlspecialchars($link_title) + . ': ' . htmlspecialchars($table['Comment']) + . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')"' + . ' id="quick_' . htmlspecialchars($table_db . '.' . $table['Name']) . '"' + . ' href="' . $GLOBALS['cfg']['LeftDefaultTabTable'] . '?' + . $common_url_query + . '&table=' . urlencode($table['Name']) + . '&goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'] + . '" >'; + $attr = array('id' => 'icon_' . htmlspecialchars($table_db . '.' . $table['Name'])); + if (PMA_Table::isView($table_db, $table['Name'])) { + $link .= PMA_getImage('s_views.png', htmlspecialchars($link_title), $attr); + } else { + $link .= PMA_getImage('b_browse.png', htmlspecialchars($link_title), $attr); + } + $link .= '</a>'; + // link for the table name itself + $href = $GLOBALS['cfg']['DefaultTabTable'] . '?' + . $common_url_query . '&table=' + . urlencode($table['Name']) . '&pos=0'; + $link .= '<a href="' . $href . '" title="' + . htmlspecialchars( + PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . ': ' . $table['Comment'] + . ' (' . PMA_formatNumber($table['Rows'], 0) . ' ' . __('Rows') . ')' + ) + . '" id="' . htmlspecialchars($table_db . '.' . $table['Name']) . '">' + // preserve spaces in table name + . str_replace(' ', ' ', htmlspecialchars($table['disp_name'])) . '</a>'; + $link .= '</li>' . "\n"; + $table['line'] = $link; + $tables_response[] = $table; + } +} + +PMA_ajaxResponse('', true, array('tables' => $tables_response));
\ No newline at end of file |