<?php

class DirectorSetup {

	/*************************************************
	/ This function add new Director Setup
	*************************************************/
	
	public static function AddDirectorSetup($data) {
		global $db;
				
		$id = $db->query_insert(TABLE_DIRECTOR_SETUP, $data);
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			return $id;
		}else{
			return false;
		}
	
	} // AddDirector

	/*************************************************
	/ This function update Director
	*************************************************/
	
	public static function UpdateDirectorSetup($pid,$data) {
		global $db;
				
		$id = $db->query_update(TABLE_DIRECTOR_SETUP,$data,"id='$pid'");
		
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			
			return $id;
		}else{
			return $id;
		}
	
	} // UpdateDirector


	public static function GetDirectorSetupById($id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_DIRECTOR_SETUP." WHERE id ='$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//Director


	public static function CheckDirectorName($name, $id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_DIRECTOR_SETUP." WHERE name ='$name' && id <> '$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//Director
	
	/**********************************************************
	/ This function will return DirectorSetup
	**********************************************************/
		
	public static function GetDirectorSetupList($filter="",$pageno="null",$pagesize="null") {
	
		global $db;
		$query = "SELECT * from ".TABLE_DIRECTOR_SETUP." ". $filter;
		//print($query);exit;
		$rows = $db->fetch_all_array($query,$pageno,$pagesize);
	
			if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//DirectorSetup

	public static function GetNumRows() { global $db; return $db->GetNumRows(); }
	public static function GetNumberOfPages() { global $db; return $db->GetNumberOfPages(); }
		
	
}

?>
