Former-commit-id: a12c499c80166bf5437b7d795779ba07e1905042
--- a/getAgency.php
+++ b/getAgency.php
@@ -1,31 +1,31 @@
<?php
include_once('include/common.inc.php');
-
function displayValue($key, $value, $mode) {
global $db, $schemas;
if ($mode == "view") {
-if (strpos($key, "_") === 0 || $key== "metadata") return;
+ if (strpos($key, "_") === 0 || $key == "metadata")
+ return;
echo "<tr>";
echo "<td>";
if (isset($schemas['agency']["properties"][$key])) {
- echo $schemas['agency']["properties"][$key]['x-title'] . "<br><small>" . $schemas['agency']["properties"][$key]['description']."</small>";
- }
- echo "</td><td>";
+ echo $schemas['agency']["properties"][$key]['x-title'] . "<br><small>" . $schemas['agency']["properties"][$key]['description'] . "</small>";
+ }
+ echo "</td><td>";
if (is_array($value)) {
echo "<ol>";
foreach ($value as $subkey => $subvalue) {
-
- echo "<li ";
- if (isset($schemas['agency']["properties"][$key]['x-property'])) {
+
+ echo "<li ";
+ if (isset($schemas['agency']["properties"][$key]['x-property'])) {
echo ' property="' . $schemas['agency']["properties"][$key]['x-property'] . '" ';
- } if (isset($schemas['agency']["properties"][$key]['x-itemprop'])) {
+ } if (isset($schemas['agency']["properties"][$key]['x-itemprop'])) {
echo ' itemprop="' . $schemas['agency']["properties"][$key]['x-itemprop'] . '" ';
}
echo " >";
-
+
echo "$subvalue</li>";
}
echo "</ol></td></tr>";
@@ -35,11 +35,15 @@
} else {
echo "<span>";
}
+
if ((strpos($key, "URL") > 0 || $key == 'website') && $value != "") {
- echo "<a ".($key == 'website' ? 'itemprop="url"':'')." href='$value'>$value</a>";
- } else {
- echo "$value</span>";
- }
+ echo "<a " . ($key == 'website' ? 'itemprop="url"' : '') . " href='$value'>$value</a>";
+ } else if ($key == 'abn') {
+ echo "<a href='http://www.abr.business.gov.au/SearchByAbn.aspx?SearchText=$value'>$value</a>";
+ } else {
+ echo "$value";
+ }
+ echo "</span>";
}
echo "</td></tr>";
}
@@ -69,8 +73,7 @@
} else {
echo "<label>$key</label><input class='input-text' type='text' id='$key' name='$key' value='$value'/>";
if ((strpos($key, "URL") > 0 || $key == 'website') && $value != "") {
- echo "<a ".($key == 'website' ? 'itemprop="url"':'')." href='$value'>view</a>";
-
+ echo "<a " . ($key == 'website' ? 'itemprop="url"' : '') . " href='$value'>view</a>";
}
if ($key == 'abn') {
echo "<a href='http://www.abr.business.gov.au/SearchByAbn.aspx?SearchText=$value'>view abn</a>";
@@ -102,7 +105,6 @@
$row[$defaultField] = Array($value);
$row[$defaultField][] = "";
$row[$defaultField][] = "";
-
}
}
}
@@ -149,7 +151,7 @@
$mode = "view";
$rowArray = object_to_array($obj);
-ksort($rowArray);
+ ksort($rowArray);
if ($mode == "edit") {
$row = addDefaultFields($rowArray);
} else {
@@ -182,45 +184,45 @@
};
</script>
<form id="editform" class="nice" method="post">
- <?php
-
- }
- foreach ($row as $key => $value) {
- echo displayValue($key, $value, $mode);
- }
- if ($mode == "view") {
- echo "</table></div>";
- }
- if ($mode == "edit") {
- echo '<input id="submitbutton" type="submit"/></form>';
- }
- } else {
+ <?php
+
+ }
+ foreach ($row as $key => $value) {
+ echo displayValue($key, $value, $mode);
+ }
+ if ($mode == "view") {
+ echo "</table></div>";
+ }
+ if ($mode == "edit") {
+ echo '<input id="submitbutton" type="submit"/></form>';
+ }
+} else {
// show all list
- include_header('Agencies');
- try {
- /* $rows = $db->get_view("app", "showNamesABNs")->rows;
- //print_r($rows);
- foreach ($rows as $row) {
- // print_r($row);
- echo '<li><a href="getAgency.php?id=' . $row->key . '">' .
- (isset($row->value->name) && $row->value->name != "" ? $row->value->name : "NO NAME " . $row->value->abn)
- . '</a></li>';
- } */
- $rows = $db->get_view("app", "byCanonicalName")->rows;
- //print_r($rows);
- echo '<ul>';
- foreach ($rows as $row) {
- // print_r($row);
- echo '<li itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization foaf:Organization" about="getAgency.php?id=' . $row->value->_id . '">
+ include_header('Agencies');
+ try {
+ /* $rows = $db->get_view("app", "showNamesABNs")->rows;
+ //print_r($rows);
+ foreach ($rows as $row) {
+ // print_r($row);
+ echo '<li><a href="getAgency.php?id=' . $row->key . '">' .
+ (isset($row->value->name) && $row->value->name != "" ? $row->value->name : "NO NAME " . $row->value->abn)
+ . '</a></li>';
+ } */
+ $rows = $db->get_view("app", "byCanonicalName")->rows;
+ //print_r($rows);
+ echo '<ul>';
+ foreach ($rows as $row) {
+ // print_r($row);
+ echo '<li itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization foaf:Organization" about="getAgency.php?id=' . $row->value->_id . '">
<a href="getAgency.php?id=' . $row->value->_id . '" rel="schema:url foaf:page" property="schema:name foaf:name" itemprop="url"><span itemprop="name">' .
- $row->value->name
- . '</span></a></li>';
- }
- echo "</ul>";
- } catch (SetteeRestClientException $e) {
- setteErrorHandler($e);
- }
- }
- include_footer();
- ?>
-
+ $row->value->name
+ . '</span></a></li>';
+ }
+ echo "</ul>";
+ } catch (SetteeRestClientException $e) {
+ setteErrorHandler($e);
+ }
+}
+include_footer();
+?>
+
--- a/schemas/agency.json.php
+++ b/schemas/agency.json.php
@@ -6,17 +6,23 @@
"properties" => Array(
"name" => Array("type" => "string", "required" => true, "x-itemprop" => "name", "x-property" => "schema:name foaf:name", "x-title" => "Name", "description" => "Name, most recent and broadest"),
"shortName" => Array("type" => "string", "required" => false, "x-title" => "Short Name", "description" => "Name shortened, usually to an acronym"),
+ "description" => Array("type" => "string", "required" => false, "x-title" => "Description", "description" => "Description of roles and responsiblities of organisation"),
"foiEmail" => Array("type" => "string", "required" => false, "x-title" => "FOI Contact Email", "x-itemprop" => "email", "description" => "FOI contact email if not foi@"),
"sameAs" => Array("type" => "array", "required" => false, "x-property"=>"owl:sameAs","x-title" => "Same As", "description" => "Same as other URLs/URIs for this entity",
"items" => Array("type" => "string")),
"otherNames" => Array("type" => "array", "required" => true, "x-title" => "Past/Other Names", "description" => "Other names for organisation",
"items" => Array("type" => "string")),
+ "positions" => Array("type" => "array", "required" => true, "x-title" => "Political Positions", "description" => "Ministers and Parliamentary Secretaries",
+ "items" => Array("type" => "string")),
"foiBodies" => Array("type" => "array", "required" => true, "x-title" => "FOI Bodies","x-property"=>"schema:members foaf:knows", "description" => "Organisational units within this agency that are subject to FOI Act but are not autonomous",
+ "items" => Array("type" => "string")),
+ "legislation" => Array("type" => "array", "required" => true, "x-title" => "Legislation", "description" => "Legislation administered by or created for the establishment of this organisation",
"items" => Array("type" => "string")),
"orgType" => Array("type" => "string", "required" => true, "x-title" => "Organisation Type", "description" => "Org type based on legal formation via FMA/CAC legislation etc."),
"parentOrg" => Array("type" => "string", "required" => true, "x-title" => "Parent Organisation", "description" => "Parent organisation, usually a department of state"),
"website" => Array("type" => "string", "required" => true, "x-title" => "Website", "x-itemprop" => "url", "x-property" => "schema:url foaf:homepage", "description" => "Website URL"),
"abn" => Array("type" => "string", "required" => true, "x-title" => "Australian Business Number", "description" => "ABN from business register"),
+ "established" => Array("type" => "string", "required" => true, "x-title" => "Date established", "description" => "Date established"),
"employees" => Array("type" => "string", "required" => true, "x-title" => "2010-2011 employees", "description" => "2010-2011 employees"),
"contractListURL" => Array("type" => "string", "required" => true, "x-title" => "Contract Listing", "description" => "Departmental and agency contracts, <a href='http://www.aph.gov.au/senate/pubs/standing_orders/d05.htm'>mandated by the Senate</a>" ),
"budgetURL" => Array("type" => "string", "required" => true,"x-title" => "Budget", "description" => "Portfolio Budget Statements and Portfolio Additional Estimates Statements"),
@@ -55,12 +61,7 @@
"hasCrownCopyright" => Array("type" => "array", "required" => true, "x-title" => "Has Standard Crown Copyright licence", "description" => "Has any page still licenced under the former Commonwealth Copyright Administration",
"items" => Array("type" => "string")),
),
- /* "org":{"type":"object",
- "properties":{
- "organizationName":{"type":"string"},
- "organizationUnit":{"type":"string"}},
- }
- } */
+
);
?>