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

class waqaf_model extends CI_Model{


public function group_all(){
		$this->db->select('a.*');
		$this->db->order_by('a.shortName');
		$this->db->from('wakaf_center a');
		$query = $this->db->get();
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return FALSE;
		}
	}	
public function waqafmaster_id($ID){
	    $this->db->where('companyID', element('compID', $this->session->userdata('logged_in')));
	    $this->db->where('ID', $ID);
		$query = $this->db->get('wakaf_center', 1);		
		if($query->num_rows() == 1){
			return $query->result();
		}else{
			return false;
		}
	}
	
	public function waqafmaster_insert($newwaqaf){
		$sql = $this->db->insert_string('wakaf_center', $newwaqaf);
		$query = $this->db->query($sql);
		if($query === TRUE){
			return TRUE;
		} else {
			$last_query = $this->db->last_query();
			return $last_query;
		}
	}
	public function waqafmaster_edit($updatewaqaf, $ID){
		$this->db->where('ID', $ID);
		$query = $this->db->update('wakaf_center', $updatewaqaf); 
		if($query === TRUE){
			return TRUE;
		} else {
			return FALSE;
		}
	}

	public function waqafmaster_delete($deletewaqaf, $ID){
		$this->db->where('ID', $ID);
		$query = $this->db->update('wakaf_center', $ID); 
		if($query === TRUE){
			return TRUE;
		} else {
			return FALSE;
		}
	}
	public function WaqafCenter_ID($ID){
		$this->db->where('ID', $ID);
		$this->db->from('wakaf_center');
		$query = $this->db->get();
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return FALSE;
		}
	}
	
	
}