Location: PHPKode > projects > PHP_CON - PHP Design Framework > PHP_CON_OS/exchange/reserve/userreservelist.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/reserve/userreserve_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']))
	{
		if (isset($response['sqldata']['exchangeitemdb'][0]))
		{
			$tempitemdata = $response['sqldata']['exchangeitemdb'][0];
			$ttem->assign_var("VAR_ITEM_ID", $tempitemdata->getid());
			$ttem->assign_var("VAR_ITEMNAME", $tempitemdata->getitemname());
		}
	}

	if (isset($response['sqldata']) && isset($response['sqldata']['reserveitemdb']))
	{
		$totalitemno = count($response['sqldata']['reserveitemdb']);

		if (isset($response['pageno']))
			$pageno = $response['pageno'];
		else
			$pageno = 1;
		if ($pageno <= 0)
			$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']['reserveitemdb'][$i];
			$tempexchangedata = $response['sqldata']['exchangereservedb'][$i];
			$tempuserdata = $response['sqldata']['userdb'][$i];

			$str_status = "";
			if ($tempexchangedata->getstatus() == ACTIVE)
			{
				$str_status = "";
			}
			elseif ($tempexchangedata->getstatus() == ACCEPTED)
			{
				$str_status = $rb['ACCEPT'];
			}
			elseif ($tempexchangedata->getstatus() == REJECT)
			{
				$str_status = $rb['REJECT'];
			}

			$ttem->assign_block_vars("reserveitemlist", array("ID" => $tempdata->getid(),
				"ITEMNAME" => $tempdata->getitemname(),
				"POSTUSER" => $tempuserdata->getusername(),
				"POSTTIME" => ($tempdata->getposttime() == ""? "---" : $tempdata->getposttime()),
				"STATUS" => $str_status
			));

			if (($str_status == "") && ($tempitemdata->getstatus() == ACTIVE))
			{
				$ttem->assign_block_vars("reserveitemlist.control", array());
			}
		}

		$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