Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Data_penyedia_model extends CI_Model {
- // -------------------------------
- // -------------------------------
- // Construct
- // -------------------------------
- // ---------------------------- //
- public function __construct()
- {
- parent::__construct();
- }
- // -------------------------------
- // ----------- Selesai -----------
- // ---------------------------- //
- // -------------------------------
- // -------------------------------
- // Main Model
- // -------------------------------
- // ---------------------------- //
- public function get_data_user_by_id($id_user){
- $this->db->select("*");
- $this->db->from("tb_users");
- $this->db->where("id", $id_user);
- $data = $this->db->get();
- return $data;
- }
- // -------------------------------
- // ----------- Selesai -----------
- // ---------------------------- //
- // -------------------------------
- // -------------------------------
- // Table Main
- // Serverside Model
- // -------------------------------
- // ---------------------------- //
- public function select_vw_users_penyedia($id){
- $this->db->select("*");
- $this->db->from("vw_users_penyedia");
- if ($id != "all") {
- $this->db->where("id", $id);
- }
- $this->db->where("is_deleted", "TIDAK");
- $this->db->order_by("id", "DESC");
- $data = $this->db->get();
- return $data;
- }
- public function select_files($id, $id_penyedia, $kode, $date){
- $this->db->select("*");
- $this->db->from("tb_files");
- if ($id != "all") {
- $this->db->where("id", $id);
- }
- if ($id_penyedia != "all") {
- $this->db->where("id_penyedia", $id_penyedia);
- }
- if ($kode != "all") {
- $this->db->where("kode", $kode);
- }
- if ($date != "all") {
- $this->db->where("date_format(tanggal_buat, '%d-%m-%Y') =", $date);
- }
- $this->db->where("is_deleted", "TIDAK");
- $this->db->order_by("id", "DESC");
- $data = $this->db->get();
- return $data;
- }
- public function select_files_rows($id_penyedia, $kode){
- $this->db->select("*");
- $this->db->from("tb_files");
- if ($id_penyedia != "all") {
- $this->db->where("id_penyedia", $id_penyedia);
- }
- if ($kode != "all") {
- $this->db->where("kode", $kode);
- }
- $this->db->where("is_verified", "YA");
- $this->db->where("is_deleted", "TIDAK");
- $this->db->order_by("id", "DESC");
- $data = $this->db->get();
- return $data->num_rows();
- }
- public function get_data_record_by_date($id_penyedia, $date){
- $this->db->select("*");
- $this->db->from("tb_temporary");
- if ($id_penyedia != 'all') {
- $this->db->where("id_penyedia", $id_penyedia);
- }
- if ($date != 'all') {
- $this->db->where("date_format(tanggal, '%d-%m-%Y') =", $date);
- }
- $this->db->where("status", "data_penyedia");
- $this->db->order_by("id", "DESC");
- $data = $this->db->get();
- return $data;
- }
- // -------------------------------
- // ----------- Selesai -----------
- // ---------------------------- //
- // -------------------------------
- // -------------------------------
- // Serverside Model
- // -------------------------------
- // ---------------------------- //
- public function insert_files($data){
- $this->db->insert("tb_files", $data);
- return TRUE;
- }
- public function update_files($id, $data){
- $this->db->where("id", $id);
- $this->db->update("tb_files", $data);
- return TRUE;
- }
- public function update_data_user($id, $data){
- $this->db->where("id", $id);
- $this->db->update("tb_users", $data);
- return TRUE;
- }
- // -------------------------------
- // ----------- Selesai -----------
- // ---------------------------- //
- }
Advertisement
Add Comment
Please, Sign In to add comment