<?php
	require "../commonincludefiles.php";
 	$arr = array();
 	$total = 0;
	
	if($_REQUEST['branch_id']!="" && $_REQUEST['semester_id']!="")
	{
		$where .= "  and sd.cur_semesterid = '".Escape($_REQUEST['semester_id'])."'";
		if($_REQUEST['batch_id']!='0' && $_REQUEST['batch_id']!="")
		{
			$where .= " and sd.batch_id = ".Escape($_REQUEST['batch_id']);
		}
		if($_REQUEST['branch_id']!= "All")
		     $where .= " and sd.cur_branchid = ".Escape($_REQUEST['branch_id']);
		
		if($_REQUEST['division_id']!= "")
		     $where .= " and sd.cur_divison = '".Escape($_REQUEST['division_id'])."'";
			 
		if($_REQUEST['shift']!= "")
		     $where .= " and sd.cur_shift = '".Escape($_REQUEST['shift'])."'";
			 
		$objStudentMgmt = new StudentMgmt();		
		$i=0;		
		$order_field=" student_surname ASC,student_firstname ";
		$order_type="ASC";
		
		$rs = $objStudentMgmt->studentGridFilter4($limit,$start,$where,$order_field,$order_type);
		$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["studentname"];
				$temparray["student_gturegno"]  = $row["student_gturegno"];
				$temparray["adm_year"]  = $row["adm_year"];
				$temparray["student_techcerti"] = $row["student_techcerti"];
				$HeadData["data"][$i] = $temparray;   
				$i++;
			}
		}
	}
	
	echo json_encode($HeadData);	
?>
