<?php 
class manager_function{

	function manager_get_data($id, $today, $nektweek_date)
	{
	//	$result = "Select * from memo_event";
		if($_SESSION['user_id'] != 0)
		{
		$result	= "SELECT memo_event.user_id,memo_event.memo_event_id,memo_event.event_title, memo_event.start_date, memo_event.description, memo_event.end_date, memo_event.location, memo_conformation.memo_flag,memo_conformation.user_id as con_id
FROM memo_conformation
RIGHT JOIN memo_event
ON memo_event.memo_event_id= memo_conformation.memo_event_id and memo_conformation.user_id = '$id'
where memo_event.user_id = '$id' or memo_event.shared_user_id like '%,$id,%'";
		}else{
		$result	= "SELECT memo_event.user_id,memo_event.memo_event_id,memo_event.event_title, memo_event.start_date, memo_event.description, memo_event.end_date, memo_event.location, memo_conformation.memo_flag,memo_conformation.user_id as con_id
FROM memo_conformation
RIGHT JOIN memo_event
ON memo_event.memo_event_id= memo_conformation.memo_event_id and memo_conformation.user_id = '$id'";
		}
//		echo $result;
//		exit;
		$res = mysql_query($result);
		return $res;
	}

	function get_data_fency($arr)
	{
		$result = "Select * from memo_event where memo_event_id = '$arr'";
		$res = mysql_query($result);
		return mysql_fetch_array($res);
	}
	
	function insert_memo_record($arr)
	{
		if (count($arr > 0))
		{
		$sql = sprintf("Insert into memo_conformation (user_id, memo_event_id, user_email, memo_flag) values('%s','%s','Null','%s')",$arr[1], $arr[2], $arr[0]);
 
		if(mysql_query($sql))
			
			return true;
		else
		
			return "Error: " . mysql_error();
		}	
		
		else
		{return "Error: Please enter the required field values.";}
	}

}

?>