[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
xampp
/
htdocs
/
smk
/
application
/
models
/
akademik
/
[
Home
]
File: Thnajaran_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Thnajaran_model extends CI_Model{ public $database = 'duakademik'; public $table = 'thnajaran'; function __construct(){ parent::__construct(); } function save($data){ $this->db->insert($this->database.'.'.$this->table, $data); } function delete($thnajaran){ $this->db->where('thnajaran', $thnajaran) ->delete($this->database.'.'.$this->table); } function update($data, $thnajaran){ $this->db->where('thnajaran', $thnajaran) ->update($this->database.'.'.$this->table, $data); } function update_all($data){ $this->db->update($this->database.'.'.$this->table, $data); } function cek_thnajaran($thnajaran=null){ $this->db->select('COUNT(*) AS hasil') ->where('thnajaran', $thnajaran) ->from($this->database.'.'.$this->table); return $this->db->get(); } function get_thnajaran_by_id($id){ $this->db->where('id', $id) ->from($this->database.'.'.$this->table) ->limit(1); return $this->db->get(); } function get_thnajaran_by_last_ts(){ $this->db->from($this->database.'.'.$this->table) ->order_by('ts', 'DESC') ->limit(1); return $this->db->get(); } function get_thnajaran_by_before_ts($ts){ $this->db->from($this->database.'.'.$this->table) ->where('ts <', $ts) ->order_by('ts', 'DESC') ->limit(1); return $this->db->get(); } function get_all(){ $this->db->select('thnajaran.*, DATE_FORMAT(thnajaran.tglmulai, "%d %M %y") AS tgl', FALSE) ->from($this->database.'.'.$this->table) ->order_by('ts', 'DESC') ->limit(5); return $this->db->get(); } function get_all_thnajaran($start, $rows, $search){ $this->db->where('(thnajaran LIKE "%'.$search.'%")') ->from($this->database.'.'.$this->table) ->order_by('ts', 'DESC') ->limit($rows, $start); return $this->db->get(); } function get_all_thnajaran_count($search=null){ if($search==null){ $search=''; } $this->db->select('COUNT(*) AS hasil') ->where('(thnajaran LIKE "%'.$search.'%")') ->from($this->database.'.'.$this->table); return $this->db->get(); } }