Another Acknowledgements page update (fix for previous commit)
[openemr.git] / phpmyadmin / libraries / tbl_links.inc.php
blob85e515d6c05eb02bf6843465022ca0c613032fe3
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 /**
12 * Check parameters
14 require_once './libraries/common.inc.php';
16 PMA_checkParameters(array('db', 'table'));
18 /**
19 * Prepares links
21 require_once './libraries/bookmark.lib.php';
24 /**
25 * Set parameters for links
27 if (empty($url_query)
28 || (isset($_POST['table']) && isset($_POST['new_name']) && $_POST['table'] != $_POST['new_name'])) {
29 $url_query = PMA_generate_common_url($db, $table);
31 $url_params['db'] = $db;
32 $url_params['table'] = $table;
34 /**
35 * Defines the urls to return to in case of error in a sql statement
37 $err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,));
38 $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
40 /**
41 * Displays headers
43 $js_to_run = 'functions.js';
44 require_once './libraries/header.inc.php';
46 /**
47 * Displays links
49 $tabs = array();
51 $tabs['browse']['icon'] = 'b_browse.png';
52 $tabs['browse']['text'] = $strBrowse;
53 $tabs['browse']['link'] = 'sql.php';
54 $tabs['browse']['args']['pos'] = 0;
56 $tabs['structure']['icon'] = 'b_props.png';
57 $tabs['structure']['link'] = 'tbl_structure.php';
58 $tabs['structure']['text'] = $strStructure;
60 $tabs['sql']['icon'] = 'b_sql.png';
61 $tabs['sql']['link'] = 'tbl_sql.php';
62 $tabs['sql']['text'] = $strSQL;
64 $tabs['search']['icon'] = 'b_search.png';
65 $tabs['search']['text'] = $strSearch;
66 $tabs['search']['link'] = 'tbl_select.php';
68 if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
69 $tabs['insert']['icon'] = 'b_insrow.png';
70 $tabs['insert']['link'] = 'tbl_change.php';
71 $tabs['insert']['text'] = $strInsert;
74 $tabs['export']['icon'] = 'b_tblexport.png';
75 $tabs['export']['link'] = 'tbl_export.php';
76 $tabs['export']['args']['single_table'] = 'true';
77 $tabs['export']['text'] = $strExport;
79 /**
80 * Don't display "Import", "Operations" and "Empty"
81 * for views and information_schema
83 if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
84 $tabs['import']['icon'] = 'b_tblimport.png';
85 $tabs['import']['link'] = 'tbl_import.php';
86 $tabs['import']['text'] = $strImport;
88 $tabs['operation']['icon'] = 'b_tblops.png';
89 $tabs['operation']['link'] = 'tbl_operations.php';
90 $tabs['operation']['text'] = $strOperations;
92 $ln8_stt = (PMA_MYSQL_INT_VERSION >= 40000)
93 ? 'TRUNCATE TABLE '
94 : 'DELETE FROM ';
95 $tabs['empty']['link'] = 'sql.php';
96 $tabs['empty']['args']['reload'] = 1;
97 $tabs['empty']['args']['sql_query'] = $ln8_stt . PMA_backquote($table);
98 $tabs['empty']['args']['zero_rows'] = sprintf($strTableHasBeenEmptied, htmlspecialchars($table));
99 $tabs['empty']['attr'] = 'onclick="return confirmLink(this, \'' . $ln8_stt . PMA_jsFormat($table) . '\')"';
100 $tabs['empty']['args']['goto'] = 'tbl_structure.php';
101 $tabs['empty']['class'] = 'caution';
102 $tabs['empty']['icon'] = 'b_empty.png';
103 $tabs['empty']['text'] = $strEmpty;
104 if ($table_info_num_rows == 0) {
105 $tabs['empty']['warning'] = $strTableIsEmpty;
110 * no drop in information_schema
112 if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
113 $tabs['drop']['icon'] = 'b_deltbl.png';
114 $tabs['drop']['link'] = 'sql.php';
115 $tabs['drop']['text'] = $strDrop;
116 $tabs['drop']['args']['reload'] = 1;
117 $tabs['drop']['args']['purge'] = 1;
118 $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE');
119 $tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table);
120 $tabs['drop']['args']['goto'] = 'db_structure.php';
121 $tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table));
122 $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"';
123 unset($drop_command);
124 $tabs['drop']['class'] = 'caution';
127 if ($table_info_num_rows == 0 && !$tbl_is_view) {
128 $tabs['browse']['warning'] = $strTableIsEmpty;
129 $tabs['search']['warning'] = $strTableIsEmpty;
132 echo PMA_getTabs($tabs);
133 unset($tabs);
136 * Displays a message
138 if (!empty($message)) {
139 PMA_showMessage($message);
140 unset($message);
143 ?><br />