<?php  
	require "commonincludefiles.php";
	
	if($_SESSION["VedantnrCollegeId"]!="" && isset($_SESSION["VedantnrCollegeId"]))
	{
		$objStudentMgmt = new StudentMgmt();
		$objStudentMgmt->student_id 	= $_POST['student_hidden'];
 		$objStudentMgmt->leave_type 		= $_POST['leave_type'];	 
		$objStudentMgmt->leave_date 		= $_POST['leave_date'];
		$objStudentMgmt->leave_reason 		= $_POST['leave_reason'];
		$objStudentMgmt->leave_comment		= $_POST['leave_comment'];
		$objStudentMgmt->UpdateAlumini();
		
		$newyear = intval($_SESSION["VedantnrYearId"]) + 2;
		$objStudentDetailMgmt = new StudentDetailMgmt();
		if($_POST['leave_type'] == 'a')
			{
				$condition1 = "";
				if($_POST['student_hidden'] != "")
					$condition1 .= " and student_id='".$_POST['student_hidden']."'";
				if($_POST['branch_hidden'] != "")
					$condition1 .= " and cur_branchid ='".$_POST['branch_hidden']."'";
					
					 $objStudentDetailMgmt->updatalumini($condition1);
				//dbQuery("update cms_studentdetail set current_active=0 where 1=1".$condition1);
				
				
			}
			
			if($_POST['leave_type'] == 'c')
			{
				
				$condition1 = "";
				if($_POST['student_hidden'] != "")
					$condition1 .= " and student_id='".$_POST['student_hidden']."'";
					if($_POST['branch_hidden'] != "")
					$condition1 .= " and cur_branchid ='".$_POST['branch_hidden']."'";
					if($_POST['year_hidden'] != "")
					$condition1 .= " and  year_id ='".$_POST['year_hidden']."'";
					if($_POST['branchyear_hidden'] != "")
					$condition1 .= " and  cur_branchyearid ='".$_POST['branchyear_hidden']."'";
				if($_POST['semester_hidden'] != "")
					$condition1 .= " and  cur_semesterid ='".$_POST['semester_hidden']."'";
					$objStudentDetailMgmt->updatalumini($condition1);
				//dbQuery("update cms_studentdetail set current_active=0 where 1=1".$condition1);
				
				
			}
		echo '{"success":"true"}';
	}
	else
	{
		echo '{"success":"false","msg":"session expiry"}';
	}
?>