<?php
	require "../commonincludefiles.php";
	
	$objcms_circularmasterMgmt= new cms_circularmasterMgmt();
	
	$i=0;
	$order_field="circular_id";
	$order_type="ASC";
	
	$rs = $objcms_circularmasterMgmt->getAllRecords();
	$total = dbRows($rs);
	$circular_Data = array("count" => $total, "data" => array());
	if(dbRows($rs) > 0){
		while($row = dbArray($rs)){
	
			$temparray["circular_id"] = $row["circular_id"];
			$temparray["branch_id"] = $row["branch_id"];
			$temparray["year_id"] = $row["year_id"];
			$temparray["branchyear_id"] = $row["branchyear_id"];
			$temparray["semester_id"]=$row["semester_id"];
			$temparray["all_student_id"] = $row["all_student_id"];
			$temparray["all_employee_id"] = $row["all_employee_id"];
			$temparray["circular_active"] = $row["circular_active"];
			if($row["circular_active"]==1){
				$temparray["circular_active_status"]= "YES";
			}else {
				$temparray["circular_active_status"]= "NO";				
			}
			
			if($row["circular_type"]==1)
			{
				$temparray["circular_type_name"]= "News"; 
				
			}else if($row["circular_type"]==2)
			{
				$temparray["circular_type_name"]= "Circular"; 
				
			}else if($row["circular_type"]==3)
			{
				$temparray["circular_type_name"]= "Notice";
			}

			$temparray["branch_name"] = $row["branch_name"];
			$temparray["year_name"] = $row["year_name"];
			$temparray["branchyear_name"] = $row["branchyear_name"];
			$temparray["semester_name"]=$row["semester_name"];
			$temparray["circular_type"] = $row["circular_type"];
			$temparray["circular_title"] = $row["circular_title"];
			$temparray["circular_subject"] = $row["circular_subject"];
			$temparray["circular_file"] = $row["circular_file"];
			$temparray["circular_start_date"] = $row["circular_start_date"];
			$temparray["circular_end_date"] = $row["circular_end_date"];
			
			
			
			$circular_Data["data"][$i] = $temparray;   
			$i++;
		}
	}
	echo json_encode($circular_Data);	
?>