<?php 
require "../commonincludefiles.php";
if($_SESSION["cCompany_id"]!="" && isset($_SESSION["cCompany_id"]))
{
	$objProjectMgmt = new ProjectMgmt();
	$limit=0;
	$start=0;
	$condition="";
	
	$sort    = isset($_REQUEST['sort'])   ? $_REQUEST['sort']   : 'project_id';
	$dir     = isset($_REQUEST['dir'])    ? $_REQUEST['dir']    : 'ASC';
	
	$result = $objProjectMgmt->getAllRecords(0,0,$condition,$sort,$dir);
	$total = dbRows($result);
	$i=0;
	$sectionData = array("count" => $total, "rowe" => array());
	if(dbRows($result) > 0){
		$temparray = array();
		while($row = dbArray($result)){
			$temparray["project_id"]  = $row["project_id"];
			$temparray["project_name"]   = $row["project_name"];
			
			$sectionData["rowe"][$i] = $temparray;   
			$i++;
		}										
	}				   		 
 	echo json_encode($sectionData);	
}
?>