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

class ZakatCenter extends CI_Model{
	
	public function group_all(){
		$this->db->select('a.*');
		$this->db->order_by('a.shortName');
		$this->db->from('zakat_center a');
		$query = $this->db->get();
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return FALSE;
		}
	}
	
	public function ZakatCenter_Insert(){
		$newData = array(
			'shortName' => $this->input->post('shortName'),
			'name' => $this->input->post('name'),
			'line1' => $this->input->post('line1'),
			'line2' => $this->input->post('line2'),
			'line3' => $this->input->post('line3'),
			'city' => $this->input->post('city'),
			'postCode' => $this->input->post('postCode'),
			'stateID' => $this->input->post('state'),
			'countryID' => $this->input->post('country'),
			'noTel' => $this->input->post('noTel'),
			'noFax' => $this->input->post('noFax'),
			'email' => $this->input->post('email'),
			'website' => $this->input->post('website'),
			'createdBy' => element('role', $this->session->userdata('logged_in'))
		);
		$query = $this->db->insert('zakat_center', $newData);
		if($query){
			return $this->db->insert_id();
		}else{
			return FALSE;
		}
	}
	public function ZakatCenter_Update($ID, $data){
		$this->db->where('ID', $ID);
		$query = $this->db->update('zakat_center', $data); 
		if($query === TRUE){
			return $this->db->last_query();
		} else {
			return FALSE;
		}
	}
	public function ZakatCenter_Delete($ID){
		$this->db->where('ID', $ID);
		$query = $this->db->delete('zakat_center'); 
		if($query === TRUE){
			return $this->db->last_query();
		} else {
			return FALSE;
		}
	}
	public function ZakatCenter_ID($ID){
		$this->db->where('ID', $ID);
		$this->db->from('zakat_center');
		$query = $this->db->get();
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return FALSE;
		}
	}
	
	public function ZakatCenter_search($where){
		$this->db->where($where);
		$this->db->from('zakat_center');
		$query = $this->db->get();
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return FALSE;
		}
	}
}

/* End of file ZakatCenter.php */
/* Location: ./application/models/ZakatCenter.php */
/* Created By : Yahaya Abdollah */
