public function server_side_wating() { $this->load->library('myencryption'); //$this->db->sql( "SET NAMES 'utf8'" ); $table = 'tbl_student_information'; // Table's primary key $primaryKey = 'auto_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' => 'studentID', 'dt' => 'StudentID'), array('db' => 'studentStatus', 'dt' => ''), array('db' => 'studentNameInKhmer', 'dt' => ''), array('db' => 'studentNameInEnglish', 'dt' => 'FullName', 'formatter' => function ($d, $row) { // Technically a DOM id cannot start with an integer, so we prefix // a string. This can also be useful if you have multiple tables // to ensure that the id is unique with a different prefix return $row['studentNameInKhmer'] . " / " . $row['studentNameInEnglish']; }), array('db' => 'studentGender', 'dt' => 'Gender'), array('db' => 'studentDateofbirth', 'dt' => 'DateOfBirth'), array('db' => 'studentEntryDate', 'dt' => 'EntryDate'), array('db' => 'studentenrollDate', 'dt' => 'EnrollDate'), array('db' => 'auto_id', 'dt' => 'auto_id', 'formatter' => function ($d, $row) { // Technically a DOM id cannot start with an integer, so we prefix // a string. This can also be useful if you have multiple tables // to ensure that the id is unique with a different prefix $vv = base_url() . "student/edit/" . $this->myencryption->encode($d); $view = base_url() . "student/profile/" . $this->myencryption->encode($d); return "<a href='{$view}'>View</a> | <a href='{$vv}'>Edit</a>"; })); $CI =& get_instance(); $CI->load->database(); $sql_details = array('user' => $CI->db->username, 'pass' => $CI->db->password, 'db' => $CI->db->database, 'host' => $CI->db->hostname); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * If you just want to use the basic configuration for DataTables with PHP * server-side, there is no need to edit below this line. */ $this->load->helper('ssp_helper'); echo json_encode(SSP::complex($_GET, $sql_details, $table, $primaryKey, $columns, null, "studentActive = '1'")); }
// DB table to use $table = 'modx_activations'; // Table's primary key $primaryKey = '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' => 'id', 'dt' => 'DT_RowId', 'formatter' => function ($d, $row) { // Technically a DOM id cannot start with an integer, so we prefix // a string. This can also be useful if you have multiple tables // to ensure that the id is unique with a different prefix return 'row_' . $d; }), array('db' => 'act_date', 'dt' => 0, 'formatter' => function ($d, $row) { return !empty($d) ? date('d.m.Y', $d) : ""; }), array('db' => 'pc_id', 'dt' => 1, 'formatter' => function ($d, $row) { global $modx; return $modx->runSnippet('pdoField', array('id' => $d, 'field' => 'pagetitle')); }), array('db' => 'abonent', 'dt' => 2), array('db' => 'bonus_set', 'dt' => 3, 'formatter' => function ($d, $row) { return !empty($d) ? $d . " руб." : ""; })); // SQL server connection information $sql_details = array('user' => 'mgmbee', 'pass' => 'mB915009', 'db' => 'mgm', 'host' => 'node100241-blogger.jelastic.regruhosting.ru'); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 MODX_CORE_PATH . 'components/datatables/server_side/scripts/ssp.class.php'; $beeWhere = array($_POST['beeWhere']); echo json_encode(SSP::complex($_POST, $sql_details, $table, $primaryKey, $columns, null, $beeWhere));
break; case "returns.php": $table = 'loaned_hardware'; $primaryKey = 'eagle_id'; $where = 'checkout_auth = 1'; break; default: $table = 'hardware'; $primaryKey = 'hardware_id'; } /*-----------------------END CONFIG-----------------------*/ //get table columns // 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 $columnNames = get_column_heads($table); $columns = array(); for ($i = 0; $i < count($columnNames); $i++) { $pushArray = array('db' => $columnNames[$i], 'dt' => $i); array_push($columns, $pushArray); } if (isset($joinQuery)) { $results = SSP::simple($_GET, $sqlDetails, $table, $primaryKey, $columns, $joinQuery); } elseif (isset($where)) { $results = SSP::complex($_GET, $sqlDetails, $table, $primaryKey, $columns, $where); } else { $results = SSP::simple($_GET, $sqlDetails, $table, $primaryKey, $columns); } //query and echo results echo json_encode(linkDataTablesID($results, $url));
*/ // DB table to use $table = 'sim_mview'; // Table's primary key $primaryKey = 'song_ID_orig'; // 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' => 'song_ID_orig', 'dt' => 0), array('db' => 'name', 'dt' => 1), array('db' => 'artist', 'dt' => 2), array('db' => 'similarity', 'dt' => 3)); // SQL server connection information $sql_details = array('user' => 'root', 'pass' => '', 'db' => 'test', '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. */ // VJ: added term, #wereAll, ['data'] require 'ssp.class.php'; // Validate the JSONP to make use it is an okay Javascript function to execute $jsonp = preg_match('/^[$A-Z_][0-9A-Z_$]*$/i', $_GET['term']) ? $_GET['term'] : false; //$whereAll = " song_ID_orig = ".$jsonp." limit 5"; $whereAll = " song_ID_orig = '" . urldecode($_GET['term']) . "' and name is not null order by similarity desc"; $v = SSP::complex($_GET, $sql_details, $table, $primaryKey, $columns, null, $whereAll); //echo substr(substr(json_encode($v), 0,-1),1); echo substr(substr(json_encode($v), 0, -1), 1); /* echo '[ {"id":"Nycticorax nycticorax","label":"label - Black-crowned Night Heron","value":"Black-crowned Night Heron"}, {"name":"Roze","label":"46", "value":"lele!"} ]'; */
$primaryKey = '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' => 'title', 'dt' => 0), array('db' => 'date', 'dt' => 1, 'formatter' => function ($d, $row) { return date('Y-m-d', strtotime($d)); })); // SQL server connection information //TODO: make me elegant $url = parse_url(getenv("CLEARDB_DATABASE_URL")); $server = $url["host"]; file_put_contents('php://stderr', print_r("SERVER2222", TRUE)); file_put_contents('php://stderr', print_r($server, TRUE)); $username = $url["user"]; $password = $url["pass"]; $db = substr($url["path"], 1); $sql_details = array('user' => $username, 'pass' => $password, 'db' => $db, 'host' => $server); // user id $id = $_SESSION['id']; // where conditioning for sql query // datatables will load data restrict by user id $whereAll = "id={$id}"; $whereResult = null; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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::complex($_GET, $sql_details, $table, $primaryKey, $columns, null, "userID={$id}"));
<?php header('Access-Control-Allow-Origin: *'); $table = 'alineacion'; $primaryKey = 'NombreUsuario'; $columns = array(array('db' => 'idJugadores', 'dt' => 'idJugadores'), array('db' => 'Posicion', 'dt' => 'Posicion'), array('db' => 'EquipoReal', 'dt' => 'EquipoReal'), array('db' => 'Nombre', 'dt' => 'Nombre'), array('db' => 'PuntosTotales', 'dt' => 'PuntosTotales'), array('db' => 'Valor', 'dt' => 'Valor'), array('db' => 'Alineado', 'dt' => 'Alineado'), array('db' => 'Vendible', 'dt' => 'Vendible'), array('db' => 'NombreUsuario', 'dt' => 'NombreUsuario')); session_start(); $usuario = $_SESSION['usuarios']; $sql_details = array('user' => 'root', 'pass' => '1234', 'db' => 'Comunio', 'host' => 'localhost'); require 'ssp.class.php'; $where = "NombreUsuario='" . $usuario . "'"; echo json_encode(SSP::complex($_GET, $sql_details, $table, $primaryKey, $columns, $where));
if (!$result_sql) { echo 'Invalid query: ' . mysql_error(); } else { echo "success"; } } else { echo 'Invalid query: ' . mysql_error(); } } if ($type == 'get_button_list') { $table = 'share_buttons'; $primaryKey = 'bid'; $columns = array(array('db' => 'b_title', 'dt' => 'b_title'), array('db' => 'b_target_id', 'dt' => 'b_target_id'), array('db' => 'b_content', 'dt' => 'b_content'), array('db' => 'page_id', 'dt' => 'page_id'), array('db' => 'bid', 'dt' => 'bid')); $extraWhere = " shop='" . mysql_real_escape_string($shop) . "' "; require 'ssp.class.php'; $arr = SSP::complex($_POST, $sql_details, $table, $primaryKey, $columns, null, $extraWhere); $json = $arr; print_r(json_encode($json)); } if ($type == 'search_p') { $search_text = trim($_REQUEST['ss']); $search_collection_id = trim($_REQUEST['sc']); $search_type = trim($_REQUEST['st']); $page = trim($_REQUEST['page']); $limit_str = 10; if ($search_type == "all_coll") { $search_peram = "?limit=" . $limit_str . "&page=" . $page; $search_products_data = $sc->call('GET', '/admin/products.json?collection_id=' . $search_collection_id . $search_peram); $total_prod_count = $sc->call('GET', '/admin/products.json?collection_id=' . $search_collection_id); $total_prod_count = intval($total_prod_count); } else {