Esempio n. 1
3
 function get_rkakl_view($table, $primaryKey, $columns)
 {
     $config = new config();
     $sql_details = $config->sql_details();
     require 'ssp.class.php';
     echo json_encode(SSP::simple($_POST, $sql_details, $table, $primaryKey, $columns, date("Y")));
 }
 public function ajax_list($limit = 0)
 {
     $post = $this->input->post();
     $export = false;
     if (isset($post["isExport"])) {
         $post = json_decode($post["lastPost"], true);
         $export = $post["export"] = true;
     }
     $columns = array(array('db' => 'name', 'dt' => 0), array('db' => 'role', 'dt' => 1), array('db' => 'email', 'dt' => 2), array('db' => 'creation_date', 'dt' => 3, 'formatter' => function ($d, $row) {
         return date('jS M y', strtotime($d));
     }), array('db' => 'id', 'dt' => 4, 'formatter' => function ($d, $row) {
         $op = array();
         if (hasAccess("adminusers", "edit")) {
             $op[] = '<a href="' . site_url('admin/adminusers/edit/' . $d) . '" class="fa fa-edit"></a> ';
         }
         /*if (hasAccess("adminusers","delete"))
         		$op[] = '<a href="javascript:void(0);" onclick="delete_user('.$d.')" class="fa fa-trash-o"></a>';*/
         return implode(" / ", $op);
     }));
     if (!$export) {
         echo json_encode(SSP::simple($post, ADMIN, "id", $columns));
         exit;
     } else {
         $exportColumns = array("name" => "Name", "role" => "Role", "email" => "Email");
         $data = SSP::simple($post, ADMIN, "id", $columns);
         $this->load->library("excel");
         $this->excel->setActiveSheetIndex(0);
         $this->excel->stream('adminusers.xls', $data, $exportColumns);
     }
 }
Esempio n. 3
1
 function get_table_exjoin($table, $primaryKey, $columns, $join, $where)
 {
     $config = new config();
     $sql_details = $config->sql_details();
     require 'ssp.customized.class.php';
     echo json_encode(SSP::simple($_POST, $sql_details, $table, $primaryKey, $columns, $join, $where));
 }
 public function ajax_list($limit = 0)
 {
     $post = $this->input->post();
     $export = false;
     if (isset($post["isExport"])) {
         $post = json_decode($post["lastPost"], true);
         $export = $post["export"] = true;
     }
     $i = 0;
     $columns = array(array('db' => 'cm_uname', 'dt' => $i++), array('db' => 'cm_uemail', 'dt' => $i++), array('db' => 'cm_umobile', 'dt' => $i++), array('db' => 'cm_ucity', 'dt' => $i++), array('db' => 'cm_ucomment', 'dt' => $i++), array('db' => 'cm_date', 'dt' => $i++, 'formatter' => function ($d, $row) {
         return date('jS M y', strtotime($d));
     }), array('db' => 'cm_id', 'dt' => $i++, 'formatter' => function ($d, $row) {
         $op = array();
         if (hasAccess("contactrequest", "view")) {
             $op[] = '<a href="javascript:void(0);" onclick="view_contact(' . $d . ')" class="fa fa-list-alt"></a>';
         }
         if (hasAccess("contactrequest", "delete")) {
             $op[] = '<a href="javascript:void(0);" onclick="delete_contact(' . $d . ')" class="fa fa-trash-o"></a>';
         }
         return implode(" / ", $op);
     }));
     if (!$export) {
         echo json_encode(SSP::simple($post, CONTACT, "cm_id", $columns));
         exit;
     } else {
         $exportColumns = array("cm_uname" => "Name", "cm_uemail" => "Email", "cm_umobile" => "Mobile number", "cm_ucity" => "City", "cm_ucomment" => "Message", "cm_date" => "Date");
         $data = SSP::simple($post, CONTACT, "cm_id", $columns);
         $this->load->library("excel");
         $this->excel->setActiveSheetIndex(0);
         $this->excel->stream('contact_request.xls', $data, $exportColumns);
     }
 }
Esempio n. 5
1
 public function getdata()
 {
     $table = '`group`';
     $primaryKey = 'id';
     $columns = array(array('db' => 'id', 'dt' => 'DT_RowId', 'formatter' => function ($d, $row) {
         return 'row_' . $d;
     }, 'field' => 'id'), array('db' => 'id', 'dt' => 0, 'field' => 'id'), array('db' => 'name', 'dt' => 1, 'field' => 'name'), array('db' => 'null', 'dt' => 2));
     require 'ssp.ado.class.php';
     echo json_encode(SSP::simple($this->cfg->dbcnx, $_GET, $table, $primaryKey, $columns, $joinQuery));
 }
Esempio n. 6
1
 function ajax()
 {
     $table = 'v_asignaturas';
     $primaryKey = 'codigo';
     $columns = array(array('db' => 'nombre_area_administrativa', 'dt' => 0), array('db' => 'codigo', 'dt' => 1), array('db' => 'nombre', 'dt' => 2), array('db' => 'codigo', 'dt' => 3, 'formatter' => function ($d, $row) {
         return '<input type="checkbox" name="asignatura_ciclo" value="' . $d . '" onclick="$.ajax({method: \'POST\', url: \'/asignaturas_ciclo/asociar_asignatura_ciclo\', data: { asignatura: \'' . $d . '\'}})">';
     }));
     $sql_details = array('user' => 'root', 'pass' => 'root', 'db' => 'simapro', 'host' => 'localhost');
     require 'ssp.class.php';
     echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
 }
Esempio n. 7
1
 public function get_remote()
 {
     $table = 'access_level';
     // 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' => 'level_name', 'dt' => 0), array('db' => 'description', 'dt' => 1), array('db' => 'indicator', 'dt' => 2));
     // SQL server connection information
     $CI =& get_instance();
     $sql_details = array('user' => $CI->db->username, 'pass' => $CI->db->password, 'db' => $CI->db->database, 'host' => $CI->db->hostname);
     echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
 }
Esempio n. 8
1
        $columns = array(array('db' => 'id', 'dt' => 0), array('db' => 'original_id', 'dt' => 1), array('db' => 'addres', 'dt' => 2), array('db' => 'start_date', 'dt' => 3), array('db' => 'end_date', 'dt' => 4), array('db' => 'task_type_name', 'dt' => 5), array('db' => 'shabloni_name', 'dt' => 6), array('db' => 'first_last_name', 'dt' => 7), array('db' => 'person_name', 'dt' => 8), array('db' => 'prio_name', 'dt' => 9), array('db' => 'note', 'dt' => 10));
        // SQL server connection information
        $sql_details = array('user' => 'root', 'pass' => 'Gl-1114', 'db' => 'asteriskcdrdb', '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.
         */
        mysql_close();
        require '../../../../includes/ssp.class.php';
        if ($_REQUEST[check] != '') {
            $dadebit = "";
        } else {
            $dadebit = "";
        }
        $where_param = "";
        $data = SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $where_param);
        break;
    case 'delete_file':
        mysql_query("DELETE FROM file WHERE id = {$delete_id}");
        $increm = mysql_query("\tSELECT  `name`,\r\n        \t\t\t`rand_name`,\r\n        \t\t\t`id`\r\n        \t\t\tFROM \t`file`\r\n        \t\t\tWHERE   `task_id` = {$edit_id}\r\n        \t\t\t");
        $data1 = '';
        while ($increm_row = mysql_fetch_assoc($increm)) {
            $data1 .= '<tr style="border-bottom: 1px solid #85b1de;">
				          <td style="width:110px; display:block;word-wrap:break-word;">' . $increm_row[name] . '</td>
        			<td ><button type="button" value="media/uploads/file/' . $increm_row[rand_name] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none;background-image:url(\'media/images/get.png\');" id="download" ></button><input type="text" style="display:none;" id="download_name" value="' . $increm_row[rand_name] . '"> </td>
        					<td ><button type="button" value="' . $increm_row[id] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none; background-image:url(\'media/images/x.png\');" id="delete"></button></td>
 					  </tr>';
        }
        $data = array('page' => $data1);
        break;
    case 'up_now':
Esempio n. 9
1
        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));
Esempio n. 10
0
 public function zone_list()
 {
     $sql = 'select * from country_zone';
     $sql_data = $this->usermenumodel->columns($sql);
     $ssp_file = 'IncludeViews/ssp.php';
     require $ssp_file;
     echo json_encode(SSP::simple($_POST, $sql_data['sql_details'], $sql, $sql_data['columns']));
 }
Esempio n. 11
0
 public function usermaster_list()
 {
     $sql = $this->usermastermodel->index();
     $sql_data = $this->usermenumodel->columns($sql);
     $ssp_file = 'IncludeViews/ssp.php';
     require $ssp_file;
     echo json_encode(SSP::simple($_POST, $sql_data['sql_details'], $sql, $sql_data['columns']));
 }
Esempio n. 12
0
 public function menucat_list()
 {
     $sql = 'select menu_category_id,menu_category_name from menu_category';
     $sql_data = $this->usermenumodel->columns($sql);
     $ssp_file = 'IncludeViews/ssp.php';
     require $ssp_file;
     echo json_encode(SSP::simple($_POST, $sql_data['sql_details'], $sql, $sql_data['columns']));
 }
Esempio n. 13
0
 function get_table($tabel, $kunci, $kolom)
 {
     $table = $tabel;
     $primaryKey = $kunci;
     $columns = $kolom;
     $sql_details = array('user' => $this->ci->db->username, 'pass' => $this->ci->db->password, 'db' => $this->ci->db->database, 'host' => $this->ci->db->hostname);
     require 'ssp.class.php';
     echo json_encode(SSP::simple($_POST, $sql_details, $table, $primaryKey, $columns));
 }
Esempio n. 14
0
 public function ajax_list($limit = 0)
 {
     $post = $this->input->post();
     $columns = array(array('db' => 'name', 'dt' => 0), array('db' => 'email', 'dt' => 1), array('db' => 'creation_date', 'dt' => 2, 'formatter' => function ($d, $row) {
         return date('jS M y', strtotime($d));
     }), array('db' => 'id', 'dt' => 3, 'formatter' => function ($d, $row) {
         $op = array();
         $op[] = '<a href="' . site_url('/users/edit/' . $d) . '" class="fa fa-edit"></a> ';
         $op[] = '<a href="javascript:void(0);" onclick="delete_user(' . $d . ')" class="fa fa-trash-o"></a>';
         return implode(" / ", $op);
     }));
     echo json_encode(SSP::simple($post, USER, "id", $columns));
     exit;
 }
Esempio n. 15
0
 public function getOrder()
 {
     $table = 'tx_order';
     $primaryKey = 'id';
     $columns = array(array('db' => '`o`.`id`', 'dt' => 'id', 'formatter' => function ($d, $row) {
         return 'row_' . $d;
     }, 'field' => 'id'), array('db' => '`o`.`show_id`', 'dt' => 'show_id', 'field' => 'show_id'), array('db' => '`o`.`order_time`', 'dt' => 'order_time', 'field' => 'order_time'), array('db' => '`o`.`order_mobile`', 'dt' => 'mobile1', 'field' => 'order_mobile'), array('db' => '`o`.`cared_name`', 'dt' => 'cared_name', 'field' => 'cared_name'), array('db' => '`o`.`cared_gender`', 'dt' => 'cared_gender', 'field' => 'cared_gender'), array('db' => '`h`.`hospital_name`', 'dt' => 'hospital_name', 'field' => 'hospital_name'), array('db' => '`u`.`mobile`', 'dt' => 'mobile2', 'field' => 'mobile'), array('db' => '`o`.`status`', 'dt' => 'status', 'field' => 'status'), array('db' => '`o`.`cid`', 'dt' => 'cid', 'field' => 'cid'));
     $sql_details = array('user' => 'root', 'pass' => 'root', 'db' => 'taixin', 'host' => 'localhost');
     require 'ssp.customized.class.php';
     $joinQuery = "FROM `tx_order` AS `o` JOIN `tx_user` AS `u` ON (`u`.`id` = `o`.`uid`) JOIN  `tx_hospital` AS `h` ON (`h`.`id` = `o`.`hospital_id`)";
     //$extraWhere = "`u`.`salary` >= 90000";
     $extraWhere = '';
     echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery, $extraWhere));
 }
 public function ajax_list($limit = 0)
 {
     $post = $this->input->post();
     $export = false;
     if (isset($post["isExport"])) {
         $post = json_decode($post["lastPost"], true);
         $export = $post["export"] = true;
     }
     $columns = array(array('db' => 'ad.ad_title', 'dt' => 0), array('db' => 'ad.ad_image', 'dt' => 1), array('db' => 'ad.ad_link', 'dt' => 2), array('db' => 'ad.ad_ispaid', 'dt' => 3), array('db' => 'ad.ad_show_on_page', 'dt' => 4), array('db' => 'ad.ad_created_date', 'dt' => 5, 'formatter' => function ($d, $row) {
         return date('jS M y', strtotime($d));
     }), array('db' => 'ad.ad_active', 'dt' => 6, 'formatter' => function ($d, $row) {
         $status = '';
         if ($d == 1) {
             $status = 'Active';
         }
         if ($d == 0) {
             $status = 'Inactive';
         }
         return $status;
     }), array('db' => 'ad.ad_id', 'dt' => 7, 'formatter' => function ($d, $row) {
         $op = array();
         if (hasAccess("advertise", "view")) {
             $op[] = '<a href="javascript:void(0);" onclick="view_ad(' . $d . ')" class="fa fa-list-alt"></a>';
         }
         if (hasAccess("advertise", "edit")) {
             $op[] = '<a href="' . site_url('/admin/advertise/edit/' . $d) . '" class="fa fa-edit"></a>';
         }
         if (hasAccess("advertise", "delete")) {
             $op[] = '<a href="javascript:void(0);" onclick="delete_ad(' . $d . ')" class="fa fa-trash-o">';
         }
         return implode(" / ", $op);
     }));
     #$join[] = array(USER_U,"u.u_id = ad.ad_uid");
     if (!$export) {
         echo json_encode(SSP::simple($post, ADVERTISE_AD, "ad.ad_id", $columns));
         exit;
     } else {
         $exportColumns = array("ad_title" => "Title", "ad_link" => "Link", "ad_ispaid" => "Is Paid", "ad_show_on_page" => "On Page", "ad_active" => "Status", "ad_created_date" => "Created At");
         $data = SSP::simple($post, ADVERTISE_AD, "ad.ad_id", $columns);
         $this->load->library("excel");
         $this->excel->setActiveSheetIndex(0);
         $this->excel->stream('advertise.xls', $data, $exportColumns);
     }
 }
 public function ajax_list($limit = 0)
 {
     $post = $this->input->post();
     $export = false;
     if (isset($post["isExport"])) {
         $post = json_decode($post["lastPost"], true);
         $export = $post["export"] = true;
     }
     $columns = array(array('db' => 'ad.clad_title', 'dt' => 0), array('db' => 'u.u_fname', 'dt' => 1), array('db' => 'r.report_text', 'dt' => 2), array('db' => 'r.created_on', 'dt' => 3, 'formatter' => function ($d, $row) {
         return date('jS M y', strtotime($d));
     }), array('db' => 'r.report_id,r.report_clad_id,ad.clad_active', 'dt' => 4, 'formatter' => function ($d, $row) {
         $report_id = $row['report_id'];
         $clad_id = $row['report_clad_id'];
         $clad_active = $row['clad_active'];
         $op = array();
         if (hasAccess("report", "view")) {
             $op[] = '<a href="javascript:void(0);" onclick="view_ad(' . $clad_id . ')"  title="View" class="fa fa-file-text-o"></a> ';
         }
         if (hasAccess("report", "delete")) {
             $op[] = '<a href="javascript:void(0);" onclick="delete_report(' . $report_id . ')" title="Delete" class="fa fa-trash-o"></a>';
         }
         if (hasAccess("classifiedad", "toggleStatus")) {
             if ($clad_active) {
                 $op[] = '<a href="javascript:void(0);" onclick="toggle_status(' . $clad_id . ')" title="Ad is active" class="fa fa-pause"></a>';
             } else {
                 $op[] = '<a href="javascript:void(0);" onclick="toggle_status(' . $clad_id . ')" title="Ad is inactive" class="fa fa-play"></a>';
             }
         }
         return implode("  &nbsp;&nbsp;  ", $op);
     }));
     $join[] = array(CLASSIFIEDAD_AD, "ad.clad_id = r.report_clad_id");
     $join[] = array(USER_U, "u.u_id = ad.clad_uid");
     if (!$export) {
         echo json_encode(SSP::simple($post, REPORTAD_R, "r.report_id", $columns, $join));
         exit;
     } else {
         $exportColumns = array("clad_title" => "Classified Title", "u_fname" => "User", "report_text" => "Comment", "created_on" => "Reported At", "clad_active" => "Classified Status");
         $data = SSP::simple($post, REPORTAD_R, "r.report_id", $columns, $join);
         $this->load->library("excel");
         $this->excel->setActiveSheetIndex(0);
         $this->excel->stream('report.xls', $data, $exportColumns);
     }
 }
Esempio n. 18
0
 public function get_json()
 {
     $table = 'view_products';
     // 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' => 0), array('db' => 'name', 'dt' => 1, 'formatter' => function ($d, $row) {
         return ucfirst($d);
     }), array('db' => 'sku', 'dt' => 2, 'formatter' => function ($d, $row) {
         return ucfirst($d);
     }), array('db' => 'price', 'dt' => 3, 'formatter' => function ($d, $row) {
         return 'Rs. ' . number_format($d, 2);
     }), array('db' => 'category_name', 'dt' => 4, 'formatter' => function ($d, $row) {
         return ucfirst($d);
     }), array('db' => 'weight', 'dt' => 5), array('db' => 'is_instock', 'dt' => 6, 'formatter' => function ($d, $row) {
         $class = $d == 0 || $d == '' ? 'btn-danger' : 'btn-success';
         $value = $d == 0 || $d == '' ? 0 : 1;
         $result = "<button class='change-stock btn btn-xs btn-status btn-outline " . $class . "''>" . $this->config->item("stock_" . $value) . "</button>";
         return $result;
     }), array('db' => 'is_active', 'dt' => 7, 'formatter' => function ($d, $row) {
         $class = $d == 0 || $d == '' ? 'btn-danger' : 'btn-success';
         $value = $d == 0 || $d == '' ? 0 : 1;
         $result = "<button class='change-status btn btn-xs btn-status " . $class . "''>" . $this->config->item("status_" . $value) . "</button>";
         return $result;
     }), array('db' => 'id', 'dt' => 8, 'formatter' => function ($d, $row) {
         $links = '<a href="' . base_url() . "products/edit/" . base64_encode($d) . '" class="btn btn-info btn-circle" type="button" title="Edit"><i class="fa fa-pencil"></i></a>
                                     <a href="' . base_url() . 'products/delete/' . base64_encode($d) . '" class="delete btn btn-danger btn-circle" type="button" title="Delete"><i class="fa fa-trash"></i></a>';
         return $links;
     }));
     // SQL server connection information
     $sql_details = array('user' => 'root', 'pass' => '', 'db' => 'trade_plus', '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.
      */
     echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
 }
Esempio n. 19
0
 * Please note that this script is intentionally extremely simply 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 = 'massive';
// 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' => 0), array('db' => 'firstname', 'dt' => 1), array('db' => 'surname', 'dt' => 2), array('db' => 'zip', 'dt' => 3), array('db' => 'country', 'dt' => 4));
// SQL server connection information
$sql_details = array('user' => '', 'pass' => '', 'db' => '', 'host' => '');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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 '../../../../examples/server_side/scripts/ssp.class.php';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
Esempio n. 20
0
 * 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 = 'datatables_demo';
// 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' => 'first_name', 'dt' => 0), array('db' => 'last_name', 'dt' => 1), array('db' => 'position', 'dt' => 2), array('db' => 'office', 'dt' => 3), array('db' => 'start_date', 'dt' => 4, 'formatter' => function ($d, $row) {
    return date('jS M y', strtotime($d));
}), array('db' => 'salary', 'dt' => 5, 'formatter' => function ($d, $row) {
    return '$' . number_format($d);
}));
$sql_details = array('user' => '', 'pass' => '', 'db' => '', 'host' => '');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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 $_GET['callback'] . '(' . json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns)) . ');';
<?php

require 'config.php';
// DB table to use
$table = 'statistic';
// Table's primary key
$primaryKey = 'id';
$columns = array(array('db' => 'id', 'dt' => 0, 'field' => 'id', 'as' => 'id'), array('db' => 'tahun', 'dt' => 1, 'field' => 'tahun', 'as' => 'tahun'), array('db' => 'minggu', 'dt' => 2, 'field' => 'minggu', 'as' => 'minggu'), array('db' => 'negeri', 'dt' => 3, 'field' => 'negeri', 'as' => 'negeri'), array('db' => 'daerah', 'dt' => 4, 'field' => 'daerah', 'as' => 'daerah'), array('db' => 'lokasi', 'dt' => 5, 'field' => 'lokasi', 'as' => 'lokasi'), array('db' => 'kes_terkumpul', 'dt' => 6, 'field' => 'kes_terkumpul', 'as' => 'kes_terkumpul'), array('db' => 'tempoh_wabak', 'dt' => 7, 'field' => 'tempoh_wabak', 'as' => 'tempoh_wabak'));
require 'ssp.class.php';
$joinQuery = "";
$extraCondition = "latitude IS NOT NULL";
$groupBy = '';
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery, $extraCondition, $groupBy));
Esempio n. 22
0
            global $base_url;
            
            $cn = '<div class="btn-group">';
            $val = SSP::get_units_details($d);
            if(!$val[0]['is_deleted'])
            {
                if($_GET['edit']==1){
                    $cn .= '<a class="btn btn-xs btn-default" title="" data-toggle="tooltip" href="'.$base_url.'Units/edit/'.$d.'" data-original-title="Edit">
<i class="fa fa-pencil"></i></a>';
                }
                if($_GET['delete']==1){
                    $cn .= '<a class="btn btn-xs btn-danger" title="" data-toggle="tooltip" href="'.$base_url.'Units/delete/'.$d.'" data-original-title="Delete">
<i class="fa fa-times"></i></a>';
                }
            }
            else
            {
                /*$cn .= '<a onclick="confirm(\'Are you sure want to Retrieve?\');" class="btn btn-xs btn-warning" title="" data-toggle="tooltip" href="'.$base_url.'Units/delete/'.$d.'" data-original-title="Retrieve">
<i class="fa fa-undo"></i></a>';*/
				 $cn .= ' ';
            }
            $cn .= '</div>';
                          
            return $cn;
    })
    
);

echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns , $where1, $where2 ,$join)
);
Esempio n. 23
0
 * 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 = 'posts';
// Table's primary key
$primaryKey = 'post_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' => "`n`.`title`", 'dt' => 0, 'field' => 'title', 'as' => 'title'), array('db' => '`n`.`content`', 'dt' => 1, 'field' => 'content'), array('db' => '`u`.`username`', 'dt' => 2, 'field' => 'username'), array('db' => "GROUP_CONCAT(`t`.`tag` SEPARATOR ', ')", 'dt' => 3, 'field' => 'tag', 'as' => 'tag'), array('db' => '`p`.`comment_count`', 'dt' => 4, 'field' => 'comment_count'), array('db' => "CONCAT_WS(',',`n`.`modified`,`n`.`created`)", 'dt' => 5, 'field' => 'date', 'as' => 'date'), array('db' => "`n`.`status`", 'dt' => 6, 'field' => 'status'), array('db' => "`u`.`uri`", 'dt' => 7, 'field' => 'uri'));
$sql_details = array('user' => 'root', 'pass' => 'Singosari123', 'db' => 'emif_framework', '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' );
require 'ssp.customized.class.php';
$joinQuery = 'FROM `posts` AS `p` JOIN `post_types` AS `pt` ON (`p`.`post_type_id` = `pt`.`post_type_id`) JOIN `nodes` AS `n` ON (`p`.`post_id` = `n`.`node_id`) JOIN `users` AS `u` ON (`u`.`user_id` = `n`.`user_id`) LEFT JOIN `tags` AS `t` ON (`p`.`post_id` = `t`.`post_id`)';
$extraWhere = "`n`.`module` = 'post' AND `pt`.`post_type` = '" . $_GET['post'] . "' GROUP BY `p`.`post_id`";
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery, $extraWhere));
Esempio n. 24
0
 function ajax()
 {
     $table = 'v_asignaturas';
     $primaryKey = 'codigo';
     $columns = array(array('db' => 'nombre_area_administrativa', 'dt' => 0), array('db' => 'codigo', 'dt' => 1), array('db' => 'nombre', 'dt' => 2), array('db' => 'codigo', 'dt' => 3, 'formatter' => function ($d, $row) {
         return "<a href=\"/asignaturas/modificar_formulario/{$row['codigo']}\">Modificar</a>";
     }), array('db' => 'codigo', 'dt' => 4, 'formatter' => function ($d, $row) {
         return "<a href=\"/asignaturas/eliminar/{$row['codigo']}\">Eliminar</a>";
     }));
     $sql_details = array('user' => 'root', 'pass' => 'root', 'db' => 'simapro', 'host' => 'localhost');
     require 'ssp.class.php';
     echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
 }
Esempio n. 25
0
$myJoin .= "LEFT JOIN `program_studi` ON `riwayat_pendidikan_dosen`.`kode_program_studi` = `program_studi`.`kode_program_studi`";
$myJoin .= "LEFT JOIN `jenjang_pendidikan` ON `riwayat_pendidikan_dosen`.`kode_jenjang_pendidikan` = `jenjang_pendidikan`.`kode_jenjang_pendidikan`";
$myJoin .= "LEFT JOIN `gelar_akademik` ON `riwayat_pendidikan_dosen`.`gelar_akademik` = `gelar_akademik`.`kode_gelar_akademik`";
// Table's primary key
$primaryKey = "`riwayat_pendidikan_dosen`.`kode_riwayat_pendidikan_dosen`";
// 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' => '`perguruan_tinggi`. `nama_pt`', 'dt' => '0'), array('db' => '`gelar_akademik`. `nama_gelar_akademik`', 'dt' => '1'), array('db' => '`riwayat_pendidikan_dosen`. `tanggal_ijazah`', 'dt' => '2', 'formatter' => function ($d, $row) {
    $converted = explode("-", $d);
    $tanggal = $converted[2] . "-" . $converted[1] . "-" . $converted[0];
    return $tanggal;
}), array('db' => '`jenjang_pendidikan`. `deskripsi`', 'dt' => '3'), array('db' => '`riwayat_pendidikan_dosen`. `kode_riwayat_pendidikan_dosen`', 'dt' => '4', 'formatter' => function ($d, $row) {
    return "<form action='/sid/user/data/edit_riwayat_pendidikan_dosen' method='POST'>" . "<input type='hidden' value='{$d}' name='kode'/>" . "<button class='btn btn-warning col-md-12'>" . "<i class='fa fa-edit'></i>" . "</button>" . "</form>";
}), array('db' => '`riwayat_pendidikan_dosen`. `kode_riwayat_pendidikan_dosen`', 'dt' => '5', 'formatter' => function ($d, $row) {
    return "<button id='{$d}' class='bdelete btn btn-danger col-md-12'>" . "<i class='fa fa-times bdelete'></i>" . "</button>";
}));
// SQL server connection information
$sql_details = array('user' => 'root', 'pass' => '', 'db' => 'sid', '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';
$db = "sid";
$user = "******";
$password = "";
$db = new PDO("mysql:host=localhost;dbname={$db}", $user, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
echo json_encode(SSP::simple($_GET, $db, $table, $primaryKey, $columns, $myJoin, ""));
Esempio n. 26
0
 function viewDataAjax($param)
 {
     $form = $this->modelForm->renderForm($param[0]);
     $field = $form['detail_field'];
     //Mulai Membentuk Kolomnya
     $this->loadExt("ssp.class");
     $kolom = array();
     //echo count($field);
     $i = 0;
     for ($i = 0; $i < count($field); $i++) {
         list($label, $tipe, $other1, $nama_tabel, $fff) = explode(",", $field[$i]['Comment'], 5);
         $kolom[$i]['tipe'] = trim($tipe);
         /////////////// Digunakan untuk memecah comment menjadi sesuatu yang mudah dibaca
         $kolom[$i]["db"] = $field[$i]["Field"];
         if ($i == 0) {
             //untuk menyembunyikan ID
             $kolom[$i]["dt"] = MAX_NUMBER;
         } else {
             $kolom[$i]["dt"] = $i - 1;
         }
         if (strpos($field[$i]['Comment'], "select") && strpos($field[$i]['Comment'], "dimamis")) {
             $kolom[$i]['join']['table'] = $nama_tabel;
             $kolom[$i]['join']['field'] = $fff;
         }
     }
     //echo $i;
     //var_dump($kolom);
     //simple ( $request,  $table, $primaryKey = 'id', $columns,$db )
     /////
     /*
     					nanti parameter $tabel diganti sama Join juga bisa ya , jika select nya itu lebih dari 1 maka akan dijoinkan secara otomatis , TQ
     */
     ///////////////////////// Jangan lupa dibuka /////////////////////
     //simple ( $request,  $table, $primaryKey = 'id', $columns,$db ,$uhome)
     echo json_encode(SSP::simple($_GET, $form["detail_form"]["nama_tabel"], "", $kolom, $this->modelForm->getDB(), $this->url()));
 }
Esempio n. 27
-1
 public function ajax_list($limit = 0)
 {
     $post = $this->input->post();
     $columns = array(array('db' => 'company', 'dt' => 0), array('db' => 'cell_id', 'dt' => 1), array('db' => 'town', 'dt' => 2), array('db' => 'address', 'dt' => 3), array('db' => 'latitude', 'dt' => 4), array('db' => 'longitude', 'dt' => 5), array('db' => 'created_date', 'dt' => 6, 'formatter' => function ($d, $row) {
         return date('jS M y', strtotime($d));
     }), array('db' => 'modified_date', 'dt' => 7, 'formatter' => function ($d, $row) {
         return date('jS M y', strtotime($d));
     }), array('db' => 'id', 'dt' => 8, 'formatter' => function ($d, $row) {
         $op = array();
         $op[] = '<a href="javascript:addedit_cellinfo(' . $d . ');" class="fa fa-edit"></a> ';
         $op[] = '<a href="javascript:void(0);" onclick="delete_cellarea(' . $d . ')" class="fa fa-trash-o"></a>';
         return implode(" / ", $op);
     }));
     echo json_encode(SSP::simple($post, CELLAREA, "id", $columns));
     exit;
 }
Esempio n. 28
-1
 public function list_song()
 {
     $this->layout = null;
     $this->autoRender = false;
     $dataSource = ConnectionManager::getDataSource('default');
     $table = 'musics';
     $primaryKey = 'id';
     $columns = array(array('db' => 'id', 'field' => 'id', 'dt' => 0, 'formatter' => function ($d, $row) {
         return "<input class='checkboxed' type='checkbox' name='userid[]' value='{$d}'/>";
     }), array('db' => 'image', 'field' => 'image', 'dt' => 1, 'formatter' => function ($d, $row) {
         if (empty($d)) {
             // $view = new View();
             // return $view->Html->image('avataruser/avatarDefault.png',array('width'=>'70px','height'=>'70px'));
             return $d;
         } else {
             return "<img src='{$d}' width='70px' height='70px' />";
         }
     }), array('db' => 'id', 'field' => 'id', 'dt' => 2, 'formatter' => function ($d, $row) {
         $str = "<div class='btn-group btn-group-xs'><a href='" . Router::url(array('controller' => 'musics', 'action' => 'edit_song', 'admin' => true, 'id' => $d)) . "' class='btn btn-success'>";
         $str .= "<i class='fa fa-edit'></i></a></div>&nbsp;";
         $str .= "<div class='btn-group btn-group-xs'>";
         $str .= "<button class='btn btn-danger removemusic' title='Xóa bài hát' musicid='" . $d . "' type='button' id='remove-" . $d . "'><i class='fa fa-trash'></i>Xoá</button></div>";
         return $str;
     }), array('db' => 'name', 'field' => 'name', 'dt' => 3, 'formatter' => function ($d, $row) {
         return $d;
     }), array('db' => 'type', 'field' => 'type', 'dt' => 4, 'formatter' => function ($d, $row) {
         return $d;
     }), array('db' => 'idTacgia', 'field' => 'idTacgia', 'dt' => 5, 'formatter' => function ($d, $row) {
         return $d;
     }), array('db' => 'namSangtac', 'field' => 'namSangtac', 'dt' => 6, 'formatter' => function ($d, $row) {
         return $d;
     }), array('db' => 'moTa', 'field' => 'moTa', 'dt' => 7, 'formatter' => function ($d, $row) {
         return $d;
     }), array('db' => 'created', 'field' => 'created', 'dt' => 8, 'formatter' => function ($d, $row) {
         return $d;
     }));
     $sql_details = array('user' => $dataSource->config['login'], 'pass' => $dataSource->config['password'], 'db' => $dataSource->config['database'], 'host' => $dataSource->config['host']);
     App::import('Vendor', 'amnhac/ssp');
     $joinQuery = "FROM musics";
     echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery));
 }
Esempio n. 29
-1
 function ajax()
 {
     $table = 'ciclos';
     $primaryKey = 'id';
     $columns = array(array('db' => 'id', 'dt' => 0), array('db' => 'nombre', 'dt' => 1), array('db' => 'fecha_inicio', 'dt' => 2), array('db' => 'fecha_fin', 'dt' => 3), array('db' => 'paridad', 'dt' => 4), array('db' => 'activo', 'dt' => 5, 'formatter' => function ($d, $row) {
         return $d == 1 ? "Si" : "No";
     }), array('db' => 'id', 'dt' => 6, 'formatter' => function ($d, $row) {
         return "<a href=\"/ciclos/modificar_formulario/{$row['id']}\">Modificar</a>";
     }), array('db' => 'id', 'dt' => 7, 'formatter' => function ($d, $row) {
         return "<a href=\"/ciclos/eliminar/{$row['id']}\">Eliminar</a>";
     }));
     $sql_details = array('user' => 'root', 'pass' => 'root', 'db' => 'simapro', 'host' => 'localhost');
     require 'ssp.class.php';
     echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns));
 }
// 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' => 'name', 'dt' => 0), array('db' => 'is_active', 'dt' => 1));
// SQL server connection information
$sql_details = array('user' => 'xpense', 'pass' => 'xpenseteam', 'db' => 'xpense', 'host' => 'localhost');
# set additional function  here
$detail = true;
$edit = true;
$delete = true;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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.psql.php' );
echo json_encode(SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $detail, $edit, $delete));
/*
 * Helper functions for building a DataTables server-side processing SQL query
 *
 * The static functions in this class are just helper functions to help build
 * the SQL used in the DataTables demo server-side processing scripts. These
 * functions obviously do not represent all that can be done with server-side
 * processing, they are intentionally simple to show how it works. More complex
 * server-side processing operations will likely require a custom script.
 *
 * 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
 */
class SSP