Location: PHPKode > projects > PHP_CON - PHP Design Framework > PHP_CON_OS/exchange/monitorlist.php
<?PHP
	$rootpath=$_SERVER['DOCUMENT_ROOT'] . "/";
	include_once($rootpath . "common.php");


	$ttem->set_filenames(array("header"=>$rootpath."html_template/header.html"));
	$ttem->set_filenames(array("top_menu"=>$rootpath."html_template/exchange/exchange_menu.html"));
	$ttem->set_filenames(array("body"=>$rootpath."html_template/exchange/monitor_list.html"));

	if (NSession::check_login()==true)
	{
		$ttem->set_filenames(array("pageleft"=>$rootpath."html_template/left_logined.html"));
	}
	else
	{
		$ttem->set_filenames(array("pageleft"=>$rootpath."html_template/left_login.html"));
	}
	$ttem->set_filenames(array("footer"=>$rootpath."html_template/footer.html"));

	$ttem->assign_var("APP_ROOT", $webappcfg['APPPATH']);


	if (isset($response['userid']))
		$ttem->assign_var("VAR_USERID", $response['userid']);
	if (isset($response['status']))
		$ttem->assign_var("VAR_STATUS", $response['status']);

	//echo("<PRE>");
	//print_r($response);
	//echo("</PRE>");

	if (isset($response['sqldata']) && isset($response['sqldata']['exchangeitemdb']))
	{
		$totalitemno = count($response['sqldata']['exchangeitemdb']);
		if (isset($response['pageno']))
		{
			$pageno = $response['pageno'];
			if ($pageno <= 0)
				$pageno = 1;
		}
		else
			$pageno = 1;
		$ttem->assign_var("VAR_PAGENO", $pageno);

		if (isset($response['orderfield']))
			$ttem->assign_var("VAR_ORDERFIELD", $response['orderfield']);
		if (isset($response['orderdirection']))
			$ttem->assign_var("VAR_ORDERDIRECTION", $response['orderdirection']);

		$itemperpage = $webappcfg['EXCHANGEPERPAGE'];
		for ($i = (($pageno-1)*$itemperpage); (($i < $totalitemno) && ($i < (($pageno-1)*$itemperpage+$itemperpage))); $i++)
		{
			$tempdata = $response['sqldata']['exchangeitemdb'][$i];
			$tempuserdata = $response['sqldata']['userdb'][$i];
			$temp = $response['sqldata']['exchange_monitorlistdb'][$i];

			$ttem->assign_block_vars("exchangeitemlist", array("ID" => $tempdata->getid(),
				"ITEMNAME" => $tempdata->getitemname(),
				"POSTUSER" => write_username($tempuserdata->getusername()),
				"VIEWTIMES" => ($tempdata->getviewtimes() == ""? "---" : $tempdata->getviewtimes()),
				"POSTTIME" => ($tempdata->getposttime() == ""? "---" : $tempdata->getposttime()),
				//"EXCHANGETO" => ($tempdata->getgive_userid() == -1? "---" : $tempdata->getgiveobj()->getusername()),
				"MONITORID" => $temp->getid(),
				));
		}

		$totalpageno = floor($totalitemno / $itemperpage) + 1;

		$ttem->assign_var("VAR_TOTALITEM", $totalitemno);
		$ttem->assign_var("VAR_TOTALPAGE", $totalpageno);

		$perpageno = $pageno - 4;
		if ($perpageno < 1)
			$perpageno = 1;
		for ($i = $perpageno; (($i <= $totalpageno) && ($i < ($perpageno + $webappcfg['EXCHANGEPAGELIST']))); $i++)
		{
			$ttem->assign_block_vars("pagenolist", array("PAGE" => $i));
		}

	}
	

	assignlang($ttem);

	$ttem->assign_var_from_handle("PAGE_LEFT_MENU", "pageleft");
	$ttem->assign_var_from_handle("PAGE_EXCHANGE_MENU", "top_menu");

	$ttem->pparse("header");
	$ttem->pparse("body");
	$ttem->pparse("footer");
?>
Return current item: PHP_CON - PHP Design Framework