gundambison

controller (1)

May 18th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.08 KB | None | 0 0
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. class User extends CI_Controller {
  6.  
  7.     function __construct() {
  8.         parent::__construct();
  9.         $this->load->model('User_model');
  10.     }
  11.  
  12.     function index() {
  13.         $this->load->view('user_view');
  14.     }
  15.  
  16.     function get_data_user() {
  17.         $post = $this->input->post();
  18.         $list = $this->User_model->get_datatables($post);
  19.         $data = array();
  20.         $no = $post['start'];
  21.         foreach ($list['data'] as $field) {
  22.             $no++;
  23.             $row = array();
  24.             $row[] = $no;
  25.             $row[] = $field->no_rangka;
  26.             $row[] = $field->no_polisi;
  27.             $row[] = $field->model;
  28.             $row[] = $field->type;
  29.             $row[] = $field->transmission;
  30.             $row[] = $field->warna;
  31.             $row[] = $field->tahun;
  32.             $row[] = $field->km;
  33.             $row[] = $field->customer;
  34.             $row[] = $field->telephone;
  35.             $row[] = $field->handphone;
  36.             $row[] = $field->contact_person;
  37.             $row[] = $field->telephone_cp;
  38.             $row[] = $field->cabang_penjual;
  39.             $row[] = $field->cabang_service;
  40.             $row[] = $field->salesman;
  41.             $row[] = $field->last_service;
  42.             $row[] = $field->job;
  43.             $row[] = $field->pekerjaan_utama;
  44.             $row[] = $field->program_promo;
  45.             $row[] = $field->status_aktif;
  46.             $row[] = $field->hasil_fu1;
  47.             $row[] = $field->hasil_fu2;
  48.             $row[] = $field->hasil_fu3;
  49.             $data[] = $row;
  50.         }
  51.  
  52.         $output = array(
  53.             "raw" => array(
  54.                 "sql" => $list['sql'],
  55.                 "input" => $post
  56.             ),
  57.             "draw" => $post['draw'],
  58.             "recordsTotal" => $this->User_model->count_all(),
  59.             "recordsFiltered" => $this->User_model->count_filtered($post),
  60.             "data" => $data,
  61.             "recordsShow" => count($data)
  62.         );
  63.         //output dalam format JSON
  64.         echo json_encode($output);
  65.     }
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment