Ejemplo n.º 1
0
 function sessions_ajax()
 {
     if (!$this->input->is_ajax_request()) {
         exit('No direct script access allowed');
     } else {
         $table = '' . DBPREFIX . 'session';
         $primaryKey = 'id';
         $columns = array(array('db' => 'id', 'dt' => 'id'), array('db' => 'ip_address', 'dt' => 'ip_address'), array('db' => 'timestamp', 'dt' => 'timestamp'), array('db' => 'id', 'dt' => 'action', 'formatter' => function ($id) {
             return '<a href="' . base_url('' . $this->uri->segment(1) . '/sessions/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
         }));
         $sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
         $this->output->set_content_type('application/json')->set_output(json_encode(Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns), JSON_PRETTY_PRINT));
     }
 }
Ejemplo n.º 2
0
 function ajax()
 {
     if (!$this->input->is_ajax_request()) {
         exit('No direct script access allowed');
     } else {
         $table = '' . DBPREFIX . 'category';
         $primaryKey = 'id_category';
         $columns = array(array('db' => 'id_category', 'dt' => 'id_category'), array('db' => 'category_name', 'dt' => 'category_name'), array('db' => 'id_category', 'dt' => 'action', 'formatter' => function ($id) {
             return '<a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/view/' . $id) . '" target="_blank" class="btn btn-info btn-xs">View</a> <a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/update/' . $id) . '" class="btn btn-primary btn-xs">Update</a> <a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
         }));
         $sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
         $this->output->set_content_type('application/json')->set_output(json_encode(Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns), JSON_PRETTY_PRINT));
     }
 }
Ejemplo n.º 3
0
 function ajax()
 {
     if (!$this->input->is_ajax_request()) {
         exit('No direct script access allowed');
     } else {
         $table = '' . DBPREFIX . 'session';
         $primaryKey = 'id';
         $columns = array(array('db' => 'id', 'dt' => 'id'), array('db' => 'ip_address', 'dt' => 'ip_address'), array('db' => 'timestamp', 'dt' => 'timestamp', 'formatter' => function ($str) {
             return dateHourIconPrivate(date('Y-m-d H:i:s', $str));
         }), array('db' => 'data', 'dt' => 'data', 'formatter' => function ($str) {
             return '<textarea style="margin: 0px;height: 150px;width: 350px;">' . preg_replace("/[s:]+[0-9]+[:]/", '', preg_replace("/^.+\n/", "", str_replace(';', "\n", str_replace('|', ' : ', $str)))) . '</textarea>';
         }), array('db' => 'id', 'dt' => 'action', 'formatter' => function ($id) {
             return '<a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
         }));
         $sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
         $this->output->set_content_type('application/json')->set_output(json_encode(Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns), JSON_PRETTY_PRINT));
     }
 }