--- a/admin/importRTKbodies.php +++ b/admin/importRTKbodies.php @@ -12,9 +12,10 @@ function extractCSVAccounts($url, $nameField, $accountField, $filter) { global $accounts, $nametoid; - $request = Requests::get($url); + // $request = Requests::get($url); echo $url; - $Data = str_getcsv($request->body, "\n"); //parse the rows +// $Data = str_getcsv($request->body, "\n"); //parse the rows + $Data = str_getcsv(file_get_contents("all-authorities.csv"), "\n"); //parse the rows $headers = Array(); foreach ($Data as $num => $line) { $Row = str_getcsv($line, ","); @@ -38,7 +39,7 @@ } } -extractCSVAccounts("http://www.righttoknow.org.au/body/all-authorities.csv","Agency","URL name"); +extractCSVAccounts("http://www.righttoknow.org.au/body/all-authorities.csv","Agency","URL name",""); //print_r($accounts); foreach ($accounts as $id => $allvalues) { echo $id . "
" . PHP_EOL; @@ -52,12 +53,13 @@ $doc[ $valueType] = array_unique(array_merge($doc[ $valueType], $values)); if ( $valueType == "rtkDescriptions") { foreach ($values as $descriptionAgency => $descriptionValue) { - if ($descriptionAgency == $doc->value->name) { - $doc->value->description = $descriptionValue; + if ($descriptionAgency == $doc->name) { + $doc->description = $descriptionValue; } } } } + if (isset($doc->value->rtkDescriptions[$doc->value->name])) $doc->value->description = $doc->value->rtkDescriptions[$doc->value->name]; $db->save($doc); } ?>