<?php   
	require "commonincludefiles.php";
	
	if ($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) {

		
		$objPresentMaster = new PresentMasterMgmt();
		$objPresentMaster->branch_id	= $_REQUEST['branch_hidden'];
		$objPresentMaster->year_id	= $_REQUEST['year_hidden'] ;   
		$objPresentMaster->branchyear_id	= $_REQUEST['branchyear_hidden'] ;   
		$objPresentMaster->semester_id	= $_REQUEST['semester_hidden'] ;   
		$objPresentMaster->subject_id	= $_REQUEST['subject_hidden'] ;   
		$objPresentMaster->day_date		= $_REQUEST['day_date'];
		$objPresentMaster->day_working	= $_REQUEST['working_id'];
		$objPresentMaster->day_comment	= $_REQUEST['day_comment'];
		$objPresentMaster->batch_id		= $_REQUEST["batch_idhidden"];
		$objPresentMaster->lec_id		= $_REQUEST["lec_id"];
	//	$objPresentMaster->div_id		= $_REQUEST["division_id"];
	//	$objPresentMaster->lectype		= $_REQUEST["lectype_hid"];
		//$objPresentMaster->shift		= $_REQUEST["shift"];
		
		if($_REQUEST['act']=='Del')
		{
			$objPresentMaster->day_id		= $_REQUEST["day_id"];
			$objPresentMaster -> delete();
		}
		else
		{
		if($_REQUEST["day_id"] > 0 && $_REQUEST["day_id"] !=""){ 		 
		 	$objPresentMaster->day_id = $_REQUEST["day_id"];
			if($_REQUEST['prestudentids']!=""){
				$objPresentMaster->day_present = substr($_REQUEST['prestudentids'], 0, -1);	
			}
			if($_REQUEST['absstudentids']!=""){
				$objPresentMaster->day_absent = substr($_REQUEST['absstudentids'], 0, -1);												
			}
			$objPresentMaster -> edit();
			echo '{"success":"true","msg":"Data Has Been Saved."}';
		} 
		else{
			if($_REQUEST['prestudentids']!=""){
				$objPresentMaster->day_present = substr($_REQUEST['prestudentids'], 0, -1);	
			}
			if($_REQUEST['absstudentids']!=""){
				$objPresentMaster->day_absent = substr($_REQUEST['absstudentids'], 0, -1);											
			}
			$objPresentMaster -> add();	
			echo '{"success":"true","msg":""}';
		}}
	} 
	else {
		echo '{"success":"false","msg":"session expiry"}';
	}	
?>
