Convert Excel column name correctly
[phpmyadmin/arisferyanto.git] / libraries / tbl_links.inc.php
blob47315010ed59a712e32e06f80fd13f87ef5f82ca
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Check parameters
15 require_once './libraries/common.inc.php';
17 PMA_checkParameters(array('db', 'table'));
19 /**
20 * Prepares links
22 require_once './libraries/bookmark.lib.php';
25 /**
26 * Set parameters for links
28 $url_params = array();
29 $url_params['db'] = $db;
30 $url_params['table'] = $table;
32 /**
33 * Defines the urls to return to in case of error in a sql statement
35 $err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url(array('db' => $db,));
36 $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url($url_params);
38 /**
39 * Displays headers
41 $GLOBALS['js_include'][] = 'functions.js';
42 require_once './libraries/header.inc.php';
44 /**
45 * Displays links
47 $tabs = array();
49 $tabs['browse']['icon'] = 'b_browse.png';
50 $tabs['browse']['text'] = $strBrowse;
51 $tabs['browse']['link'] = 'sql.php';
52 $tabs['browse']['args']['pos'] = 0;
54 $tabs['structure']['icon'] = 'b_props.png';
55 $tabs['structure']['link'] = 'tbl_structure.php';
56 $tabs['structure']['text'] = $strStructure;
58 $tabs['sql']['icon'] = 'b_sql.png';
59 $tabs['sql']['link'] = 'tbl_sql.php';
60 $tabs['sql']['text'] = $strSQL;
62 $tabs['search']['icon'] = 'b_search.png';
63 $tabs['search']['text'] = $strSearch;
64 $tabs['search']['link'] = 'tbl_select.php';
66 if(PMA_Tracker::isActive())
68 $tabs['tracking']['icon'] = 'eye.png';
69 $tabs['tracking']['text'] = $strTracking;
70 $tabs['tracking']['link'] = 'tbl_tracking.php';
73 if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
74 $tabs['insert']['icon'] = 'b_insrow.png';
75 $tabs['insert']['link'] = 'tbl_change.php';
76 $tabs['insert']['text'] = $strInsert;
79 $tabs['export']['icon'] = 'b_tblexport.png';
80 $tabs['export']['link'] = 'tbl_export.php';
81 $tabs['export']['args']['single_table'] = 'true';
82 $tabs['export']['text'] = $strExport;
84 /**
85 * Don't display "Import", "Operations" and "Empty"
86 * for views and information_schema
88 if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema)) {
89 $tabs['import']['icon'] = 'b_tblimport.png';
90 $tabs['import']['link'] = 'tbl_import.php';
91 $tabs['import']['text'] = $strImport;
93 $tabs['operation']['icon'] = 'b_tblops.png';
94 $tabs['operation']['link'] = 'tbl_operations.php';
95 $tabs['operation']['text'] = $strOperations;
97 $tabs['empty']['link'] = 'sql.php';
98 $tabs['empty']['args']['reload'] = 1;
99 $tabs['empty']['args']['sql_query'] = 'TRUNCATE TABLE ' . PMA_backquote($table);
100 $tabs['empty']['args']['zero_rows'] = sprintf($strTableHasBeenEmptied, htmlspecialchars($table));
101 $tabs['empty']['attr'] = 'onclick="return confirmLink(this, \'TRUNCATE TABLE ' . PMA_jsFormat($table) . '\')"';
102 $tabs['empty']['args']['goto'] = 'tbl_structure.php';
103 $tabs['empty']['class'] = 'caution';
104 $tabs['empty']['icon'] = 'b_empty.png';
105 $tabs['empty']['text'] = $strEmpty;
106 if ($table_info_num_rows == 0) {
107 $tabs['empty']['warning'] = $strTableIsEmpty;
112 * no drop in information_schema
114 if (! (isset($db_is_information_schema) && $db_is_information_schema)) {
115 $tabs['drop']['icon'] = 'b_deltbl.png';
116 $tabs['drop']['link'] = 'sql.php';
117 $tabs['drop']['url_params'] = array('table' => NULL);
118 $tabs['drop']['text'] = $strDrop;
119 $tabs['drop']['args']['reload'] = 1;
120 $tabs['drop']['args']['purge'] = 1;
121 $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE');
122 $tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table);
123 $tabs['drop']['args']['goto'] = 'db_structure.php';
124 $tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table));
125 $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"';
126 unset($drop_command);
127 $tabs['drop']['class'] = 'caution';
130 if ($table_info_num_rows == 0 && !$tbl_is_view) {
131 $tabs['browse']['warning'] = $strTableIsEmpty;
132 $tabs['search']['warning'] = $strTableIsEmpty;
135 echo PMA_generate_html_tabs($tabs, $url_params);
136 unset($tabs);
138 if(PMA_Tracker::isActive() and PMA_Tracker::isTracked($GLOBALS["db"], $GLOBALS["table"]))
140 $msg = PMA_Message::notice('<a href="tbl_tracking.php?'.$url_query.'">'.sprintf($strTrackingActivated, $GLOBALS["db"], $GLOBALS["table"]).'</a>');
141 $msg->display();
145 * Displays a message
147 if (!empty($message)) {
148 PMA_showMessage($message);
149 unset($message);