[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
BACKUP C 19-12
/
XAMPP74
/
htdocs
/
smk
/
application
/
models
/
akademik
/
[
Home
]
File: Tingkat_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Tingkat_model extends CI_Model{ public $database = 'duakademik'; public $table = 'tingkat'; function __construct(){ parent::__construct(); } function save($data){ $this->db->insert($this->database.'.'.$this->table, $data); } function delete($id){ $this->db->where('id', $id) ->delete($this->database.'.'.$this->table); } function update($data, $id){ $this->db->where('id', $id) ->update($this->database.'.'.$this->table, $data); } function cek_tingkat($tingkat){ $this->db->select('COUNT(*) AS hasil') ->where('tingkat', $tingkat) ->from($this->database.'.'.$this->table); return $this->db->get(); } function get_tingkat_by_id($id){ $this->db->where('id', $id) ->from($this->database.'.'.$this->table) ->limit(1); return $this->db->get(); } function get_all(){ $this->db->from($this->database.'.'.$this->table) ->order_by('urutan', 'ASC'); return $this->db->get(); } function get_next_tingkat($urutan){ $this->db->from($this->database.'.'.$this->table) ->where('urutan >',$urutan) ->order_by('urutan', 'ASC') ->limit(1); return $this->db->get(); } function get_tingkat_kecuali($id){ $this->db->from($this->database.'.'.$this->table) ->where('id !=',$id) ->order_by('urutan', 'ASC'); return $this->db->get(); } function get_tingkat_tertinggi(){ $this->db->from($this->database.'.'.$this->table) ->order_by('urutan', 'DESC') ->limit(1); return $this->db->get(); } function get_all_tingkat($start, $rows, $search){ $this->db->where('(tingkat LIKE "%'.$search.'%" OR keterangan LIKE "%'.$search.'%")') ->from($this->database.'.'.$this->table) ->order_by('urutan', 'ASC') ->limit($rows, $start); return $this->db->get(); } function get_all_tingkat_count($search=null){ if($search==null){ $search=''; } $this->db->select('COUNT(*) AS hasil') ->where('(tingkat LIKE "%'.$search.'%" OR keterangan LIKE "%'.$search.'%")') ->from($this->database.'.'.$this->table); return $this->db->get(); } }