Advertisement
jamboljack

Users Controller

Nov 19th, 2018
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1. public function data_list()
  2.     {
  3.         $List = $this->users_model->get_datatables();
  4.         $data = array();
  5.         $no   = $_POST['start'];
  6.  
  7.         foreach ($List as $r) {
  8.             $no++;
  9.             $row   = array();
  10.             $link  = site_url('panel/users/editdata/' . $r->user_username);
  11.             $akses = site_url('panel/users/listakses/' . $r->user_username);
  12.             if (($r->user_level == 'Pemroses') || ($r->user_level == 'Ka. Bidang') || ($r->user_level == 'Front Office') || ($r->user_level == 'Ka. Seksi') || ($r->user_level == 'Bendahara')) {
  13.                 $kantor = '<a href="' . $akses . '" title="Hak Akses"><i class="fa fa-list"></i></a>';
  14.             } else {
  15.                 $kantor = '';
  16.             }
  17.  
  18.             $row[] = '  <a href="' . $link . '" title="Edit Data"><i class="icon-pencil"></i></a> ' . $kantor.
  19.                         '<a onclick="hapusData('. $r->user_username . ')" title="Delete Data">
  20.                            <i class="icon-close"></i>
  21.                        </a>';
  22.             $row[] = $no;
  23.             $row[] = trim($r->user_username);
  24.             $row[] = strtoupper(trim($r->user_name));
  25.             $row[] = $r->user_email;
  26.             $row[] = $r->no_telepon;
  27.             $row[] = $r->user_level;
  28.             if ($r->user_status == 'Active') {
  29.                 $row[] = '<span class="label label-success">Active</span>';
  30.             } else {
  31.                 $row[] = '<span class="label label-danger">Non Active</span>';
  32.             }
  33.             $data[] = $row;
  34.         }
  35.  
  36.         $output = array(
  37.             "draw"            => $_POST['draw'],
  38.             "recordsTotal"    => $this->users_model->count_all(),
  39.             "recordsFiltered" => $this->users_model->count_filtered(),
  40.             "data"            => $data,
  41.         );
  42.  
  43.         echo json_encode($output);
  44.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement