Added XML and JSON buttons whenever the format is available

git-svn-id: https://rosehill.googlecode.com/svn/branches/php@40 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
inghamn 2010-01-07 16:22:40 +00:00
parent c55ee44134
commit 4abee49536
6 changed files with 72 additions and 1 deletions

View File

@ -18,7 +18,11 @@ if (userIsAllowed('Sections')) {
$name = View::escape($this->cemetery->getName());
echo "
<h1>$name</h1>
<h2>$addButton Sections</h2>
<h2>$addButton Sections
";
include APPLICATION_HOME.'/blocks/html/serviceButtons.inc';
echo "
</h2>
<table>
<thead>
<tr><th></th>

View File

@ -17,6 +17,7 @@
}
?>
Cemeteries
<?php include APPLICATION_HOME.'/blocks/html/serviceButtons.inc'; ?>
</h2>
<ul><?php
foreach ($this->cemeteryList as $cemetery) {

View File

@ -8,6 +8,7 @@
*/
$previousSort = isset($_GET['sort']) ? $_GET['sort'] : 'deceasedDate';
$url = new URL($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
$url->purgeEmptyParameters();
$return_url = $url->__toString();
?>
<div class="interfaceBox">
@ -24,6 +25,7 @@ $return_url = $url->__toString();
}
?>
Interments
<?php include APPLICATION_HOME.'/blocks/html/serviceButtons.inc'; ?>
</h2>
<table>
<thead>

View File

@ -0,0 +1,22 @@
<?php
/**
* Renders buttons for each of the known output formats, pointing to the current URL
*
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
$serviceURL = new URL($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
$serviceURL->purgeEmptyParameters();
$serviceURL->format = 'xml';
echo "
<button type=\"button\" class=\"xml\" onclick=\"window.open('$serviceURL');\">
XML
</button>
";
$serviceURL->format = 'json';
echo "
<button type=\"button\" class=\"json\" onclick=\"window.open('$serviceURL');\">
JSON
</button>
";

View File

@ -0,0 +1,21 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
$cemeteries = array();
foreach ($this->cemeteryList as $cemetery) {
$name = addslashes($cemetery->getName());
$url = addslashes($cemetery->getURL());
$googleMapUrl = addslashes($cemetery->getGoogleMapURL());
$cemeteries[] = "
{ \"id\":\"{$cemetery->getId()}\",
\"name\":\"$name\",
\"url\":\"$url\",
\"googleMapUrl\":\"$googleMapUrl\"
}
";
}
$cemeteries = implode(',',$cemeteries);
echo "[$cemeteries]";

View File

@ -0,0 +1,21 @@
<cemeteries>
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
foreach ($this->cemeteryList as $cemetery) {
$name = View::escape($cemetery->getName());
$url = View::escape($cemetery->getURL());
$googleMapUrl = View::escape($cemetery->getGoogleMapURL());
echo "
<cemetery id=\"{$cemetery->getId()}\">
<name>$name</name>
<url>$url</url>
<googleMapUrl>$googleMapUrl</googleMapUrl>
</cemetery>
";
}
?>
</cemeteries>