<?php
 	require "commonincludefiles.php";
	
	if($_REQUEST["student_id"]!="")
	{
		$student_id = $_REQUEST['student_id'];
		$backdate = $_REQUEST['backdate'];
		
		$student_id = json_decode(stripslashes($student_id));
		
		$year_id = $_REQUEST['year_id'];
		$year_id = json_decode(stripslashes($year_id));		

		for($i=0;$i<count($student_id);$i++)
		{
			$student_id=$student_id[$i];
			$objStudentMgmt= new StudentMgmt();
			$objStudentMgmt->UpdateStudentStatus($student_id, $backdate);
			//$qry = "Update cms_studentmaster set student_active='1',leave_type='',Back_from_detain= '$backdate' WHERE student_id in( ".Escape($student_id[$i])." ) ";
			//dbQuery($qry);	

			$year_id=$year_id[$i];
			$objStudentDetailMgmt= new StudentDetailMgmt();
			$objStudentDetailMgmt->UpdateStudentStatus($student_id, $year_id);
		    //$qry1 = "Update cms_studentdetail set current_active='1',year_id='".$_SESSION['aYearId']."' WHERE student_id in(".Escape($student_id[$i]).") and current_active='0' and year_id= ".Escape($year_id[$i]);	
			//dbQuery($qry1);
		
		
		// $qry2 = "Update cms_feesreceivemaster set year_id='".$_SESSION['aYearId']."' WHERE student_id in( $student_id[$i] ) and year_id='$year_id[$i]'";	
		//dbQuery($qry2);
		}
		echo '{"success":"true"}';
		
	}
	else
	{
		echo '{"success":"False"}';
	}
?>
