Location: PHPKode > projects > JaxBlog > JaxBlog/app/user/user_scoreboard/user_scoreboard_list.php
<?php

require_once('../../../config.php');
require_once(FOLDER_RELATIVE_COMMON . 'database.php');

// Check for XML request (XMLHttpRequest).
$request = isset($_GET['request']) ? $_GET['request'] : '';
if ($request == 'xml') {
	
	header('Content-Type: text/xml');
	$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' . "\n";
	
	$sql = 'SELECT ' . databaseGetDate('stamp') . ' AS scheduled_date, played_at_home, opponent, team_runs, opponent_runs FROM Games ORDER BY scheduled_date';
	$rows = databaseGetRows($sql, array());
	
	if (count($rows) == 0) {
		echo "<root></root>\n";
		exit;
	}
	
	$xml .= "<root>\n";
	$xml .= "	<list_titles>\n";
	$xml .= "		<record>Scheduled</record>\n";
	$xml .= "		<record>At Home</record>\n";
	$xml .= "		<record>Opponent</record>\n";
	$xml .= "		<record>Team Runs</record>\n";
	$xml .= "		<record>Opponent Runs</record>\n";
	$xml .= "	</list_titles>\n";
	$xml .= "	<list_data>\n";
	
	foreach ($rows as $row) {
		$xml .= "		<record>\n";
		$xml .= "			<a0>" . $row['scheduled_date'] . "</a0>\n";
		$xml .= "			<a1>" . $row['played_at_home'] . "</a1>\n";
		$xml .= "			<a2>" . $row['opponent'] . "</a2>\n";
		$xml .= "			<a3>" . $row['team_runs'] . "</a3>\n";
		$xml .= "			<a4>" . $row['opponent_runs'] . "</a4>\n";
		$xml .= "		</record>\n";
	}
	$xml .= "	</list_data>\n";
	$xml .= "</root>\n";
	
	echo $xml;
	exit;
}

// Display a list of scores for the current season.

require_once(FOLDER_RELATIVE_COMMON . 'refolder.php');
$html = templateRefolderCSSAndJavascript(FILE_TEMPLATE_PAGE);

$header = '';
$header .= "<style type='text/css'> th { font-size: 15px; } td { font-size: 13px; } </style>\n";
$header .= "<script language='JavaScript' type='text/javascript' src='" . FOLDER_RELATIVE_BASE . "module/JaxTable/jax-table.js'></script>\n";
$header .= "<script language='JavaScript' type='text/javascript' src='" . FOLDER_RELATIVE_BASE . "module/common/jax-highlight.js'></script>\n";

$html = str_replace('[Header]', $header, $html);
$html = str_replace('[Onload]', "jaxTableSetDateColumn(0, ''); jaxTableRegister('user_scoreboard_list.php?request=xml', 'scoreboardlist');", $html);
$html = str_replace('[Title]', 'Scoreboard Listing', $html);
$html = str_replace('[Content]', fileRead('user_scoreboard_list.html'), $html);

echo $html;

?>
Return current item: JaxBlog