Skip to content
Newer
Older
100644 431 lines (392 sloc) 15.6 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';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
29 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
30 $GLOBALS['js_include'][] = 'jquery/timepicker.js';
31
c7cef3b @ammaryasir Refactored the tbl_select.php and tbl_zoom_select.php code in librari…
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 …
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();
40 $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`' . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause'];
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored
41 $result = PMA_DBI_query( $row_info_query . ";" , null, PMA_DBI_QUERY_STORE);
42 $fields_meta = PMA_DBI_get_fields_meta($result);
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
43 while ($row = PMA_DBI_fetch_assoc($result)) {
44 $extra_data['row_info'] = $row;
45 }
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored
46 PMA_ajaxResponse(NULL, true, $extra_data);
47 }
48
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
49 $titles['Browse'] = PMA_tbl_setTitle($GLOBALS['cfg']['PropertiesIconic'], $pmaThemeImage);
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
50 /**
51 * Not selection yet required -> displays the selection form
52 */
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
53
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
54 // Gets some core libraries
55 require_once './libraries/tbl_common.php';
56 $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
57
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
58 /**
59 * Gets tables informations
60 */
61 require_once './libraries/tbl_info.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
62
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
63 /**
64 * Displays top menu links
65 */
66 require_once './libraries/tbl_links.inc.php';
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored
67
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
68 if (! isset($goto)) {
69 $goto = $GLOBALS['cfg']['DefaultTabTable'];
70 }
71 // Defines the url to return to in case of error in the next sql statement
72 $err_url = $goto . '?' . PMA_generate_common_url($db, $table);
73
74 // Gets the list and number of fields
75
76 list($fields_list, $fields_type, $fields_collation, $fields_null) = PMA_tbl_getFields($table,$db);
77 $fields_cnt = count($fields_list);
78
79 // retrieve keys into foreign fields, if any
80 // check also foreigners even if relwork is FALSE (to get
81 // foreign keys from innodb)
82 $foreigners = PMA_getForeigners($db, $table);
83 $flag = 1;
84 $tbl_fields_type = $tbl_fields_collation = $tbl_fields_null = array();
85 if (! isset($zoom_submit) && ! isset($inputs)) {
86 $dataLabel = PMA_getDisplayField($db,$table);
87 }
88 ?>
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
89 <div id="sqlqueryresults"></div>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
90 <fieldset id="fieldset_subtab">
91 <?php
92 $url_params = array();
93 $url_params['db'] = $db;
94 $url_params['table'] = $table;
91d372f @ammaryasir Added a library file for the table-search and zoom-search code
ammaryasir authored
95 echo PMA_generate_html_tabs(PMA_tbl_getSubTabs(), $url_params);
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
96
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
97 /**
98 * Set the field name,type,collation and whether null on select of a coulmn
99 */
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
100 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
101 $flag = 2;
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
102 for ($i = 0 ; $i < 4 ; $i++) {
103 if ($inputs[$i] != 'pma_null') {
104 $key = array_search($inputs[$i], $fields_list);
105 $tbl_fields_type[$i] = $fields_type[$key];
106 $tbl_fields_collation[$i] = $fields_collation[$key];
107 $tbl_fields_null[$i] = $fields_null[$key];
108 }
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored
109 }
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
110 }
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored
111
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
112 /*
113 * Form for input criteria
114 */
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
115
18694f2 @ammaryasir Added generate plot feature using SVG ( only for numeric fields )
ammaryasir authored
116 ?>
4f4ab7d @ammaryasir Fixed: 'Browse foreign values' not working properly
ammaryasir authored
117 <form method="post" action="tbl_zoom_select.php" name="insertForm" id="zoom_search_form" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
118 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
119 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
120 <input type="hidden" name="back" value="tbl_zoom_select.php" />
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
121 <input type="hidden" name="flag" id="id_flag" value=<?php echo $flag; ?> />
122
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored
123 <fieldset id="inputSection">
18694f2 @ammaryasir Added generate plot feature using SVG ( only for numeric fields )
ammaryasir authored
124
d9486e2 @ammaryasir Validations for input form submit
ammaryasir authored
125 <legend><?php echo __('Do a "query by example" (wildcard: "%") for two different columns') ?></legend>
eaea003 @ammaryasir Added some features
ammaryasir authored
126 <table class="data">
127 <?php echo PMA_tbl_setTableHeader();?>
128 <tbody>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
129 <?php
130 $odd_row = true;
6f619e4 @nijel Whitespace cleanup
nijel authored
131
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
132 for ($i = 0; $i < 4; $i++) {
133 if ($i == 2) {
134 echo "<tr><td>";
eaea003 @ammaryasir Added some features
ammaryasir authored
135 echo __("Additional search criteria");
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
136 echo "</td><tr>";
6f619e4 @nijel Whitespace cleanup
nijel authored
137 }
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
138 ?>
139 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
140 <th><select name="inputs[]" id=<?php echo 'tableid_' . $i?> >
cbf2ec7 @nijel Do not translate internal string
nijel authored
141 <option value= <?php echo 'pma_null'?>><?php echo __('None'); ?> </option>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
142 <?php
143 for ($j = 0 ; $j < $fields_cnt ; $j++) {
144 if (isset($inputs[$i]) && $inputs[$i] == htmlspecialchars($fields_list[$j])) {?>
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored
145 <option value=<?php echo htmlspecialchars($fields_list[$j]);?> Selected> <?php echo htmlspecialchars($fields_list[$j]);?></option>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
146 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
147 } else { ?>
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored
148 <option value=<?php echo htmlspecialchars($fields_list[$j]);?> > <?php echo htmlspecialchars($fields_list[$j]);?></option>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
149 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
150 }
151 } ?>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
152 </select></th>
c7cef3b @ammaryasir Refactored the tbl_select.php and tbl_zoom_select.php code in librari…
ammaryasir authored
153 <td><?php if(isset($tbl_fields_type[$i]))echo $tbl_fields_type[$i]; ?></td>
154 <td><?php if(isset($tbl_fields_collation[$i]))echo $tbl_fields_collation[$i]; ?></td>
6f619e4 @nijel Whitespace cleanup
nijel authored
155
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
156 <td>
157 <?php
158 if (isset($inputs) && $inputs[$i] != 'pma_null') { ?>
159 <select name="zoomFunc[]">
160 <?php
161 if (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0) {
162 foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
163 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == htmlspecialchars($fc)) {
164 echo "\n" . ' '
165 . '<option value="' . htmlspecialchars($fc) . '" Selected>'
166 . htmlspecialchars($fc) . '</option>';
167 } else {
168 echo "\n" . ' '
169 . '<option value="' . htmlspecialchars($fc) . '">'
170 . htmlspecialchars($fc) . '</option>';
171 }
172 }
173 } elseif (preg_match('@char|blob|text|set@i', $tbl_fields_type[$i])) {
174 foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
175 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
176 echo "\n" . ' '
177 . '<option value="' . htmlspecialchars($fc) . '" Selected>'
178 . htmlspecialchars($fc) . '</option>';
179 } else {
180 echo "\n" . ' '
181 . '<option value="' . htmlspecialchars($fc) . '">'
182 . htmlspecialchars($fc) . '</option>';
183 }
184 }
185 } else {
186 foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
187 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
188 echo "\n" . ' '
189 . '<option value="' . htmlspecialchars($fc) . '" Selected>'
190 . htmlspecialchars($fc) . '</option>';
191 } else {
192 echo "\n" . ' '
193 . '<option value="' . htmlspecialchars($fc) . '">'
194 . htmlspecialchars($fc) . '</option>';
195 }
196 }
197 } // end if... else...
198
199 if ($tbl_fields_null[$i]) {
200 foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
201 if (isset($zoomFunc[$i]) && $zoomFunc[$i] == $fc) {
202 echo "\n" . ' '
203 . '<option value="' . htmlspecialchars($fc) . '" Selected>'
204 . htmlspecialchars($fc) . '</option>';
205 } else {
206 echo "\n" . ' '
207 . '<option value="' . htmlspecialchars($fc) . '">'
208 . htmlspecialchars($fc) . '</option>';
209 }
210 }
211 }
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored
212 ?>
213 </select>
214 </td>
215 <td>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
216 <?php
217 $field = $inputs[$i];
6f619e4 @nijel Whitespace cleanup
nijel authored
218
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
219 $foreignData = PMA_getForeignData($foreigners, $field, false, '', '');
220 if (isset($fields)) {
221 echo PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i ,$db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], $fields);
222 } else {
223 echo PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i ,$db, $table, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'], '');
c7cef3b @ammaryasir Refactored the tbl_select.php and tbl_zoom_select.php code in librari…
ammaryasir authored
224 }
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
225 } else { ?>
6f619e4 @nijel Whitespace cleanup
nijel authored
226
70167fe @ammaryasir Made suggested change to tbl_select.php and tbl_zoom_select.php
ammaryasir authored
227 </td><td></td>
228
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
229 <?php
230 } ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
231
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
232 </td>
233 </tr>
234
6cc3ff4 @ammaryasir Data point content is now displayed as a dialog box which opens on cl…
ammaryasir authored
235 <input type="hidden" name="types[<?php echo $i; ?>]" id="types_<?php echo $i; ?>"
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
236 value="<?php if(isset($tbl_fields_type[$i]))echo $tbl_fields_type[$i]; ?>" />
237 <input type="hidden" name="collations[<?php echo $i; ?>]"
238 value="<?php if(isset($tbl_fields_collation[$i]))echo $tbl_fields_collation[$i]; ?>" />
239
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
240 <?php
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
241 }//end for
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
242 ?>
243 </table>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
244
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
245 <?php
246 /*
247 * Other inputs like data label and mode go after selection of column criteria
248 */
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored
249
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
250 //Set default datalabel if not selected
0bf475b @lem9 Coding style
lem9 authored
251 if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null') {
252 if ($dataLabel == '') {
253 $dataLabel = PMA_getDisplayField($db,$table);
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored
254 }
0bf475b @lem9 Coding style
lem9 authored
255 }
256 ?>
7880782 @ammaryasir Added 'Max rows to plot' as input criteria
ammaryasir authored
257 <table class="data">
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
258 <tr><td><label for="label"><?php echo __("Data Label"); ?></label>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</td>
259 <td><select name="dataLabel" id='dataLabel' >
260 <option value = ''> <?php echo __('None'); ?> </option>
0bf475b @lem9 Coding style
lem9 authored
261 <?php
262 for ($j = 0; $j < $fields_cnt; $j++) {
263 if (isset($dataLabel) && $dataLabel == htmlspecialchars($fields_list[$j])) {
264 ?>
265 <option value=<?php echo htmlspecialchars($fields_list[$j]);?> selected="selected"> <?php echo htmlspecialchars($fields_list[$j]);?></option>
266 <?php
267 } else {
268 ?>
269 <option value=<?php echo htmlspecialchars($fields_list[$j]);?> > <?php echo htmlspecialchars($fields_list[$j]);?></option>
270 <?php
271 }
272 }
273 ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
274 </select>
275 </td></tr>
7880782 @ammaryasir Added 'Max rows to plot' as input criteria
ammaryasir authored
276 <tr><td><label for="label"><?php echo __("Maximum rows to plot"); ?></label></td>
277 <td>
0bf475b @lem9 Coding style
lem9 authored
278 <?php
279 if (isset($maxPlotLimit)) {
280 ?>
281 <input type="text" name="maxPlotLimit" value="<?php echo $maxPlotLimit; ?>" /></td></tr>
282 <?php
283 } else {
284 ?>
285 <input type="text" name="maxPlotLimit" value="<?php echo $GLOBALS['cfg']['maxRowPlotLimit']; ?>" /></td></tr>
286 <?php
287 }
288 ?>
f939564 @ammaryasir Created the SVG based scatter-plot functionality
ammaryasir authored
289 </table>
64425cc @ammaryasir Fixed some issues and added support for plotting strings
ammaryasir authored
290
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
291 </fieldset>
292 <fieldset class="tblFooters">
293 <input type="hidden" name="max_number_of_fields"
294 value="<?php echo $fields_cnt; ?>" />
d9486e2 @ammaryasir Validations for input form submit
ammaryasir authored
295 <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
296 </fieldset>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
297 </form>
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
298
6f619e4 @nijel Whitespace cleanup
nijel authored
299 <?php
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
300
301 /*
0bf475b @lem9 Coding style
lem9 authored
302 * Handle the input criteria and generate the query result
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
303 * Form for displaying query results
304 */
0bf475b @lem9 Coding style
lem9 authored
305 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
306
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
307 /*
308 * Query generation part
309 */
6f619e4 @nijel Whitespace cleanup
nijel authored
310 $w = $data = array();
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
311 $sql_query = 'SELECT *';
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored
312
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
313 //Add the table
314 $sql_query .= ' FROM ' . PMA_backquote($table);
0bf475b @lem9 Coding style
lem9 authored
315 for ($i = 0; $i < 4; $i++) {
316 if ($inputs[$i] == 'pma_null') {
317 continue;
318 }
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
319 $tmp = array();
320 // The where clause
321 $charsets = array();
322 $cnt_func = count($zoomFunc[$i]);
323 $func_type = $zoomFunc[$i];
324 list($charsets[$i]) = explode('_', $collations[$i]);
325 $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false;
326 $whereClause = PMA_tbl_search_getWhereClause($fields[$i],$inputs[$i], $types[$i], $collations[$i], $func_type, $unaryFlag);
0bf475b @lem9 Coding style
lem9 authored
327 if ($whereClause) {
328 $w[] = $whereClause;
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
329 }
0bf475b @lem9 Coding style
lem9 authored
330 } // end for
331 if ($w) {
332 $sql_query .= ' WHERE ' . implode(' AND ', $w);
333 }
334 $sql_query .= ' LIMIT ' . $maxPlotLimit;
04e82bb @ammaryasir Default data label now taken from table display field
ammaryasir authored
335
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
336 /*
337 * Query execution part
338 */
0bf475b @lem9 Coding style
lem9 authored
339 $result = PMA_DBI_query($sql_query . ";" , null, PMA_DBI_QUERY_STORE);
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
340 $fields_meta = PMA_DBI_get_fields_meta($result);
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
341 while ($row = PMA_DBI_fetch_assoc($result)) {
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
342 //Need a row with indexes as 0,1,2 for the PMA_getUniqueCondition hence using a temporary array
0bf475b @lem9 Coding style
lem9 authored
343 $tmpRow = array();
344 foreach ($row as $val) {
345 $tmpRow[] = $val;
346 }
362a57f @ammaryasir Functionality for edit data points added (primitive)
ammaryasir authored
347 //Get unique conditon on each row (will be needed for row update)
0bf475b @lem9 Coding style
lem9 authored
348 $uniqueCondition = PMA_getUniqueCondition($result, $fields_cnt, $fields_meta, $tmpRow, true);
e3cb99d @ammaryasir Added better support for datetime fields
ammaryasir authored
349
0bf475b @lem9 Coding style
lem9 authored
350 //Append it to row array as where_clause
351 $row['where_clause'] = $uniqueCondition[0];
352 if ($dataLabel == $inputs[0] || $dataLabel == $inputs[1]) {
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored
353 $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], 'where_clause' => $uniqueCondition[0]);
0bf475b @lem9 Coding style
lem9 authored
354 } elseif ($dataLabel) {
241caff @ammaryasir Used AJAX to get data row on point select, hence reducing the amount …
ammaryasir authored
355 $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => $row[$dataLabel], 'where_clause' => $uniqueCondition[0]);
0bf475b @lem9 Coding style
lem9 authored
356 } else {
047cb68 @ammaryasir Fixed: Not selecting a datalabel used to issue a notice(undefined off…
ammaryasir authored
357 $data[] = array($inputs[0] => $row[$inputs[0]], $inputs[1] => $row[$inputs[1]], $dataLabel => '', 'where_clause' => $uniqueCondition[0]);
0bf475b @lem9 Coding style
lem9 authored
358 }
6f619e4 @nijel Whitespace cleanup
nijel authored
359 }
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
360 /*
361 * Form for displaying point data and also the scatter plot
362 */
6f619e4 @nijel Whitespace cleanup
nijel authored
363 ?>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
364 <form method="post" action="tbl_zoom_select.php" name="displayResultForm" id="zoom_display_form" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>>
365 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
366 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
367 <input type="hidden" name="back" value="tbl_zoom_select.php" />
368
369 <fieldset id="displaySection">
370 <legend><?php echo __('Browse/Edit the points') ?></legend>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
371 <center>
0bf475b @lem9 Coding style
lem9 authored
372 <?php
373 //JSON encode the data(query result)
374 if (isset($zoom_submit) && ! empty($data)) {
375 ?>
6cc3ff4 @ammaryasir Data point content is now displayed as a dialog box which opens on cl…
ammaryasir authored
376 <div id='resizer' style="width:600px;height:400px">
0bf475b @lem9 Coding style
lem9 authored
377 <center> <a href="#" onClick="displayHelp();"><?php echo __('How to use'); ?></a> </center>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
378 <div id="querydata" style="display:none">
0bf475b @lem9 Coding style
lem9 authored
379 <?php
380 echo json_encode($data);
381 ?>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
382 </div>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
383 <div id="querychart" style="float:right"></div>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
384 </div>
6f619e4 @nijel Whitespace cleanup
nijel authored
385 <?php
0bf475b @lem9 Coding style
lem9 authored
386 }
387 ?>
6cc3ff4 @ammaryasir Data point content is now displayed as a dialog box which opens on cl…
ammaryasir authored
388 </center>
389 <fieldset id='dataDisplay' style="display:none">
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
390 <fieldset>
391 <table class="data">
392 <thead>
393 <tr>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
394 <th> <?php echo __('Column'); ?> </th>
395 <th> <?php echo __('Null'); ?> </th>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
396 <th> <?php echo __('Value'); ?> </th>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
397 </tr>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
398 </thead>
399 <tbody>
0bf475b @lem9 Coding style
lem9 authored
400 <?php
401 $odd_row = true;
402 for ($i = 4; $i < $fields_cnt + 4; $i++) {
403 $tbl_fields_type[$i] = $fields_type[$i - 4];
404 $fieldpopup = $fields_list[$i - 4];
405 $foreignData = PMA_getForeignData($foreigners, $fieldpopup, false, '', '');
406 ?>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
407 <tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
408 <th><?php echo htmlspecialchars($fields_list[$i - 4]); ?></th>
c2e7d4b @lem9 Remove tab characters; coding style (first part)
lem9 authored
409 <th><?php echo '<input type="checkbox" class="checkbox_null" name="fields_null[ ' . $i . ' ]" id="fields_null_id_' . $i . '" />'; ?></th>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
410 <th><?php echo PMA_getForeignFields_Values($foreigners, $foreignData, $fieldpopup, $tbl_fields_type, $i, $db, $table, $titles,$GLOBALS['cfg']['ForeignKeyMaxLimit'], '' ); ?> </th>
411 </tr>
0bf475b @lem9 Coding style
lem9 authored
412 <?php
413 }
414 ?>
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
415 </tbody>
416 </table>
417 </fieldset>
418 <fieldset class="tblFooters">
6cc3ff4 @ammaryasir Data point content is now displayed as a dialog box which opens on cl…
ammaryasir authored
419 <input type="submit" id="submitForm" name="edit_point" value="<?php echo __('Submit'); ?>" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
420 </fieldset>
543df4c @ammaryasir Added interface for browsing/editing points
ammaryasir authored
421 </fieldset>
18694f2 @ammaryasir Added generate plot feature using SVG ( only for numeric fields )
ammaryasir authored
422
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
423 </fieldset>
41715e5 @ammaryasir Removed mode feature, appended a missing configuration directive and …
ammaryasir authored
424 <input type="hidden" id="queryID" name="sql_query" />
602a64a @ammaryasir Added the Show/Hide search criteria feature
ammaryasir authored
425 </form>
426 </fieldset>
0bf475b @lem9 Coding style
lem9 authored
427 <?php
41715e5 @ammaryasir Removed mode feature, appended a missing configuration directive and …
ammaryasir authored
428 }
0bf475b @lem9 Coding style
lem9 authored
429 require './libraries/footer.inc.php';
7396fa3 @ammaryasir Designed the zoom-search form(tbl_zoom_select.php)
ammaryasir authored
430 ?>
Something went wrong with that request. Please try again.