-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_processingV3.php
543 lines (431 loc) · 30.3 KB
/
server_processingV3.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
<?php
/*
* ServerDataPDO is a class file that wraps data tables SERVER-SIDE processing with PDO (PHP) SQL data abstraction
* and it provides a simple way to integrate Jquery data tables with server side databases like SQLite, MySQL and other
* PDO supported DB's. It also dynamically renders the Jquery (JAvascript) data tables code and corresponding HTML
* (c) Tony Brandao <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
date_default_timezone_set('UTC'); // Set default timezone
setlocale(LC_ALL, "en_US.utf8"); // para a questão dos diacríticos
/* Change these to correspond to your database type (dsn) and access credentials, example below uses sqlite w/o pass */
$db_dsn="sqlite:Folhapessoal.db"; /* corresponds to PDO DSN strings refer to: http://www.php.net/manual/en/pdo.drivers.php */
$db_user=null;
$db_pass=null;
/* Sample MySQL Example
$db_dsn= 'mysql:host=localhost;dbname=testdb';
$db_user = 'username';
$db_pass = 'password';
*/
//When called directly via the Jquery Ajax Source look for this
//SECURITY NOTE: Consider moving this if..block to another file if security is a concern.
if ( isset($_GET['oDb']) ) //is this being called from datatables ajax?
{
//Do we have an object database info (Serialized) if so expand it\\
//echo $_GET['oDb'];
$d=unserialize(base64_decode($_GET['oDb'])); //NOTE HARDEN by encrypting
$pdo = new ServerDataPDO($db_dsn,$db_user,$db_pass,$d['sql'],$d['table'],$d['idxcol']); //construct the object
$result=$pdo->query_datatables(); //now return the JSON Requested data */
echo $result;
exit;
}
class ServerDataPDO
{
/* UPDATE these variables with valid PDO DSN and credentials to connect to database */
/* DSN information http://www.php.net/manual/en/ref.pdo-mysql.connection.php */
public $db=array(
"dsn"=> null,
"user"=>null,
"pass"=>null,
"conn"=>null,
"sql"=>null,
"table"=>null, /* DB table to use assigned by constructor*/
"idxcol"=>null /* Indexed column (used for fast and accurate table cardinality) */
);
public static $default_ajax_url=__FILE__; //Defaults to current file name
/* Array of database columns which should be read and sent back to DataTables.dynamically created */
public $aColumns = null; // holds SELECT [columns] from SQL query
public $time_start=null; /* Start timer for metric performance collection */
/********************************************************************
constructor function : called when object is first instantiated
*/
public function __construct($dsn=null,$user=null,$pass=null,$sql=null, $table=null, $index_col=null)
{
$this->db['dsn']= empty($dsn)? $this->db['dsn'] : $dsn;
$this->db['sql']= empty($sql)? $this->db['sql'] : $sql;
$this->db['user']= empty($user)? $this->db['user'] : $user;
$this->db['pass']= empty($pass)? $this->db['pass'] : $pass;
/* Create a database connection if $db['conn'] is null*/
if (empty( $this->db['conn']) ) /* no valid connection? let's make one */
$this->pdo_conn($this->db['dsn'],$this->db['user'],$this->db['pass']);
/* Start timer for metrics */
$this->time_start = microtime(true);
/* build the SQL table and columns from the String */
if (!empty($sql) )
$this->get_SQL_acolumns($sql);
/* assign table and index if provided */
$this->db['idxcol'] = $index_col;
$this->db['table'] = $table;
}
/********************************************************************
pdo_conn : Creates a connection to a database vai the PDO (PHP) database abstraction layer
Refer to http://ca1.php.net/manual/en/pdo.drivers.php for possible PDO drivers and DSN strings
Called by the constructor
@dsn matches PDO DSN string name for database connection
@return null , sets global $db['conn'] variable
*/
public function pdo_conn($dsn=null,$username=null,$password=null)
{
try {
//echo "[dsn]: $dsn >> Connection: ".$this->db[ 'conn'];
$this->db['conn'] = new PDO($dsn); //typical dsn like 'mysql:host=localhost;dbname=testdb';
// Set errormode to exceptions
$this->db['conn']->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
return true;
} catch (PDOException $e) {
$this->fatal_error( "Database Error!: <strong>".$e->getMessage()."</strong> Dsn= <strong>$dsn </strong><br/>" );
}
} //end of connection function
/********************************************************************
get_SQL_acolumns: Uses a basic SQL Statements SELECT field1,field3,field3 FROM Table 1 and extracts SELECT fields
NOTES: Column names MUST be explicitly noted , SELECT * FROM is not supported
complex SQL statements not currently supported
Results of fields names are converted into array in $this->aColumns
@SQL SQL Statements (basic) to have fields extracted
@returns false if unable to extract columns otherwise true if $this->aColumns is successfull
*/
public function get_SQL_acolumns($sql=null,$s1="SELECT",$s2="FROM",$split_on=",")
{
$pattern = "/$s1(.*?)$s2/i";
if (preg_match($pattern, $sql, $matches))
{
// print_r($matches);
$this->aColumns=explode($split_on, $matches[1]); //return into
$this->aColumns=array_map('trim',$this->aColumns ); //trim white space
}
else
{
$this->fatal_error("NO SQL columns found in $sql string resulting in <strong>".$result."</strong> Be sure to have $split_on delimited values.");
return false; //string not found
}
}
/********************************************************************
build_html_datatable: Static function no object needed to instantiate
Based on the $this->aColumns array it dynamically builds the HTML code for HTML data tables
@table_id table_id for Jquery to refer to allow multiple tables
@columns a comma separated string of column names defaults SQL columns if null
@returns string containing the completed HTML data tables
*/
public static function build_html_datatable($columns=null,$table_id="datatable1")
{
$html=null;
$html_columns=null;
//lets extract the columns names from the string
if ( !empty($columns) )
$columns=explode(",",$columns);
else
die(" $columns columns array must be defined, such as col1,col2,col3");
//build the header loop through the array and of columns
$count_cols=count($columns);
foreach($columns as $key=>$val)
$html_columns.="<td>".trim($val)."</td>\n";
$html = <<< EOT
<!-- Start of Generated HTML Datatables structure -->
<table cellpadding='1' cellspacing='1' border='0' class='display' id='$table_id'>
<thead>
<tr>
$html_columns
</tr>
</thead>
<tbody>
<tr><td colspan='$count_cols' class='dataTables_empty'>Loading data from server
</td></tr>
</tbody>
</table>
EOT;
return $html;
}
/********************************************************************
fatal_error : Creates a Server Error to be passed ot calling AJAX page
@sErrorMessage Error message to be returned to browser
*/
static function fatal_error( $sErrorMessage = '' )
{
header( $_SERVER['SERVER_PROTOCOL'] .' 500 Internal Server Error ' );
die( $sErrorMessage );
}
/********************************************************************
query_array : Create an array from a SQL Query string
@sql SQL to be executed and returned
@returns $results an array a PHP array (2D) of results of SQL
*/
function query_array($sql=null)
{
global $db,$debug;
try {
if ($debug)
$time_start = microtime(true);
$stmt = $this->db['conn']->prepare($sql);
$stmt->execute();
if ($debug){
$time = microtime(true)- $time_start;
echo "<HR>Executed SQL:<strong> $sql </strong> in <strong>$time</strong> s<HR>";
}
$results = $stmt->fetchAll(PDO::FETCH_ASSOC); //PDO::FETCH_NUM | PDO::FETCH_ASSOC
return $results ;
} catch (PDOException $e) {
$this->fatal_error(" Database Error!: <strong>". $e->getMessage() ."</strong> SQL: $sql <br /> Using DSN ".$this->db['dsn']."<br/>");
die(); die();
}
}
/********************************************************************
query_datables : Primary server-side data table processing, builds query and returns encoded json
reads input from the datables query string parameters and builds SQL
@returns json_encode JSON encoded results compatible with data tables
*/
function query_datatables()
{
/** Paging */
$sqlMax = "1000";
$sLimit = "";
if ( isset( $_POST['iDisplayStart'] ) && $_POST['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".intval( $_POST['iDisplayStart'] ).", ".
intval( $_POST['iDisplayLength'] );
}
/** Ordering */
$sOrder = "";
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
{
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
{
$sOrder .= "`".$this->aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
}
}
$sOrder = substr_replace( $sOrder, "", -2 );
if ( $sOrder == "ORDER BY" )
{
$sOrder = "";
}
}
/** Filtering
* NOTE this does not match the built-in DataTables filtering which does it
* word by word on any field. It's possible to do here, but concerned about efficiency
* on very large tables, and MySQL's regex functionality is very limited
*/
// Retira acentos da pesquisa
$normalizeChars = array(
'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
'Ï'=>'I', 'Ñ'=>'N', 'Ń'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a',
'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i',
'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ń'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u',
'ú'=>'u', 'û'=>'u', 'ü'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y', 'ƒ'=>'f',
'ă'=>'a', 'î'=>'i', 'â'=>'a', 'ș'=>'s', 'ț'=>'t', 'Ă'=>'A', 'Î'=>'I', 'Â'=>'A', 'Ș'=>'S', 'Ț'=>'T', "'" => "",
);
$_POST['search']['value'] = strtr($_POST['search']['value'], $normalizeChars);
$sWhere = "";
if ( str_replace(' ', '', $_POST['search']['value']) != "" )
{
$sWhere = "WHERE ".$this->db['table']." MATCH '". $_POST['search']['value']."'";
/** CORE SQL queries * Get data to display */
$sQuery = " SELECT `".str_replace(" , ", " ", implode("`, `", $this->aColumns))."`
FROM ".$this->db['table']."
$sWhere
$sLimit
LIMIT $sqlMax
";}
else
{$sQuery = " SELECT `".str_replace(" , ", " ", implode("`, `", $this->aColumns))."`
FROM ".$this->db['table']."
WHERE ".$this->db['table']." MATCH 'PATOS' LIMIT 50;
";}
try {
$aResult = $this->query_array($sQuery);
} catch (PDOException $e) {
print "SQL DAtabase Error!: " . $e->getMessage() . "<br/>";
die();
}
/* Data set length after filtering */
//TODO : improve efficiency currently does 2X query to count total records in query
$sQuery = "SELECT cargos_tot_registros FROM dados_download LIMIT 1";
$aResultTotal = $this->query_array($sQuery);
$aResultTotal = substr(implode("",$aResultTotal[0]), 0);
$iTotal = (int)$aResultTotal;
$sQuery = "SELECT * FROM dados_download LIMIT 1";
$bdDetalhes = $this->query_array($sQuery);
$bdDetalhes = substr(implode("",$bdDetalhes[0]), 0);
//$iTotal = 1000;
//$iFilteredTotal= $aResultFilterTotal[0]['totalqry'];
//print_r($aResult);
$iFilteredTotal= count($aResult);
/* Total data set length */
//$sQuery = 100;
//$sQuery = "SELECT municipio_tot_registros FROM dados_download LIMIT 1";
//$aResultTotal = $this->query_array($sQuery);
//$aResultTotal = substr(implode("|",$aResultTotal[0]), 25);
//$iTotal = (int)$aResultTotal;
/*
* Output
*/
date_default_timezone_set('America/Recife');
$output = array(
"draw" => intval($_POST['draw']),
"iTotalRecords" => $iTotal,
"iTime" => date('d/m/Y G:i:s ', time()),
"iTotalDisplayRecords" => $iFilteredTotal,
"aaData" => array(),
"bdDetalhes" => $bdDetalhes
);
/* Take the Query Result and resturn JSON encoded String */
foreach ($aResult as $key => $aRow)
{
$row = array();
for ( $i=0 ; $i<count($this->aColumns) ; $i++ )
$row[] = $aRow[ $this->aColumns[$i] ];
$output['aaData'][] = $row;
}
return json_encode( $output );
} //end of function
/********************************************************************
build_jquery_datables: Static function no object needed to instantiate
Builds the Javascript JQuery code to call for the database call use this function
*/
public static function build_jquery_datatable($aDBInfo=null,$table_id="datatable1",$ajax_source_url=null,$datatable_properties=null)
{
$js=null; //Holds the javascript string
$dba=array("a","b");
$ajax_source_url = is_null($ajax_source_url)? basename(__FILE__) : $ajax_source_url;
if (isset($aDBInfo))
$serializd_db=base64_encode(serialize($aDBInfo));
/* Edit Jqeury Here */
$js= <<<EOT
<!-- Start generated Jquery from $ajax_source_url --->
<script type="text/JavaScript" charset="utf-8">
$(document).ready(function() {
var oData=$('#$table_id').dataTable({
language: {
"url": "//cdn.datatables.net/plug-ins/1.10.15/i18n/Portuguese-Brasil.json",
},
ajax: function (data, callback, settings) {
settings.jqXHR = $.ajax( {
"dataType": 'json',
"url": "$ajax_source_url?oDb='$serializd_db'",
"type": "POST",
"data": data,
"success": function (json) {
oData.fnSettings().oLanguage.sInfoPostFix = ' (processado em '+json.iTime+') ';
detalhesArquivo = ''+json.bdDetalhes+''
callback(json)}
});
},
responsive: true,
autoWidth:false,
processing: true,
sortClasses:true,
serverSide: true,
initComplete: function (oSettings, json) {
// Add "Clear Filter" button to Filter
var btnOK = $('<button class="btnOKDataTableFilter">OK</button>');
btnOK.appendTo($('#' + oSettings.sTableId).parents('.dataTables_wrapper').find('.dataTables_filter'));
$('#' + oSettings.sTableId + '_wrapper .btnOKDataTableFilter').click(function () {
oData.fnFilter($("div.dataTables_filter input").val());
});
oData.fnFilterOnReturn();
},
stateSave: false,
deferRender: true,
jQueryUI: true,
scrollInfinite: true,
scrollCollapse: true,
scrolX: true,
sScrollX: "100%",
sScrollXInner: "100%",
scrollY: '72vh',
scrollCollapse: true,
paging: false,
fixedHeader: {
header: false,
footer: false
},
dom:'Bfrtip',
buttons: [
{extend: 'copyHtml5', text: 'Copiar'},
{extend: 'excelHtml5',
text: 'Excel',
customize: function ( xlsx ){
var sheet = xlsx.xl.worksheets['sheet1.xml'];
// muda o cabeçalho para cor verde.
$('row c[r^="L"]', sheet).each( function () {
// Get the value and strip the non numeric characters
$(this).attr( 's', '55' );
$(this).attr( 's', '53' );
}
);
$('row:first c', sheet).attr( 's', '42' );
// ajusta coluna m
}
},
{extend: 'pdfHtml5',
'text': 'PDF',
pageSize: 'A4',
filename : 'Consulta de Cargos no TCE-PB',
title : ' ',
footer : true,
columns:':visible',
newline:'auto',
exportOptions: {
modifier: {
page: 'current',
}
},
customize: function ( doc ) {
doc['footer']=(function(page, pages) {
return {
columns: [
'',
{
alignment: 'right',
text: [ 'Pág. ',
{ text: page.toString(), italics: true },
' de ',
{ text: pages.toString(), italics: true }
]
}
],
margin: [10, 0]
}
}),
doc.defaultStyle.fontSize = 7,
doc.styles.tableHeader.fontSize = 7,
doc.content[1].table.widths = [ '15%', '10%', '15%', '10%', '8%', '8%', '11%','12%','11%'],
doc.pageMargins = [20,30,20,20],
doc.content[0].text = doc.content[0].text.trim(),
doc.content.splice( 1, 0, {
margin: [ 0, 0, 0, 0 ],
alignment: 'left',
image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABI0AAAClCAMAAADmpv1OAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURRYmLBsrNR4wOyYkJyAuNyQyOzQmLTE5PRYmSBYmVRYmbiItRSU1RSw8VDM8RzI9VTQ5Zzo8dhZFdxZSahZSfyxCSS5AVzhBSjJDWjlTWzhJZj1OcD1ZYTxUdEMmLVcmLWgmLXwmLVVKLXFJLUhJTElMVU1QWlJTWkNMZERJeElUaERUd1laZ1Zcd0dlbUxsdE5wd1xieVp1alR0emFdSH9dSGhoVWBgbmRkd2h1amh1dhYmiRYmlhYmqz49gRZFixZFmhZShRZSkhZFpRZokhZmqRZkuBZ5tTRdjDRymjR2sBZ4wkI/ikVEiExHmElbhFBPj1BMnFRZhldXmFJOoVpWpk1gjE9ikFxjhlRnl1d6g1ptoV1xqGFdrGJesGprhWZqlmtyh2xxmHBxjHZ2l2dmqGpmtWJ0rGZ6uHFsr3Fuunx8o3d1t3l3whaFyRaW0Rar3TSQzDSk2F2CiUiFsWCEjmSLk2qTm32FjH2CmWiNp26YoWiVu3+Brn6CtHObp3iYtXupsVKQy1mq3FW15G2Bw2ifxHGFyXiN1nipznG56HfC637H8pImLaUmLZZFLY9hLY95LZpoLatFLaxoLZdzS5N1Z614SKx1d4F+uK1/jIB+yJ2GLY+Dd7GGT7uGd7eaeMOGLcuTLdKfLdmrLcWOTMeSd9WmSNOobeGwSOG3Y+e5f4+DhYWMl4uSnIKCq4iIt4+RrY+QtZOYp5SUuIOzvKWYhbuikqequK2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FGOjcK9dDH0nhSimUQsLf8wFFbYAtzGthM09H/8N2rJrsVU7U9Zih1cS1B5eUSJLbyrmLwKgqmxKDQDQGmMj8zhW0kallb/Iwc/Jh3j0ITZa+Vrawx027WmxlIfSfuATXOotNMpxeaCVr+EY4iGKYdR5LuAl0tIIa6NgrzxJ9oR6kOMcnmA7/m4KX7ysln6S7FW6jWkl9Ly8vhRTn3lOzXu4TGyUuJKg9vCKLlDPqb3149JsuSvc0Jd8RZkUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGSxAAA47ZHueppRKv0fAj0ucjKrrs4AAAAASUVORK5CYII=',
width: 560,
height: 77},
doc.content[1].text = detalhesArquivo ,
);
}
},
{extend: 'print', text: 'Imprim.'}
]
} );
} );
</script>
<!-- End generated Jquery from $ajax_source_url --->
EOT;
return $js; //returns the completed jquery string
}
} //end of class
?>