From: maxious Date: Tue, 03 Jan 2012 13:42:56 +0000 Subject: includes/nav cleanup X-Git-Url: https://maxious.lambdacomplex.org/git/?p=disclosr.git&a=commitdiff&h=57d9a0f93d6c9e6f91f471996f1b530175ba7709 --- includes/nav cleanup Former-commit-id: 814e610d82c2640010ae9ead51310519574f6adb --- --- a/about.php +++ b/about.php @@ -1,3 +1,4 @@ + Organisational Data Sources http://www.comlaw.gov.au/Browse/Results/ByTitle/AdministrativeArrangementsOrders/Current/Ad/0 defines departments --- a/common.inc.php +++ /dev/null @@ -1,134 +1,1 @@ -_id = "_design/" . urlencode("app"); - $obj->language = "javascript"; - $obj->views->byABN->map = "function(doc) { emit(doc.abn, doc); };"; - $obj->views->byName->map = "function(doc) { emit(doc.name, doc); };"; - $obj->views->getActive->map = 'function(doc) { if (doc.status == "active") { emit(doc._id, doc); } };'; - $obj->views->getSuspended->map = 'function(doc) { if (doc.status == "suspended") { emit(doc._id, doc); } };'; - $obj->views->getScrapeRequired->map = "function(doc) { emit(doc.abn, doc); };"; -$obj->views->showNamesABNs->map = "function(doc) { emit(doc._id, {name: doc.name, abn: doc.abn}); };"; - // allow safe updates (even if slightly slower due to extra: rev-detection check). - return $db->save($obj, true); -} - -require (realpath(dirname(__FILE__) . '/couchdb/settee/src/settee.php')); - -$server = new SetteeServer('http://127.0.0.1:5984'); - -function setteErrorHandler($e) { - echo $e->getMessage() . "
" . PHP_EOL; -} - -function include_header() { - ?> - - - - - - - - - - - - - - Disclosr - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - array. - $Class = (array)$Class; - - # Iterate through the former properties looking for any stdClass properties. - # Recursively apply (array). - foreach($Class as $key => $value){ - if(is_object($value)&&get_class($value)==='stdClass'){ - $Class[$key] = object_to_array($value); - } - } - return $Class; - } - - # Convert an Array to stdClass. http://www.php.net/manual/en/language.types.object.php#102735 - function array_to_object(array $array){ - # Iterate through our array looking for array values. - # If found recurvisely call itself. - foreach($array as $key => $value){ - if(is_array($value)){ - $array[$key] = array_to_object($value); - } - } - - # Typecast to (object) will automatically convert array -> stdClass - return (object)$array; - } - - - ?> - - - --- a/getAgency.php +++ b/getAgency.php @@ -1,6 +1,6 @@ ') .append("") .append("") - ); + ); } }); }); @@ -124,3 +124,4 @@ } } include_footer(); + ?> --- a/import.php +++ b/import.php @@ -1,6 +1,6 @@ create_db('disclosr-agencies'); } catch (SetteeRestClientException $e) { --- /dev/null +++ b/include/common.inc.php @@ -1,1 +1,39 @@ + array. + $Class = (array) $Class; + + # Iterate through the former properties looking for any stdClass properties. + # Recursively apply (array). + foreach ($Class as $key => $value) { + if (is_object($value) && get_class($value) === 'stdClass') { + $Class[$key] = object_to_array($value); + } + } + return $Class; +} + +# Convert an Array to stdClass. http://www.php.net/manual/en/language.types.object.php#102735 + +function array_to_object(array $array) { + # Iterate through our array looking for array values. + # If found recurvisely call itself. + foreach ($array as $key => $value) { + if (is_array($value)) { + $array[$key] = array_to_object($value); + } + } + + # Typecast to (object) will automatically convert array -> stdClass + return (object) $array; +} +?> + + + --- /dev/null +++ b/include/couchdb.inc.php @@ -1,1 +1,27 @@ +_id = "_design/" . urlencode("app"); + $obj->language = "javascript"; + $obj->views->byABN->map = "function(doc) { emit(doc.abn, doc); };"; + $obj->views->byName->map = "function(doc) { emit(doc.name, doc); };"; + $obj->views->getActive->map = 'function(doc) { if (doc.status == "active") { emit(doc._id, doc); } };'; + $obj->views->getSuspended->map = 'function(doc) { if (doc.status == "suspended") { emit(doc._id, doc); } };'; + $obj->views->getScrapeRequired->map = "function(doc) { emit(doc.abn, doc); };"; + $obj->views->showNamesABNs->map = "function(doc) { emit(doc._id, {name: doc.name, abn: doc.abn}); };"; + // allow safe updates (even if slightly slower due to extra: rev-detection check). + return $db->save($obj, true); +} +require ('couchdb/settee/src/settee.php'); + +$server = new SetteeServer('http://127.0.0.1:5984'); + +function setteErrorHandler($e) { + echo $e->getMessage() . "
" . PHP_EOL; +} + +?> + --- /dev/null +++ b/include/template.inc.php @@ -1,1 +1,75 @@ + + + + + + + + + + + + + + + Disclosr + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + --- /dev/null +++ b/schemas/agency.json.php @@ -1,1 +1,19 @@ + "Representation of government agency and online transparency measures", + "type" => "object", + "properties" => Array( + "name" => Array("type" => "string", "required" => true, "description" => "Agency Name, most recent and broadest"), + "othernames" => Array("type" => "array", "required" => true, "description" => "Agency Names", + "items" => Array("type" => "string")), + ), + /*"org":{"type":"object", + "properties":{ + "organizationName":{"type":"string"}, + "organizationUnit":{"type":"string"}}, + } + }*/ +); +?> + --- a/schemas/agency.php +++ /dev/null @@ -1,19 +1,1 @@ - "Representation of government agency and online transparency measures", - "type" => "object", - "properties" => Array( - "name" => Array("type" => "string", "required" => true, "description" => "Agency Name, most recent and broadest"), - "othernames" => Array("type" => "array", "required" => true, "description" => "Agency Names", - "items" => Array("type" => "string")), - ), - /*"org":{"type":"object", - "properties":{ - "organizationName":{"type":"string"}, - "organizationUnit":{"type":"string"}}, - } - }*/ -); -?> - --- /dev/null +++ b/schemas/schemas.inc.php @@ -1,1 +1,5 @@ +