コード例 #1
0
 function index()
 {
     $config['base_url'] = site_url($this->uri->segment(1) . '/index/');
     $config['total_rows'] = $this->db->get($this->tables)->num_rows();
     $config['per_page'] = jmlPaging();
     $page = $this->uri->segment(3) ? $this->uri->segment(3) : 0;
     $this->pagination->initialize($config);
     $data['pagination'] = $this->pagination->create_links();
     $no = 1 + $page;
     $record = $this->mcrud->getList($this->tables, $config['per_page'], $page, 'nama_mainmenu', 'ASC')->result();
     $option = array('data' => 'Option', 'colspan' => 3, 'width' => 30);
     $nomber = array('data' => 'No', 'width' => 15);
     $link = array('data' => 'Link', 'width' => 365);
     $icon = array('data' => 'Icon', 'width' => 65);
     $aktif = array('data' => 'Aktif', 'width' => 65);
     $level = array('data' => 'Level', 'width' => 85);
     $this->table->set_heading($nomber, 'Nama Mainmenu', $level, $link, $icon, $aktif, $option);
     foreach ($record as $r) {
         $pk = $this->pk;
         $aktif = $r->aktif == 'y' ? 'Aktif' : 'Tidak';
         $iconaktif = $edit = array('data' => anchor($this->uri->segment(1) . '/status/y/' . $r->{$pk}, '<span class="fa fa-eye"></span>'), 'width' => 10, 'title' => 'Aktifkan');
         $iconnonaktif = $edit = array('data' => anchor($this->uri->segment(1) . '/status/t/' . $r->{$pk}, '<span class="fa fa-eye-slash"></span>'), 'width' => 10, 'title' => 'Non Aktifkan');
         $icon = $r->aktif == 'y' ? $iconnonaktif : $iconaktif;
         $delete = array('data' => anchor($this->uri->segment(1) . '/delete/' . $r->{$pk}, '<span class="hi hi-trash"></span>', array('onclick' => "return confirm('anda yakin akan menghapus data ini ?')")), 'width' => 10, 'title' => 'Hapus data');
         $edit = array('data' => anchor($this->uri->segment(1) . '/edit/' . $r->{$pk}, '<span class="hi hi-share"></span>'), 'width' => 10, 'title' => 'Edit Data');
         $this->table->add_row($no, strtoupper($r->nama_mainmenu), $this->level($r->level), anchor($r->link, base_url() . '' . $r->link), "<span class='" . $r->icon . "'></span>", $aktif, $icon, $delete, $edit);
         $no++;
     }
     $tmpl = array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" class="table table-bordered responsive-utilities">');
     $this->table->set_template($tmpl);
     $data['table'] = $this->table->generate();
     $data['title'] = $this->title;
     $this->template->load('template', $this->folder . '/view', $data);
 }
コード例 #2
0
 function index()
 {
     $config['base_url'] = site_url($this->uri->segment(1) . '/index/');
     $config['total_rows'] = $this->db->get($this->tables)->num_rows();
     $config['per_page'] = jmlPaging();
     $page = $this->uri->segment(3) ? $this->uri->segment(3) : 0;
     $this->pagination->initialize($config);
     $data['pagination'] = $this->pagination->create_links();
     $no = 1 + $page;
     $record = $this->mcrud->getList($this->tables, $config['per_page'], $page, 'keterangan', 'ASC')->result();
     $option = array('data' => 'Option', 'colspan' => 3, 'width' => 30);
     $nomber = array('data' => 'No', 'width' => 15);
     $this->table->set_heading($nomber, 'Jenis Pembayaran', $option);
     foreach ($record as $r) {
         $pk = $this->pk;
         $delete = array('data' => anchor($this->uri->segment(1) . '/delete/' . $r->{$pk}, '<i class="fa fa-trash-o"></i>', array('onclick' => "return confirm('anda yakin akan menghapus data ini ?')")), 'width' => 10, 'title' => 'Hapus data');
         $edit = array('data' => anchor($this->uri->segment(1) . '/edit/' . $r->{$pk}, '<i class="gi gi-new_window"></i>'), 'width' => 10, 'title' => 'Edit Data');
         $this->table->add_row($no, strtoupper($r->keterangan), $delete, $edit);
         $no++;
     }
     $tmpl = array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" class="table table-bordered responsive-utilities">');
     $this->table->set_template($tmpl);
     $data['table'] = $this->table->generate();
     $data['title'] = $this->title;
     $this->template->load('template', $this->folder . '/view', $data);
 }