<?php
	require "../commonincludefiles.php";
	
	$start   = isset($_REQUEST['start'])  ? $_REQUEST['start']  :  0;
	$limit   = isset($_REQUEST['limit'])  ? $_REQUEST['limit']  : 30;
	$sort    = 'news_date';
	$dir     = 'ASC';
	
	$objNewsMgmt = new NewsMgmt();
	
	$arr = array();
	$i=0;
	
	$result = $objNewsMgmt->getAllRecords($limit,$start,$where,$sort,$dir);
	$total = dbRows($result);
	
	$newsData = array("count" => $total, "data" => array());
	
	if	(dbRows($result) > 0) 
	{
		$temparray = array();
		while($row = dbArray($result)){		
			
			$temparray["news_id"]  			= $row["news_id"];
			$temparray["news_title"]    	= $row["news_title"];
			$temparray["news_shortdesc"]    = strip_tags($row["news_shortdesc"]);
			$temparray["news_date"]    		= $row["news_date"];
			
			if($row["news_display"] == 0){
				$temparray["news_display"]    	= "DEO";
			} else{
				$temparray["news_display"]    	= "School";
			}
			
			if($row["news_active"] == 1){
				$temparray["news_active"] 	= "Yes";
			} else{
				$temparray["news_active"]   = "No";
			}
						
			$temparray["news_date"]    		= $row["news_date"];			
			
			$newsData["data"][$i] 			= $temparray;   
			$i++;
		}
	}
	echo json_encode($newsData);	
?>