Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Member_Model extends BF_Model {
- protected $table = "member";
- protected $key = "iid_member";
- function load_member($id) {
- $this->db->where("member.".$this->key, $id);
- $this->db->join("profil_sekolah", $this->table.".iid_profil_sekolah = profil_sekolah.iid_profil_sekolah");
- $query = $this->db->get($this->table);
- //$query = $this->db->query("select * from member where ".$this->key."=".$id);
- if ($query->num_rows == 1) {
- return $query->row_array();
- }
- return NULL;
- }
- function get_json_member($data) {
- $records = array();
- $records["aaData"] = array();
- $this->db->where(array('profil_sekolah.idelete' => '0', "profil_sekolah.imember" => "1"));
- $this->db->join("profil_sekolah", $this->table.".iid_profil_sekolah = profil_sekolah.iid_profil_sekolah");
- $query = $this->db->get($this->table);
- $itotalrecords = $query->num_rows();
- $idisplaylength = intval($data['iDisplayLength']);
- $idisplaylength = $idisplaylength < 0 ? $itotalrecords : $idisplaylength;
- $idisplaystart = intval($data['iDisplayStart']);
- $secho = intval($data['sEcho']);
- $end = $idisplaystart + $idisplaylength;
- $end = $end > $itotalrecords ? $itotalrecords : $end;
- $records["sStatus"] = "OK"; // pass custom message(useful for getting status of group actions)
- $records["sMessage"] = "Group action successfully has been completed. Well done!"; // pass custom message(useful for getting status of group actions)
- $records["sEcho"] = $secho;
- $records["iTotalRecords"] = $itotalrecords;
- $records["iTotalDisplayRecords"] = $itotalrecords;
- $this->db->join("profil_sekolah", $this->table.".iid_profil_sekolah = profil_sekolah.iid_profil_sekolah");
- $this->db->join("paket", $this->table.".ipaket = paket.iid_paket");
- $this->db->where("profil_sekolah.imember","1");
- if ($this->soft_deletes === TRUE)
- $this->db->where("profil_sekolah.idelete","0");
- $query = $this->db->get($this->table, $idisplaylength,$idisplaystart);
- foreach ($query->result_array() as $row) {
- $straksi = '';
- if ($data['ubah'] == 1)
- $straksi .= '<a href="#" onclick=editdata("' . $row[$this->key] . '") class="btn green btn-xs default" title="Edit"><i class="fa fa-edit"></i></a> ';
- if ($data['hapus'] == 1)
- $straksi .= '<a href="#" onclick=deletedata("' . $row[$this->key] . '") class="btn red btn-xs default" title="Delete"><i class="fa fa-times"></i></a> ';
- $straksi .= '<a href="#" onclick=viewdata("' . $row[$this->key] . '") class="btn blue btn-xs default" title="'.$this->lang->line('preview').'"><i class="fa fa-search"></i></a> ';
- $straksi .= '<a href="#" onclick=importdata("' . $row[$this->key] . '") class="btn btn-xs default" title="'.$this->lang->line('import').'"><i class="fa fa-download"></i></a> ';
- $row['aksi'] = $straksi;
- $row['jumlah_siswa'] = $row['siswa_l'] + $row['siswa_p'];
- $row['jumlah_pegawai'] = $row['pegawai_l'] + $row['pegawai_p'];
- $records["aaData"][] = array(
- $row['cnama_sekolah'],
- $row['ckode'],
- $row['ckabupaten'],
- $row['cpropinsi'],
- $row['dtgl_awal'],
- $row['dtgl_akhir'],
- $row['vnama_paket'],
- $row['jumlah_siswa'],
- $row['jumlah_pegawai'],
- $row['imaks_siswa'],
- $row['imaks_sms'],
- $row['webkey'],
- $row['aksi']
- );
- }
- echo json_encode($records);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment