Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 470 lines (431 sloc) 16.17 kb
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Handles table zoom search tab
5 *
6 * display table zoom search form, create SQL queries from form data
7 *
8 */
9
10 /**
11 * Gets some core libraries
12 */
13 require_once './libraries/common.inc.php';
14 require_once './libraries/mysql_charsets.lib.php';
91d372f @ammaryasir Added a library file for the table-search and zoom-search code
ammaryasir authored
15 require_once './libraries/tbl_select.lib.php';
eaea003 @ammaryasir Added some features
ammaryasir authored
16 require_once './libraries/relation.lib.php';
03a1a84 @ammaryasir Test
ammaryasir authored
17 require_once './libraries/tbl_info.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
18
eaea003 @ammaryasir Added some features
ammaryasir authored
19 $GLOBALS['js_include'][] = 'makegrid.js';
20 $GLOBALS['js_include'][] = 'sql.js';
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored
21 $GLOBALS['js_include'][] = 'functions.js';
1653fd3 @ammaryasir Plot functionality using Hihcharts
ammaryasir authored
22 $GLOBALS['js_include'][] = 'tbl_zoom_plot.js';
7a821c8 @ammaryasir Improved the panning feature
ammaryasir authored
23 $GLOBALS['js_include'][] = 'date.js';
ed98d7e @ammaryasir Added: Mousewheel zoom and panning feature
ammaryasir authored
24 $GLOBALS['js_include'][] = 'jquery/jquery.mousewheel.js';
1653fd3 @ammaryasir Plot functionality using Hihcharts
ammaryasir authored
25 $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
26 /* Files required for chart exporting */
e09759b @ammaryasir Added support for ploting strings(char,varchar,enums)
ammaryasir authored
27 $GLOBALS['js_include'][] = 'highcharts/exporting.js';
1653fd3 @ammaryasir Plot functionality using Hihcharts
ammaryasir authored
28 $GLOBALS['js_include'][] = 'canvg/canvg.js';
4a5cb00 @Crack Fix jQuery UI version number
Crack authored
29 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
30 $GLOBALS['js_include'][] = 'jquery/timepicker.js';
31
c7cef3b @ammaryasir Refactored the tbl_select.php and tbl_zoom_select.php code in libraries/...
ammaryasir authored
32
6f619e4 @nijel Whitespace cleanup
nijel authored
33 /**
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount of ...
ammaryasir authored
34 * Handle AJAX request for data row on point select
35 * @var post_params Object containing parameters for the POST request
36 */
37
38 if (isset($_REQUEST['get_data_row']) && $_REQUEST['get_data_row'] == true) {
6f619e4 @nijel Whitespace cleanup
nijel authored
39 $extra_data = array();
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
40 $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`'
41 . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause'];
42 $result = PMA_DBI_query($row_info_query . ";", null, PMA_DBI_QUERY_STORE);
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount of ...
ammaryasir authored
43 $fields_meta = PMA_DBI_get_fields_meta($result);
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
44 while ($row = PMA_DBI_fetch_assoc($result)) {
e71182b @madhuracj Convert bit values to printable form
madhuracj authored
45 // for bit fields we need to convert them to printable form
46 $i = 0;
47 foreach ($row as $col => $val) {
48 if ($fields_meta[$i]->type == 'bit') {
49 $row[$col] = PMA_printable_bit_value($val, $fields_meta[$i]->length);
50 }
51 $i++;
52 }
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
53 $extra_data['row_info'] = $row;
54 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
55 PMA_ajaxResponse(null, true, $extra_data);
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount of ...
ammaryasir authored
56 }
57
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
58 /**
59 * Handle AJAX request for changing field information(value,collation,operators,field values)
60 * in input form
61 * @var post_params Object containing parameters for the POST request
62 */
63
64 if (isset($_REQUEST['change_tbl_info']) && $_REQUEST['change_tbl_info'] == true) {
65 $extra_data = array();
66 $field = $_REQUEST['field'];
e482a94 @ruleant improve coding style
ruleant authored
67 if ($field == 'pma_null') {
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
68 $extra_data['field_type'] = '';
69 $extra_data['field_collation'] = '';
70 $extra_data['field_operators'] = '';
e482a94 @ruleant improve coding style
ruleant authored
71 PMA_ajaxResponse(null, true, $extra_data);
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
72 }
73
74
75 // Gets the list and number of fields
e482a94 @ruleant improve coding style
ruleant authored
76 list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($_REQUEST['db'], $_REQUEST['table']);
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
77
78 $foreigners = PMA_getForeigners($db, $table);
79 $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
e482a94 @ruleant improve coding style
ruleant authored
80 $key = array_search($field, $fields_list);
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
81 $extra_data['field_type'] = $fields_type[$key];
82 $extra_data['field_collation'] = $fields_collation[$key];
83
84 // HTML for operators
85 $html = '<select name="zoomFunc[]">';
86 if (strncasecmp($fields_type[$key], 'enum', 4) == 0) {
87 foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
88 $html .= "\n" . ' '
e482a94 @ruleant improve coding style
ruleant authored
89 . '<option value="' . htmlspecialchars($fc) . '">'
90 . htmlspecialchars($fc) . '</option>';
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
91 }
92 } elseif (preg_match('@char|blob|text|set@i', $fields_type[$key])) {
e482a94 @ruleant improve coding style
ruleant authored
93 foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
94 $html .= "\n" . ' '
95 . '<option value="' . htmlspecialchars($fc) . '">'
96 . htmlspecialchars($fc) . '</option>';
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
97 }
98 } else {
e482a94 @ruleant improve coding style
ruleant authored
99 foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
100 $html .= "\n" . ' '
101 . '<option value="' . htmlspecialchars($fc) . '">'
102 . htmlspecialchars($fc) . '</option>';
103 }
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
104 } // end if... else...
105
106 if ($fields_null[$key]) {
107 foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
e482a94 @ruleant improve coding style
ruleant authored
108 $html .= "\n" . ' '
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
109 . '<option value="' . htmlspecialchars($fc) . '">'
e482a94 @ruleant improve coding style
ruleant authored
110 . htmlspecialchars($fc) . '</option>';
111 }
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
112 }
113 $html .= '</select>';
114 $extra_data['field_operators'] = $html;
115
116 // retrieve keys into foreign fields, if any
117 // check also foreigners even if relwork is FALSE (to get
118 // foreign keys from innodb)
119 $foreignData = PMA_getForeignData($foreigners, $field, false, '', '');
120
121 // HTML for field values
e482a94 @ruleant improve coding style
ruleant authored
122 $html = PMA_getForeignFields_Values(
123 $foreigners,
124 $foreignData,
125 $field,
126 array($_REQUEST['it'] => $fields_type[$key]),
127 $_REQUEST['it'],
128 $_REQUEST['db'],
129 $_REQUEST['table'],
130 $titles,
131 $GLOBALS['cfg']['ForeignKeyMaxLimit'],
132 ''
133 );
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
134 $extra_data['field_value'] = $html;
e482a94 @ruleant improve coding style
ruleant authored
135 PMA_ajaxResponse(null, true, $extra_data);
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
136 }
137
effa795 @madhuracj Wrong message used in 8373e5feec2232e6a17b342eb0bf74930431bfcc
madhuracj authored
138 $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
139 /**
140 * Not selection yet required -> displays the selection form
141 */
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
142
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
143 // Gets some core libraries
144 require_once './libraries/tbl_common.php';
145 $url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
146
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
147 /**
148 * Gets tables informations
149 */
150 require_once './libraries/tbl_info.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
151
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
152 /**
153 * Displays top menu links
154 */
155 require_once './libraries/tbl_links.inc.php';
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount of ...
ammaryasir authored
156
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
157 if (! isset($goto)) {
158 $goto = $GLOBALS['cfg']['DefaultTabTable'];
159 }
160 // Defines the url to return to in case of error in the next sql statement
161 $err_url = $goto . '?' . PMA_generate_common_url($db, $table);
162
163 // Gets the list and number of fields
164
347fca5 @nijel Use same order of database and table params as elsewhere
nijel authored
165 list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($db, $table);
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
166 $fields_cnt = count($fields_list);
167
168 // retrieve keys into foreign fields, if any
169 // check also foreigners even if relwork is FALSE (to get
170 // foreign keys from innodb)
171 $foreigners = PMA_getForeigners($db, $table);
172 $flag = 1;
173 $tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array();
174 if (! isset($zoom_submit) && ! isset($inputs)) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
175 $dataLabel = PMA_getDisplayField($db, $table);
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
176 }
177 ?>
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
178 <div id="sqlqueryresults"></div>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
179 <fieldset id="fieldset_subtab">
180 <?php
181 $url_params = array();
182 $url_params['db'] = $db;
183 $url_params['table'] = $table;
a06d689 @lem9 Avoid duplicate ids
lem9 authored
184 echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params, '', 'topmenu2');
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
185
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
186 /**
187 * Set the field name,type,collation and whether null on select of a coulmn
188 */
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
189 if (isset($inputs) && ($inputs[0] != 'pma_null' || $inputs[1] != 'pma_null')) {
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored
190 $flag = 2;
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
191 for ($i = 0 ; $i < 4 ; $i++) {
192 if ($inputs[$i] != 'pma_null') {
193 $key = array_search($inputs[$i], $fields_list);
194 $tbl_fields_type[$i] = $fields_type[$key];
195 $tbl_fields_collation[$i] = $fields_collation[$key];
196 $tbl_fields_null[$i] = $fields_null[$key];
197 }
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored
198 }
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
199 }
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount of ...
ammaryasir authored
200
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
201 /*
202 * Form for input criteria
203 */
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
204
18694f2 @ammaryasir Added generate plot feature using SVG ( only for numeric fields )
ammaryasir authored
205 ?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
206 <form method="post" action="tbl_zoom_select.php" name="insertForm" id="zoom_search_form"
207 <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
208 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
209 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
210 <input type="hidden" name="back" value="tbl_zoom_select.php" />
471e10a @lem9 Fix some of the XHTML problems
lem9 authored
211 <input type="hidden" name="flag" id="id_flag" value="<?php echo $flag; ?>" />
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
212
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored
213 <fieldset id="inputSection">
18694f2 @ammaryasir Added generate plot feature using SVG ( only for numeric fields )
ammaryasir authored
214
d9486e2 @ammaryasir Validations for input form submit
ammaryasir authored
215 <legend><?php echo __('Do a "query by example" (wildcard: "%") for two different columns') ?></legend>
c763cc4 @ammaryasir Table identifier changed in tbl_zoom_select.php
ammaryasir authored
216 <table class="data" id="tableFieldsId">
eaea003 @ammaryasir Added some features
ammaryasir authored
217 <?php echo PMA_tbl_setTableHeader();?>
218 <tbody>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
219 <?php
220 $odd_row = true;
6f619e4 @nijel Whitespace cleanup
nijel authored
221
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
222 for ($i = 0; $i < 4; $i++) {
223 if ($i == 2) {
224 echo "<tr><td>";
eaea003 @ammaryasir Added some features
ammaryasir authored
225 echo __("Additional search criteria");
56a73a4 @lem9 XHTML problems
lem9 authored
226 echo "</td></tr>";
6f619e4 @nijel Whitespace cleanup
nijel authored
227 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
228 ?>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
229 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
471e10a @lem9 Fix some of the XHTML problems
lem9 authored
230 <th><select name="inputs[]" id="<?php echo 'tableid_' . $i; ?>" >
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
231 <option value="<?php echo 'pma_null'; ?>"><?php echo __('None'); ?></option>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
232 <?php
233 for ($j = 0 ; $j < $fields_cnt ; $j++) {
234 if (isset($inputs[$i]) && $inputs[$i] == htmlspecialchars($fields_list[$j])) {?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
235 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected">
236 <?php echo htmlspecialchars($fields_list[$j]);?></option>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
237 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
238 } else { ?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
239 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>">
240 <?php echo htmlspecialchars($fields_list[$j]);?></option>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
241 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
242 }
243 } ?>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
244 </select></th>
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
245 <td></td>
246 <td></td>
247 <td></td>
248 <td></td>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
249 </tr>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
250 <tr><td>
9be5d8e @ammaryasir Used AJAX for updating field information(type,collation,operators,field ...
ammaryasir authored
251 <input type="hidden" name="types[<?php echo $i; ?>]" id="types_<?php echo $i; ?>" />
252 <input type="hidden" name="collations[<?php echo $i;?>]" id="collations_<?php echo $i; ?>" />
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
253 </td></tr>
254 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
255 }//end for
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
256 ?>
dc35ecf @lem9 XHTML problems
lem9 authored
257 </tbody>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
258 </table>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
259
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
260 <?php
261 /*
262 * Other inputs like data label and mode go after selection of column criteria
263 */
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored
264
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
265 //Set default datalabel if not selected
0bf475b @lem9 Coding style
lem9 authored
266 if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') {
267 if ($dataLabel == '') {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
268 $dataLabel = PMA_getDisplayField($db, $table);
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored
269 }
0bf475b @lem9 Coding style
lem9 authored
270 }
271 ?>
7880782 @ammaryasir Added 'Max rows to plot' as input criteria
ammaryasir authored
272 <table class="data">
483ec3b @lem9 Improve dialog
lem9 authored
273 <tr><td><label for="dataLabel"><?php echo __("Use this column to label each point"); ?></label></td>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
274 <td><select name="dataLabel" id='dataLabel' >
275 <option value = ''> <?php echo __('None'); ?> </option>
0bf475b @lem9 Coding style
lem9 authored
276 <?php
277 for ($j = 0; $j < $fields_cnt; $j++) {
278 if (isset($dataLabel) && $dataLabel == htmlspecialchars($fields_list[$j])) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
279 ?>
280 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>" selected="selected">
281 <?php echo htmlspecialchars($fields_list[$j]);?></option>
282 <?php
0bf475b @lem9 Coding style
lem9 authored
283 } else {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
284 ?>
285 <option value="<?php echo htmlspecialchars($fields_list[$j]);?>" >
286 <?php echo htmlspecialchars($fields_list[$j]);?></option>
287 <?php
0bf475b @lem9 Coding style
lem9 authored
288 }
6e05e71 @nijel Whitespace cleanup
nijel authored
289 }
0bf475b @lem9 Coding style
lem9 authored
290 ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
291 </select>
292 </td></tr>
9e566cd @lem9 Other XHTML fixes
lem9 authored
293 <tr><td><label for="maxRowPlotLimit"><?php echo __("Maximum rows to plot"); ?></label></td>
7880782 @ammaryasir Added 'Max rows to plot' as input criteria
ammaryasir authored
294 <td>
6e05e71 @nijel Whitespace cleanup
nijel authored
295 <?php
9e566cd @lem9 Other XHTML fixes
lem9 authored
296 echo '<input type="text" name="maxPlotLimit" id="maxRowPlotLimit" value="';
6e05e71 @nijel Whitespace cleanup
nijel authored
297 if (! empty($maxPlotLimit)) {
d630321 @lem9 Missing HTML escape
lem9 authored
298 echo htmlspecialchars($maxPlotLimit);
9e566cd @lem9 Other XHTML fixes
lem9 authored
299 } else {
300 echo $GLOBALS['cfg']['maxRowPlotLimit'];
0bf475b @lem9 Coding style
lem9 authored
301 }
9e566cd @lem9 Other XHTML fixes
lem9 authored
302 echo '" /></td></tr>';
0bf475b @lem9 Coding style
lem9 authored
303 ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
304 </table>
64425cc @ammaryasir Fixed some issues and added support for plotting strings
ammaryasir authored
305
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
306 </fieldset>
307 <fieldset class="tblFooters">
308 <input type="hidden" name="max_number_of_fields"
309 value="<?php echo $fields_cnt; ?>" />
d9486e2 @ammaryasir Validations for input form submit
ammaryasir authored
310 <input type="submit" name="zoom_submit" id="inputFormSubmitId" value="<?php echo __('Go'); ?>" />
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
311 </fieldset>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
312 </form>
dc35ecf @lem9 XHTML problems
lem9 authored
313 </fieldset>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
314
6f619e4 @nijel Whitespace cleanup
nijel authored
315 <?php
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
316
317 /*
0bf475b @lem9 Coding style
lem9 authored
318 * Handle the input criteria and generate the query result
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
319 * Form for displaying query results
320 */
0bf475b @lem9 Coding style
lem9 authored
321 if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' && $inputs[0] != $inputs[1]) {
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored
322
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
323 /*
324 * Query generation part
325 */
6f619e4 @nijel Whitespace cleanup
nijel authored
326 $w = $data = array();
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
327 $sql_query = 'SELECT *';
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored
328
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
329 //Add the table
330 $sql_query .= ' FROM ' . PMA_backquote($table);
0bf475b @lem9 Coding style
lem9 authored
331 for ($i = 0; $i < 4; $i++) {
332 if ($inputs[$i] == 'pma_null') {
333 continue;
334 }
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
335 $tmp = array();
336 // The where clause
337 $charsets = array();
338 $cnt_func = count($zoomFunc[$i]);
339 $func_type = $zoomFunc[$i];
340 list($charsets[$i]) = explode('_', $collations[$i]);
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
341 $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type])
342 && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1)
343 ? true
344 : false;
345 $whereClause = PMA_tbl_search_getWhereClause(
346 $fields[$i], $inputs[$i], $types[$i],
347 $collations[$i], $func_type, $unaryFlag
348 );
0bf475b @lem9 Coding style
lem9 authored
349 if ($whereClause) {
350 $w[] = $whereClause;
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
351 }
0bf475b @lem9 Coding style
lem9 authored
352 } // end for
353 if ($w) {
354 $sql_query .= ' WHERE ' . implode(' AND ', $w);
355 }
356 $sql_query .= ' LIMIT ' . $maxPlotLimit;
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored
357
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
358 /*
359 * Query execution part
360 */
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
361 $result = PMA_DBI_query($sql_query . ";", null, PMA_DBI_QUERY_STORE);
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
362 $fields_meta = PMA_DBI_get_fields_meta($result);
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
363 while ($row = PMA_DBI_fetch_assoc($result)) {
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
364 //Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition hence using a temporary array
0bf475b @lem9 Coding style
lem9 authored
365 $tmpRow = array();
366 foreach ($row as $val) {
367 $tmpRow[] = $val;
368 }
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
369 //Get unique conditon on each row (will be needed for row update)
0bf475b @lem9 Coding style
lem9 authored
370 $uniqueCondition = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $tmpRow, true);
e3cb99d @ammaryasir Added better support for datetime fields
ammaryasir authored
371
0bf475b @lem9 Coding style
lem9 authored
372 //Append it to row array as where_clause
373 $row['where_clause'] = $uniqueCondition[0];
374 if ($dataLabel == $inputs[0] || $dataLabel == $inputs[1]) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
375 $data[] = array(
376 $inputs[0] => $row[$inputs[0]],
377 $inputs[1] => $row[$inputs[1]],
378 'where_clause' => $uniqueCondition[0]
379 );
0bf475b @lem9 Coding style
lem9 authored
380 } elseif ($dataLabel) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
381 $data[] = array(
382 $inputs[0] => $row[$inputs[0]],
383 $inputs[1] => $row[$inputs[1]],
384 $dataLabel => $row[$dataLabel],
385 'where_clause' => $uniqueCondition[0]
386 );
0bf475b @lem9 Coding style
lem9 authored
387 } else {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
388 $data[] = array(
389 $inputs[0] => $row[$inputs[0]],
390 $inputs[1] => $row[$inputs[1]],
391 $dataLabel => '',
392 'where_clause' => $uniqueCondition[0]
393 );
0bf475b @lem9 Coding style
lem9 authored
394 }
6f619e4 @nijel Whitespace cleanup
nijel authored
395 }
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
396 /*
397 * Form for displaying point data and also the scatter plot
398 */
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
399 ?>
400 <form method="post" action="tbl_zoom_select.php" name="displayResultForm" id="zoom_display_form"
401 <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
402 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
403 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
404 <input type="hidden" name="back" value="tbl_zoom_select.php" />
405
406 <fieldset id="displaySection">
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
407 <legend><?php echo __('Browse/Edit the points') ?></legend>
408 <center>
409 <?php
0bf475b @lem9 Coding style
lem9 authored
410 //JSON encode the data(query result)
411 if (isset($zoom_submit) && ! empty($data)) {
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
412 ?>
413 <div id='resizer' style="width:600px;height:400px">
13d741e @lem9 onClick should be onclick
lem9 authored
414 <center><a href="#" onclick="displayHelp();"><?php echo __('How to use'); ?></a></center>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
415 <div id="querydata" style="display:none">
416 <?php
6e05e71 @nijel Whitespace cleanup
nijel authored
417 echo json_encode($data);
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
418 ?>
419 </div>
420 <div id="querychart" style="float:right"></div>
421 </div>
422 <?php
6e05e71 @nijel Whitespace cleanup
nijel authored
423 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
424 ?>
425 </center>
b131ec7 @roccivic Improved layout for the data editor from the zoom search feature
roccivic authored
426 <div id='dataDisplay' style="display:none">
427 <table>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
428 <thead>
429 <tr>
430 <th> <?php echo __('Column'); ?> </th>
431 <th> <?php echo __('Null'); ?> </th>
432 <th> <?php echo __('Value'); ?> </th>
433 </tr>
434 </thead>
435 <tbody>
436 <?php
0bf475b @lem9 Coding style
lem9 authored
437 $odd_row = true;
438 for ($i = 4; $i < $fields_cnt + 4; $i++) {
439 $tbl_fields_type[$i] = $fields_type[$i - 4];
440 $fieldpopup = $fields_list[$i - 4];
441 $foreignData = PMA_getForeignData($foreigners, $fieldpopup, false, '', '');
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
442 ?>
443 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
444 <th><?php echo htmlspecialchars($fields_list[$i - 4]); ?></th>
20ca1e4 @madhuracj bug #3410999 - Zoom search, problems with data editor
madhuracj authored
445 <th><?php echo ($fields_null[$i - 4] == 'YES')
446 ? '<input type="checkbox" class="checkbox_null" name="fields_null[ '
447 . $i . ' ]" id="fields_null_id_' . $i . '" />'
448 : ''; ?>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
449 </th>
450 <th> <?php
451 echo PMA_getForeignFields_Values(
452 $foreigners, $foreignData, $fieldpopup, $tbl_fields_type,
20ca1e4 @madhuracj bug #3410999 - Zoom search, problems with data editor
madhuracj authored
453 $i, $db, $table, $titles,
454 $GLOBALS['cfg']['ForeignKeyMaxLimit'], '', false, true
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
455 ); ?>
456 </th>
457 </tr>
458 <?php
6e05e71 @nijel Whitespace cleanup
nijel authored
459 }
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
460 ?>
461 </tbody>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
462 </table>
b131ec7 @roccivic Improved layout for the data editor from the zoom search feature
roccivic authored
463 </div>
41715e5 @ammaryasir Removed mode feature, appended a missing configuration directive and cha...
ammaryasir authored
464 <input type="hidden" id="queryID" name="sql_query" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
465 </form>
7b4bb1c @madhuracj Coding style improvements
madhuracj authored
466 <?php
41715e5 @ammaryasir Removed mode feature, appended a missing configuration directive and cha...
ammaryasir authored
467 }
0bf475b @lem9 Coding style
lem9 authored
468 require './libraries/footer.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
469 ?>
Something went wrong with that request. Please try again.