<?php
require "../commonincludefiles.php";

$arr = array();
$total = 0;

if ($_REQUEST['branch_id'] != "" && $_REQUEST['year_id'] != "" && $_REQUEST['batch_id'] != "") {

	 $batch = $_REQUEST['batch_id'];

	$where .= " and sd.current_active = 1 
							and sd.cur_branchid = '" . Escape($_REQUEST['branch_id']) . "' 
							and sd.year_id = '" . Escape($_REQUEST['year_id']) . "' ";

	if ($_REQUEST['semester_id'] != "") {
		$where .= "and sd.cur_semesterid = '" . Escape($_REQUEST['semester_id']) . "'";
	}
	if ($_REQUEST['braanchyear_id'] != "") {
		$where .= "and sd.cur_branchyearid = '" . Escape($_REQUEST['braanchyear_id']) . "'";
	}
	$objStudentMgmt = new StudentMgmt();
	$i = 0;
	$rs = $objStudentMgmt->studentGridFilter5($limit, $start, $where, "student_gturegno", "ASC");
	$total = dbRows($rs);
	$HeadData = array("count" => $total, "data" => array());
	if (dbRows($rs) > 0) {
		while ($row = dbArray($rs)) {
			$temparray["student_id"] = $row["student_id"];
			$temparray["student_name"] = $row["student_name"];
			$temparray["student_gturegno"] = $row["student_gturegno"];

			if ($_REQUEST['batch_id'] == $row["batch_id"]) {
				$temparray["in_batch"] = true;

			} else {
				$temparray["in_batch"] = false;
			}
			$HeadData["data"][$i] = $temparray;
			$i++;
		}
	}

}
echo json_encode($HeadData);
?>