Skip to content

HTTPS clone URL

Subversion checkout URL

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