-
Notifications
You must be signed in to change notification settings - Fork 1
/
process.php
52 lines (50 loc) · 1.73 KB
/
process.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
<?php
/**
* @author Rohan Khude
* @github rohankhudedev
*
*/
// DataTables PHP library
include( "plugin/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
$tableName = 'datatables_demo';//or staff
$table_col = array( 'id', 'first_name', 'last_name', 'position', 'email', 'office', 'start_date', 'age', 'salary', 'seq', 'extn' );//column names
$i=0;
$editor = Editor::inst( $db, $tableName )
->fields(
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++]),
Field::inst( $table_col[$i++] ),
Field::inst( $table_col[$i++] )
//->validator( 'Validate::notEmpty' ),
// Field::inst( 'age' )
// ->validator( 'Validate::numeric' )
// ->setFormatter( 'Format::ifEmpty', null ),
// Field::inst( 'salary' )
// ->validator( 'Validate::numeric' )
// ->setFormatter( 'Format::ifEmpty', null ),
// Field::inst( 'start_date' )
// ->validator( 'Validate::dateFormat', array(
// "format" => Format::DATE_ISO_8601,
// "message" => "Please enter a date in the format yyyy-mm-dd"
// ) )
// ->getFormatter( 'Format::date_sql_to_format', Format::DATE_ISO_8601 )
// ->setFormatter( 'Format::date_format_to_sql', Format::DATE_ISO_8601 )
)
->process( $_POST )
->json();