Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: tbl_properties_links.inc.php,v 1.6 2006/01/17 17:02:31 cybot_tm Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4  
5 // Check parameters
6  
7 require_once('./libraries/common.lib.php');
8  
9 PMA_checkParameters(array('db', 'table'));
10  
11 /**
12 * Prepares links
13 */
14 require_once('./libraries/bookmark.lib.php');
15  
16  
17 /**
18 * Set parameters for links
19 */
20 if (empty($url_query)) {
21 $url_query = PMA_generate_common_url($db, $table);
22 }
23 $url_params['db'] = $db;
24 $url_params['table'] = $table;
25  
26 /**
27 * Defines the urls to return to in case of error in a sql statement
28 */
29 $err_url_0 = $cfg['DefaultTabDatabase'] . PMA_generate_common_url( array( 'db' => $db, ) );
30 $err_url = $cfg['DefaultTabTable'] . PMA_generate_common_url( $url_params );
31  
32 /**
33 * Displays headers
34 */
35 $js_to_run = 'functions.js';
36 require_once('./libraries/header.inc.php');
37  
38 /**
39 * Displays links
40 */
41 $tabs = array();
42  
43 $tabs['browse']['icon'] = 'b_browse.png';
44 $tabs['browse']['text'] = $strBrowse;
45  
46 $tabs['structure']['icon'] = 'b_props.png';
47 $tabs['structure']['link'] = 'tbl_properties_structure.php';
48 $tabs['structure']['text'] = $strStructure;
49  
50 $tabs['sql']['icon'] = 'b_sql.png';
51 $tabs['sql']['link'] = 'tbl_properties.php';
52 $tabs['sql']['text'] = $strSQL;
53  
54 $tabs['search']['icon'] = 'b_search.png';
55 $tabs['search']['text'] = $strSearch;
56  
57 if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) {
58 $tabs['insert']['icon'] = 'b_insrow.png';
59 $tabs['insert']['link'] = 'tbl_change.php';
60 $tabs['insert']['text'] = $strInsert;
61 }
62  
63 $tabs['export']['icon'] = 'b_tblexport.png';
64 $tabs['export']['link'] = 'tbl_properties_export.php';
65 $tabs['export']['args']['single_table'] = 'true';
66 $tabs['export']['text'] = $strExport;
67  
68 /**
69 * Don't display "Import", "Operations" and "Empty"
70 * for views and information_schema
71 */
72 if ( ! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_schema )) {
73 $tabs['import']['icon'] = 'b_tblimport.png';
74 $tabs['import']['link'] = 'tbl_import.php';
75 $tabs['import']['text'] = $strImport;
76  
77 $tabs['operation']['icon'] = 'b_tblops.png';
78 $tabs['operation']['link'] = 'tbl_properties_operations.php';
79 $tabs['operation']['text'] = $strOperations;
80  
81 if ($table_info_num_rows > 0) {
82 $ln8_stt = (PMA_MYSQL_INT_VERSION >= 40000)
83 ? 'TRUNCATE TABLE '
84 : 'DELETE FROM ';
85 $tabs['empty']['link'] = 'sql.php';
86 $tabs['empty']['args']['sql_query'] = $ln8_stt . PMA_backquote($table);
87 $tabs['empty']['args']['zero_rows'] = sprintf($strTableHasBeenEmptied, htmlspecialchars($table));
88 $tabs['empty']['attr'] = 'onclick="return confirmLink(this, \'' . $ln8_stt . PMA_jsFormat($table) . '\')"';
89 $tabs['empty']['args']['goto'] = 'tbl_properties_structure.php';
90 $tabs['empty']['class'] = 'caution';
91 }
92 $tabs['empty']['icon'] = 'b_empty.png';
93 $tabs['empty']['text'] = $strEmpty;
94 }
95  
96 /**
97 * no drop in information_schema
98 */
99 if ( ! (isset($db_is_information_schema) && $db_is_information_schema) ) {
100 $tabs['drop']['icon'] = 'b_deltbl.png';
101 $tabs['drop']['link'] = 'sql.php';
102 $tabs['drop']['text'] = $strDrop;
103 $tabs['drop']['args']['reload'] = 1;
104 $tabs['drop']['args']['purge'] = 1;
105 $drop_command = 'DROP ' . ($tbl_is_view ? 'VIEW' : 'TABLE');
106 $tabs['drop']['args']['sql_query'] = $drop_command . ' ' . PMA_backquote($table);
107 $tabs['drop']['args']['goto'] = 'db_details_structure.php';
108 $tabs['drop']['args']['zero_rows'] = sprintf(($tbl_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table));
109 $tabs['drop']['attr'] = 'onclick="return confirmLink(this, \'' . $drop_command . ' ' . PMA_jsFormat($table) . '\')"';
110 unset($drop_command);
111 $tabs['drop']['class'] = 'caution';
112 }
113  
114 if ($table_info_num_rows > 0 || $tbl_is_view) {
115 $tabs['browse']['link'] = 'sql.php';
116 $tabs['browse']['args']['pos'] = 0;
117 $tabs['search']['link'] = 'tbl_select.php';
118 }
119  
120 echo PMA_getTabs( $tabs );
121 unset( $tabs );
122  
123 /**
124 * Displays a message
125 */
126 if (!empty($message)) {
127 PMA_showMessage($message);
128 unset($message);
129 }
130  
131 ?><br />