<?php
/**
 * applications_model.php class file
 *
 * @package			AIR\Models
 * @version			V2.7.0
 * @copyright		2015, BizyCorp Internal Systems Development
 * @license			private, All rights reserved
 * @author			MRM Roshan <roshan@ekwa.com>
* 
 */
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * This model file maintains tables of application informations
 *
 * Functions available :-
 * 		function __construct() - class constructor
 * 		function exists() - checks for existing primary key
 * 		function get_app_data() - gets application data from db 

 *  Creation date     :- Jun 5, 2014
 *	Last Modified on  :-
 * 	Last Modification :-
 * 
 * @package    AIR\Models
 * @author     Mohamed Ruzaik Mohamed Roshan <roshan@ekwa.com>
 * @version    V 2.7.0
 * @created    Jun 5, 2014
 */
class Applications_model extends CI_Model{

	
	/**
	 * Abstract __construct function
	 * 
	 * Constructor method
	 */
	function __construct()
	{				
		parent::__construct();
		
	}//end of function
	
	
	/**
	 * exists($primekey)
	 * 
	 * This function checks for existing record information for a given data
	 * 
	 * @param array $primekey
	 * @return boolean
	 */
	function exists($primekey)
	{		
	
		$this->db->from('ar_applications');
		foreach ($primekey as $k=>$v){
			$this->db->where($k,$v);
		}
		$query = $this->db->get();
		$num_rows = $query->num_rows();		
		$exist = ($num_rows > 0 )? true : false;
		
		return $exist;		
	
	}//end of function
	

	/**
	 * get_app_data($data)
	 * 
	 * This function gets app information form table for a given ids
	 * 
	 * @param array $data - id fields
	 */
	function get_app_data($data)
	{
	
		//$query = $this->db->get_where('ar_applications', $data, 1, 0);
		
		$this->db->select('*');
		$this->db->from('ar_applications');
		$this->db->where($data);		
		$query = $this->db->get();
		
		return $query->result_array();
  	  
	}//end of function
  
}//end of class
?>