Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') or exit('No direct script access allowed');
- class Auth extends CI_Controller
- {
- public function __construct()
- {
- parent::__construct();
- $this->load->model('auth/auth_m', 'authm');
- }
- public function registration_list()
- {
- $role_ids = $this->authm->get_list_role();
- $opt = array('' => 'Pilih Role');
- foreach ($role_ids as $role_id) {
- if($role_id == 1) {
- $role = "Administrator";
- }
- if($role_id == 2) {
- $role = "Member";
- }
- $opt[$role_id] = $role;
- }
- $is_actives = $this->authm->get_list_active();
- $opt2 = array('' => 'Pilih Status');
- foreach ($is_actives as $is_active) {
- if($is_active == 0) {
- $status = "Aktif";
- }
- if($is_active == 1) {
- $status = "Tidak Aktif";
- }
- $opt2[$is_active] = $status;
- }
- $data['form_role'] = form_dropdown('', $opt, '', 'class="form-control" id="role"');
- $data['form_status'] = form_dropdown('', $opt2, '', 'class="form-control" id="status"');
- $this->load->view('auth/registration_list', $data);
- }
- public function ajax_list()
- {
- $list = $this->authm->get_datatables();
- $data = array();
- $no = $_POST['start'];
- foreach ($list as $admin_panel) {
- $no++;
- $row = array();
- $row[] = $no;
- $row[] = $admin_panel->name;
- $row[] = $admin_panel->username;
- $row[] = $admin_panel->email;
- $row[] = $admin_panel->role_id;
- $row[] = $admin_panel->is_active;
- $row[] = 'TES';
- $data[] = $row;
- }
- $output = array(
- "draw" => $_POST['draw'],
- "recordsTotal" => $this->authm->count_all(),
- "recordsFiltered" => $this->authm->count_filtered(),
- "data" => $data,
- );
- //Output To JSON Format
- echo json_encode($output);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement