293 lines
6.6 KiB
PHP
293 lines
6.6 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Dashboard_model extends CI_Model {
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->database();
|
|
}
|
|
|
|
// Total user
|
|
public function user()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('user2');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total pendaftar
|
|
public function pendaftar()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('tr_formulir');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total formulir
|
|
public function formulir()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('tr_data');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total nilai tes
|
|
public function nilai()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_nilai_tes');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total otkp/mplb
|
|
public function otkp()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_formulir');
|
|
//where
|
|
$this->db->where('kd_kompetensi','MPLB');
|
|
$this->db->order_by('kd_kompetensi','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total tkj/tjkt
|
|
public function tkj()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_formulir');
|
|
//where
|
|
$this->db->where('kd_kompetensi','TJKT');
|
|
$this->db->order_by('kd_kompetensi','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total animasi
|
|
public function animasi()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_formulir');
|
|
//where
|
|
$this->db->where('kd_kompetensi','ANIMASI');
|
|
$this->db->order_by('kd_kompetensi','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total kuliner
|
|
public function kuliner()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_formulir');
|
|
//where
|
|
$this->db->where('kd_kompetensi','KULINER');
|
|
$this->db->order_by('kd_kompetensi','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total lulus
|
|
public function lulus()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_data_pengumuman');
|
|
//where
|
|
$this->db->where('status','LULUS');
|
|
$this->db->order_by('status','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total belum lulus
|
|
public function belumlulus()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_data_pengumuman');
|
|
//where
|
|
$this->db->where('status','BELUM LULUS');
|
|
$this->db->order_by('status','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total gel.1
|
|
public function gel1()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_formulir');
|
|
//where
|
|
$this->db->where('gelombang','Gelombang 1');
|
|
$this->db->order_by('gelombang','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total gel.2
|
|
public function gel2()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_formulir');
|
|
//where
|
|
$this->db->where('gelombang','Gelombang 2');
|
|
$this->db->order_by('gelombang','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total gel
|
|
public function gelombang()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('setting');
|
|
//where
|
|
$this->db->where('id','1');
|
|
$this->db->order_by('gelombang','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total invoice
|
|
public function invoice()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_data_invoice');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total registrasi
|
|
public function registrasi()
|
|
{
|
|
$this->db->select('COUNT(*) AS total');
|
|
$this->db->from('v_rpt_trans_invoice');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
// Total kunjungan
|
|
public function pendaftaran()
|
|
{
|
|
$this->db->select('tgl_trans, COUNT(*) AS total');
|
|
$this->db->from('tr_formulir');
|
|
$this->db->group_by('tgl_trans');
|
|
$this->db->order_by('tgl_trans', 'desc');
|
|
$this->db->limit(14);
|
|
$query = $this->db->get();
|
|
return $query->result();
|
|
}
|
|
|
|
public function user2($no_pendaftaran)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('data_siswa');
|
|
$this->db->where('no_pendaftaran', $no_pendaftaran);
|
|
$this->db->order_by('no_pendaftaran','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function user_login($id)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('user2');
|
|
$this->db->where('id', $id);
|
|
$this->db->order_by('id','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function admin()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('informasi');
|
|
$this->db->where('id', '1');
|
|
$this->db->order_by('id','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function tp()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('setting');
|
|
$this->db->where('id','1');
|
|
$this->db->order_by('tp','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function penguji()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('informasi');
|
|
$this->db->where('id', '3');
|
|
$this->db->order_by('id','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function peserta()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('informasi');
|
|
$this->db->where('id', '3');
|
|
$this->db->order_by('id','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
|
|
public function menu()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('pengaturan');
|
|
//where
|
|
$this->db->where('pengaturan_slug','menu_edit_ops');
|
|
$this->db->order_by('pengaturan_slug','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function menu_psswd()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('pengaturan');
|
|
//where
|
|
$this->db->where('pengaturan_slug','menu_edit_psswd');
|
|
$this->db->order_by('pengaturan_slug','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function sekolah()
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('pengaturan');
|
|
//where
|
|
$this->db->where('pengaturan_slug','sekolah');
|
|
$this->db->order_by('pengaturan_slug','desc');
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
|
|
//ubah peserta
|
|
public function edit($data)
|
|
{
|
|
$this->db->where('no_pendaftaran', $data['no_pendaftaran']);
|
|
$this->db->update('data_siswa', $data);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/* End of file Dashboard_model.php */
|
|
/* Location: ./application/models/Dashboard_model.php */ |