forked from gea-ecobricks/ecobricks-org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax-brk-trans.php
More file actions
110 lines (81 loc) · 2.74 KB
/
ajax-brk-trans.php
File metadata and controls
110 lines (81 loc) · 2.74 KB
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
<?php
/*
* DataTables example server-side processing script.
*
* Please note that this script is intentionally extremely simple to show how
* server-side processing can be implemented, and probably shouldn't be used as
* the basis for a large complex system. It is suitable for simple use cases as
* for learning.
*
* See http://datatables.net/usage/server-side for full details on the server-
* side processing requirements of DataTables.
*
* @license MIT - http://datatables.net/license_mit
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/
// DB table to use
$table = 'vw_brk_tran_ledgerid_desc';
// Table's primary key
$primaryKey = 'chain_ledger_id';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 'chain_ledger_id',
'dt' => 0,
'formatter' => function( $d, $row ) {
return '<a href="details-brk-trans.php?tran_id='.($d).'" target="popup"
onclick="window.open(\'details-brk-trans.php?tran_id='.($d).'\',\'popup\',\'width=600,height=800\'); return false;">'.($d).'</a>';
}
),
array(
'db' => 'send_ts',
'dt' => 1,
'formatter' => function( $d, $row ) {
return ''.date($d).'';
}
),
array( 'db' => 'sender', 'dt' => 2 ),
array( 'db' => 'receiver_or_receivers', 'dt' => 3 ),
array( 'db' => 'block_tran_type', 'dt' => 4 ),
array(
'db' => 'block_amt',
'dt' => 5,
'formatter' => function( $d, $row ) {
return ''.number_format($d,2).' ß';
}
),
array(
'db' => 'individual_amt',
'dt' => 6,
'formatter' => function( $d, $row ) {
return ''.number_format($d,2).' ß';
}
),
array( 'db' => 'ecobrick_serial_no',
'dt' => 7,
'formatter' => function( $d, $row ) {
// return '🔎 <a href="details-ecobrick-page.php?serial_no='.($d).'">'.($d).'</a>';
return ''.($d).'';
}
),
);
// SQL server connection information
$sql_details = array(
'user' => 'ecobricks_russs',
'pass' => '1ecobricks!',
'db' => 'ecobricks_gobrik_msql_db',
'host' => 'localhost'
);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/
require( 'ssp.class.php' );
echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);
?>