Location: PHPKode > projects > JaxBlog > JaxBlog/app/admin/admin_calendar/admin_calendar_list.php
<?php

require_once('../../../config.php');
require_once(FOLDER_RELATIVE_COMMON . 'authorization.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 id, ' . databaseGetDate('scheduled_date') . ' AS scheduled_date, title FROM Calendar ORDER BY scheduled_date DESC';
	$rows = databaseGetRows($sql, array());
	
	if (count($rows) == 0) {
		echo '<root></root>' . "\n";
		exit;
	}
	
	$xml .= '<root>' . "\n";
	$xml .= '	<list_titles>' . "\n";
	$xml .= '		<record>ID</record>' . "\n";
	$xml .= '		<record>Scheduled Date</record>' . "\n";
	$xml .= '		<record>Title</record>' . "\n";
	$xml .= '	</list_titles>' . "\n";
	$xml .= '	<list_data>' . "\n";
	
	foreach ($rows as $row) {
		$xml .= '		<record>' . "\n";
		$xml .= '			<a0>' . $row['id'] . '</a0>' . "\n";
		$xml .= '			<a1>' . $row['scheduled_date'] . '</a1>' . "\n";
		$xml .= '			<a2><![CDATA[' . $row['title'] . ']]></a2>' . "\n";
		$xml .= '		</record>' . "\n";
	}
	$xml .= '	</list_data>' . "\n";
	$xml .= '</root>' . "\n";
	
	echo $xml;
	exit;
}


// Show the pages list form.
require_once(FOLDER_RELATIVE_COMMON . 'builder-admin.php');

$header  = '';
$onload  = '';
$onload .= "jaxTableSetSuppressId(); ";
$onload .= "jaxTableSetDateColumn(0, 'table_date'); ";
$onload .= "jaxTableSetLinkColumn(1, 'admin_calendar.php?request=edit&id='); ";
$onload .= "jaxTableRegister('admin_calendar_list.php?request=xml', 'calendarlist');";
$title   = 'Calendar';
$content = 'admin_calendar_list.html';
$page    = buildAdminPage($header, $onload, $title, $content);

echo $page;

?>
Return current item: JaxBlog