copy dari repo om Irfan

This commit is contained in:
2026-06-13 16:02:07 +10:00
commit db327c0305
5376 changed files with 2770667 additions and 0 deletions
+95
View File
@@ -0,0 +1,95 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class ModelTp extends CI_Model {
public function create($table, $data, $batch = false)
{
if($batch === false){
$insert = $this->db->insert($table, $data);
}else{
$insert = $this->db->insert_batch($table, $data);
}
return $insert;
}
public function update($table, $data, $pk, $id = null, $batch = false)
{
if($batch === false){
$insert = $this->db->update($table, $data, array($pk => $id));
}else{
$insert = $this->db->update_batch($table, $data, $pk);
}
return $insert;
}
public function delete($table, $data, $pk)
{
$this->db->where_in($pk, $data);
return $this->db->delete($table);
}
public function getDataTp($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('tp a');
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID','left');
$this->db->join('kelompok c','c.ANGGOTA_ID=a.ID_TP','left');
}else{
$this->db->select('*');
$this->db->from('tp a');
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID','left');
$this->db->join('kelompok c','c.ANGGOTA_ID=a.ID_TP','left');
$this->db->where(['a.ID_TP' => $id]);
}
return $this->db->get()->result_array();
}
public function getKelompokTp(){
$this->db->select('*');
$this->db->from('tp a');
$this->db->join('kota b','b.ID_KOTA=a.KOTA_ID','left');
$this->db->join('kelompok c','c.ANGGOTA_ID=a.ID_TP','left');
$this->db->group_by('a.ID_TP');
$this->db->where('c.ANGGOTA_ID is NULL');
return $this->db->get()->result_array();
}
public function getDataTpNormal($id = null){
if ($id === null) {
$this->db->select('*');
$this->db->from('tp');
$this->db->where('ID_TP>=3');
}else{
$this->db->select('*');
$this->db->from('tp');
$this->db->where('ID_TP>=3');
}
return $this->db->get()->result_array();
}
public function getDataTpService($id = null){
if ($id === null) {
$this->db->select('*,b.ID_SERVICE');
$this->db->from('tp a');
$this->db->join('service b','b.TP_ID=a.ID_TP');
}else{
$this->db->select('*,b.ID_SERVICE');
$this->db->from('tp a');
$this->db->join('service b','b.TP_ID=a.ID_TP');
$this->db->where(['ID_TP' => $id]);
}
return $this->db->get()->result_array();
}
public function cekPass($id, $pass)
{
$this->db->select('*');
$this->db->from('karyawan');
$this->db->where(['ID_KARYAWAN' => $id]);
$this->db->where(['PASSWORD' => $pass]);
return $this->db->get()->result_array();
}
}
?>