<?php
	require "commonincludefiles.php";
	
	
 		
		//echo $_REQUEST['user_id'];
	
		if($_REQUEST['action'] == "Check")
 		{
				if($_SESSION["VedantnrUserRole"] == 'PowerUser' || $_SESSION["VedantnrUserRole"] == 'Hod' )
				{
					echo "{success:'true'}"; 
					exit;
				}
			
			$sql = "select employee_id from cms_employeemaster where user_id ='".$_SESSION["VedantnrUserId"]."'";
			$sql_res = dbQuery($sql);
			$sql_rec = dbArray($sql_res);
			$faculty_id = $sql_rec[0];
			
	
			$branch_name 	= Escape($_REQUEST['branch_name']);
			$year_name  = Escape($_REQUEST['year_name']);
			$branchyear_name  = Escape($_REQUEST['branchyear_name']);
			$semester_name  = Escape($_REQUEST['semester_name']);
			$subject_name   = Escape($_REQUEST['subject_name']);
			$division_id    = Escape($_REQUEST['division_id']);
			$batch_id 	   = Escape($_REQUEST['batch_id']);
			$lectype 		= Escape($_REQUEST['lectype']);
			$shift1 		 = Escape($_REQUEST['shift1']); 
			
		 $SQL_user = "
				SELECT *
				FROM `cms_subject_allocation`
				WHERE branch_id ='".$branch_name."'
				and year_id ='".$year_name."'
				and branchyear_id ='".$beanchyear_name."'
				and semester_id ='".$semester_name."'
				and subject_id ='".$subject_name."'
				and div_id ='".$division_id."'
				and lectype ='".$lectype."'
				and college_id ='".$_SESSION["VedantnrCollegeId"]."'
				and employee_id ='".$faculty_id."'";
					
			if($batch_id!="")
			{
				$SQL_user.=" and batch_id ='".$batch_id."'";
			}
			
			$RES_user = dbQuery($SQL_user);
			$NOREC_user = dbRows($RES_user);
			/*while($result = dbArray($RES_user))
			{
				$id = $result['employee_id'];
				//echo $id;
			}*/
			
				
	 		if($NOREC_user > 0 )
				echo "{success:'true'}"; 
			else
				echo "{success:'false'}";
		}
		
		
?>
