<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Setting_model extends CI_Model {

		public function __construct()
		{
			parent::__construct();
			$this->load->database();
		}	

		//ambil data user
		public function listing()
		{

			$this->db->select('*');
			$this->db->from('setting');
			$this->db->order_by('id','desc');
			$query = $this->db->get();
			return $query->result();			
		}

		//ambil detail data user
		public function setting()
		{

			$this->db->select('*');
			$this->db->from('setting');
			//where
			$this->db->where('tgl_sosialisasi');
			$this->db->order_by('id','desc');
			$query = $this->db->get();
			return $query->row();			
		}

		//ambil detail panitia
		public function panitia()
		{

			$this->db->select('*');
			$this->db->from('setting');
			//where
			$this->db->where('id','1');
			$this->db->order_by('id','desc');
			$query = $this->db->get();
			return $query->row();			
		}

		//ambil tp2
		public function tp2()
		{

			$this->db->select('*');
			$this->db->from('tahun_pelajaran');
			//where
			$this->db->where('id_th','1');
			$this->db->order_by('id_th','desc');
			$query = $this->db->get();
			return $query->row();			
		}

		//ambil detail sosialisasi
		public function sosialisasi()
		{

			$this->db->select('*');
			$this->db->from('jadwal_sosialisasi');
			//where
			$this->db->where('id','0');
			$this->db->order_by('id','desc');
			$query = $this->db->get();
			return $query->row();			
		}

		//ambil detail biayappdb
		public function biayappdb()
		{

			$this->db->select('*');
			$this->db->from('biaya_ppdb');
			//where
			$this->db->where('id_k','0');
			$this->db->order_by('id_k','desc');
			$query = $this->db->get();
			return $query->row();			
		}

		public function pengaturan()
		{
			$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 pengaturan2()
		{
			$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 pengaturan3()
		{
			$this->db->select('*');
			$this->db->from('pengaturan');
			//where
			$this->db->where('pengaturan_slug','menu_edit_tgllahir');
			$this->db->order_by('pengaturan_slug','desc');
			$query = $this->db->get();
			return $query->row();		
		}

		public function pengaturan4()
		{
			$this->db->select('*');
			$this->db->from('pengaturan');
			//where
			$this->db->where('pengaturan_slug','menu_pengumuman');
			$this->db->order_by('pengaturan_slug','desc');
			$query = $this->db->get();
			return $query->row();		
		}

		//ubah biodata
		public function edit($data)
		{
			$this->db->where('pengaturan_slug','menu_edit_ops', $data['pengaturan_value']);
			$this->db->update('pengaturan', $data);
		}

		//ubah password
		public function edit2($data2)
		{
			$this->db->where('pengaturan_slug','menu_edit_psswd', $data2['pengaturan_value']);
			$this->db->update('pengaturan', $data2);
		}

		//ubah tanggal
		public function edit3($data3)
		{
			$this->db->where('pengaturan_slug','menu_edit_tgllahir', $data3['pengaturan_value']);
			$this->db->update('pengaturan', $data3);
		}

		//ubah tanggal
		public function edit4($data4)
		{
			$this->db->where('pengaturan_slug','menu_pengumuman', $data4['pengaturan_value']);
			$this->db->update('pengaturan', $data4);
		}

		//ubah setting
		public function edit5($data)
		{
			$this->db->where('id', '1');
			$this->db->update('setting', $data);
		}

		//ubah sosialisasi
		public function edit6($data)
		{
			$this->db->where('id', '0');
			$this->db->update('jadwal_sosialisasi', $data);
		}

		//ubah sosialisasi
		public function edit7($data)
		{
			$this->db->where('id_k', '0');
			$this->db->update('biaya_ppdb', $data);
		}

		//ubah setting
		public function edit8($data8)
		{
			$this->db->where('id_th', '1');
			$this->db->update('tahun_pelajaran', $data8);
		}
}

/* End of file User_model.php */
/* Location: ./application/models/User_model.php */