From: Maxious Date: Thu, 22 Nov 2012 05:06:31 +0000 Subject: Schema updates X-Git-Url: http://maxious.lambdacomplex.org/git/?p=disclosr.git&a=commitdiff&h=410f63a78e3c5eb60a05d9c7a5d889d5717c137a --- Schema updates Former-commit-id: a12c499c80166bf5437b7d795779ba07e1905042 --- --- a/admin/ausbudget/importAusbudget.php +++ /dev/null @@ -1,7 +1,1 @@ -body); - phpQuery::selectDocument($html); - foreach (pq('meta')->elements as $meta) { - - --- /dev/null +++ b/admin/importAusbudget.php @@ -1,1 +1,68 @@ +"; + $html = phpQuery::newDocumentHTML(file_get_contents($dir . $fname)); + phpQuery::selectDocument($html); + foreach (pq('table')->elements as $table) { + $data = Array(); + ////echo "loltable"; + //echo $table->ownerDocument->saveXML($table); + foreach (pq('tr',$table)->elements as $row) { + //echo "lolrow"; + $rowText = pq($row)->text(); + if (strpos($rowText, "Twitter") === false) { + + $key = trim(pq("td:first", $row)->text()); + //echo "$key
"; + $value = trim(str_replace(pq("td:first", $row)->text(), "", pq("td", $row)->text())); + if ($key == "2011-2012" || $key == "2012-2013") { + $eValue = explode("-", $value); + $value = trim(str_replace(Array("$", ",", "\n"), "", $eValue[0])); + } + //echo "$value
"; + $data[$key] = trim(str_replace(Array("\n"), "", $value)); + if ($key == "Source") { + + foreach ($headers as $fieldName) { + if (isset($data[$fieldName])) { + + $csvrow[] = $data[$fieldName]; + } else { + $csvrow[] = ""; + } + } + + fputcsv($fp, array_values($csvrow)); + $data = Array(); + $csvrow = Array(); + } + } + } + } + } + } + } + die; +} +?> + --- a/getAgency.php +++ b/getAgency.php @@ -1,31 +1,31 @@ "; echo ""; if (isset($schemas['agency']["properties"][$key])) { - echo $schemas['agency']["properties"][$key]['x-title'] . "
" . $schemas['agency']["properties"][$key]['description'].""; - } - echo ""; + echo $schemas['agency']["properties"][$key]['x-title'] . "
" . $schemas['agency']["properties"][$key]['description'] . ""; + } + echo ""; if (is_array($value)) { echo "
    "; foreach ($value as $subkey => $subvalue) { - - echo "
  1. "; - + echo "$subvalue
  2. "; } echo "
"; @@ -35,11 +35,15 @@ } else { echo ""; } + if ((strpos($key, "URL") > 0 || $key == 'website') && $value != "") { - echo "$value"; - } else { - echo "$value"; - } + echo "$value"; + } else if ($key == 'abn') { + echo "$value"; + } else { + echo "$value"; + } + echo ""; } echo ""; } @@ -69,8 +73,7 @@ } else { echo ""; if ((strpos($key, "URL") > 0 || $key == 'website') && $value != "") { - echo "view"; - + echo "view"; } if ($key == 'abn') { echo "view abn"; @@ -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 @@ };
- $value) { - echo displayValue($key, $value, $mode); - } - if ($mode == "view") { - echo ""; - } - if ($mode == "edit") { - echo '
'; - } - } else { + $value) { + echo displayValue($key, $value, $mode); + } + if ($mode == "view") { + echo ""; + } + if ($mode == "edit") { + echo ''; + } +} 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 '
  • ' . - (isset($row->value->name) && $row->value->name != "" ? $row->value->name : "NO NAME " . $row->value->abn) - . '
  • '; - } */ - $rows = $db->get_view("app", "byCanonicalName")->rows; - //print_r($rows); - echo '"; + } 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, mandated by the Senate" ), "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"}}, - } - } */ + ); ?>