<?php
 	require "commonincludefiles.php";
	error_reporting(1);
	$student_id = [];
	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++)
		{
		
			//$update_fees = "Update cms_feesreceivemaster set year_id='".$_SESSION['aYearId']."' WHERE student_id in($student_id[$i]) and year_id='$year_id[$i]' ";	
			//dbQuery($update_fees);
			$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( $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( $student_id[$i] ) and current_active='0' and year_id='$year_id[$i]'";	
     // dbQuery($qry1);
      
      
		}
		echo '{"success":"true"}';
		exit;
	}
	else
	{
		echo '{"success":"False"}';
		exit;
	}
	
?>



<!--
echo "S ".$selQry = "SELECT * FROM cms_studentdetail WHERE student_id in( $student_id[$i] ) and current_active='0' and year_id='$year_id[$i]'";
$objStdDetail= new StudentDetailMgmt();
$rs = $objStdDetail->getAllRecords($limit=0,$start=0,$condition=" AND student_id in( $student_id[$i] ) and current_active='0' and year_id='$year_id[$i]'",$order_field="",$order_type="");
echo 'Done ' ;
if(dbRows($rs) > 0)
{
	if($row = dbArray($rs)){
		
		$cur_semesterid = $row['cur_semesterid'] + 1;
		echo "I ".$qry1 = "INSERT INTO cms_studentdetail
		                     (current_active,year_id,student_id,cur_branchid,
		                      batch_id,cur_semesterid,cur_divison,college_id,cur_shift)
		              VALUES ('1','".$_SESSION['aYearId']."','".$student_id[$i]."','".$row['cur_branchid']."','".$row['batch_id']."',
		                      '".$cur_semesterid."','".$row['cur_divison']."','".$row['college_id']."','".$row['cur_shift']."')";
    dbQuery($qry1);
	}
}
-->