<? 
ob_start("ob_gzhandler");
session_start();
session_cache_limiter('private');
$cache_limiter 	= session_cache_limiter();
session_cache_expire(60);
$cache_expire 	= session_cache_expire(); 
date_default_timezone_set('Asia/Manila'); 
$CURRENT_DATE 	= date('Y-m-d H:i:s');

include_once('../config/minho.php');
include_once('../config/autoloadClass.php');
$autoload		=	new autoloadClass(); 
$mecon			=	new condbClass();
$userType       = 	$_SESSION['castalia_user_type'];
$username       = 	$_SESSION['castalia_username'];
$resultQuery 		= "SELECT * FROM activity_log ";

if($userType=='admin'){
$sql			=	$resultQuery."  WHERE status='active' AND ActionBy!='$username' ORDER BY Id DESC";
}else{
$sql			=	$resultQuery."  WHERE status='active' AND ActionBy!='$username' AND UserType LIKE '%$userType%' ORDER BY Id DESC";
} 
 

$mecon->query($sql); 



$arr	= array();
$arr2	= array();
$result = $mecon->resultset();
for($a=0; $a<count($result); $a++){  
				$arr['id'] 			= $a+1;
				$arr['posted_date'] = $result[$a]['ActionDate'];
				$arr['content']		= $result[$a]['Remarks'] ." ~ <small><i>".str_replace("_"," ",ucwords($result[$a]['ActionBy']))."</i></small>";
				$arr2[] = $arr;
			}
 
$output = array();
$output['data'] = $arr2;
echo json_encode($output);