add amendments metric
add amendments metric

file:a/about.php -> file:b/about.php
  <?php
   
   
  include('./lib/common.inc.php');
  include_header("Map");
  ?>
   
  <div class="msg_list">
  <p class="msg_head">Header-1 </p>
  <div class="msg_body">
  orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  </div>
  <p class="msg_head">Header-2</p>
  <div class="msg_body">
  orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  </div>
  <p class="msg_head">Header-3</p>
  <div class="msg_body">
  orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
  </div>
  </div>
   
sourced from austender sourced from austender
Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY) Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY)
jpgraph for php jpgraph for php
ABR ABR
Redhat Liberation fonts Redhat Liberation fonts
   
   
  <?php
  include_once("./lib/common.inc.php");
  $query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end
  FROM `contractnotice` WHERE childCN = 0 AND parentCN = 0 AND DATE(importDate) in (select * from (SELECT DATE(importDate)
  FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)";
  $result = mysql_query($query);
  echo "<div>";
  $stats = mysql_fetch_array($result, MYSQL_BOTH);
  echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
   
   
  $query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end
  FROM `contractnotice` WHERE (childCN != 0 OR parentCN != 0) AND DATE(importDate) in (select * from (SELECT DATE(importDate)
  FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)";
  $result = mysql_query($query);
  echo "<div>";
  $stats = mysql_fetch_array($result, MYSQL_BOTH);
  echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
   
   
  echo "Last updated: ". $stats["importday"]."<br>";
  /* Check for null Procurement method and 0 ABN when not ABN exempt */
   
   
  include_footer();
  ?>
<?php <?php
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://contractdashboard.lambdacomplex.org"); curl_setopt($ch, CURLOPT_REFERER, "http://contractdashboard.lambdacomplex.org");
$guid = "5f2f943e-15f4-4782-8fad-9a0fe83a2f47"; $guid = "5f2f943e-15f4-4782-8fad-9a0fe83a2f47";
$orgname = "Department of Foreign Affairs and Trade"; $orgname = "Department of Foreign Affairs and Trade";
   
//foreach $agency //foreach $agency
$url = "http://abr.business.gov.au/ABRXMLSearchRPC/ABRXMLSearch.asmx/ABRSearchByNameSimpleProtocol?name=".urlencode($orgname)."&postcode=&legalName=Y&tradingName=Y&NSW=Y&SA=Y&ACT=Y&VIC=Y&WA=Y&NT=Y&QLD=Y&TAS=Y&authenticationGuid=$guid"; $url = "http://abr.business.gov.au/ABRXMLSearchRPC/ABRXMLSearch.asmx/ABRSearchByNameSimpleProtocol?name=".urlencode($orgname)."&postcode=&legalName=Y&tradingName=Y&NSW=Y&SA=Y&ACT=Y&VIC=Y&WA=Y&NT=Y&QLD=Y&TAS=Y&authenticationGuid=$guid";
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
$body = curl_exec($ch); $body = curl_exec($ch);
$xml = new SimpleXMLElement($body); $xml = new SimpleXMLElement($body);
echo "<pre>"; echo "<pre>";
$result = $xml->response->searchResultsList->searchResultsRecord[0]; $result = $xml->response->searchResultsList->searchResultsRecord[0];
var_dump($result); var_dump($result);
echo "</pre>"; echo "</pre>";
echo "<b> Organisation:</b>" . $result->mainName->organisationName; echo "<b> Organisation:</b>" . $result->mainName->organisationName;
echo "<b> ABN:</b>".$result->ABN->identifierValue; echo "<b> ABN:</b>".$result->ABN->identifierValue;
// fi // fi
   
curl_close($ch); curl_close($ch);
   
?> ?>
  <?php
 
  // Returns portfolio scraped live from directory.gov.au
  // or null if can't find a portfolio
  function agency2portfolio ($agency) {
  static $cache = array();
  if (isset($cache[$agency])) { return $cache[$agency]; }
  $c = curl_init('http://www.directory.gov.au/searchres.php');
  curl_setopt($c, CURLOPT_POST, true);
  curl_setopt($c, CURLOPT_HEADER, false);
  curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($c, CURLOPT_REFERER, 'http://www.directory.gov.au/adsearch.php');
  curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3');
  curl_setopt($c, CURLOPT_POSTFIELDS, array(
  'advkeywordfield' => '',
  'advorgunitfield' => $agency,
  'advrolefield' => '',
  'advsection' => 'All',
  'advsurnamefield' => '',
  'search' => 'Submit Query'
  ));
  $results = curl_exec($c);
 
  if (preg_match('#<span\s+class="standardlinks"><a\s+href="([^"]+)">#smi', $results, $m)) {
  $nextURL = $m[1];
  } else {
  $cache[$agency] = false; return false;
  }
 
  curl_setopt($c, CURLOPT_URL, 'http://www.directory.gov.au' . $nextURL);
  curl_setopt($c, CURLOPT_HTTPGET, true);
  curl_setopt($c, CURLOPT_REFERER, 'http://www.directory.gov.au/searchres.php');
  $results = curl_exec($c);
  if (preg_match('#portfolios:\s+([^<]+)#ims', $results, $m)) {
  $cache[$agency] = $m[1]; return $m[1];
  } else {
  $cache[$agency] = false; return false;
  }
  }
 
  ?>
 
<?php <?php
   
include_once("../common.inc.php"); include_once("../common.inc.php");
$year = $_REQUEST['year']; $year = $_REQUEST['year'];
$query = "SELECT supplierCountry, sum(value) FROM `contractnotice` where childCN = 0 AND (YEAR(contractStart) = $year) AND supplierCountry != 'Australia' GROUP BY supplierCountry "; $query = "SELECT supplierCountry, sum(value) FROM `contractnotice` where childCN = 0 AND (YEAR(contractStart) = $year) AND supplierCountry != 'Australia' GROUP BY supplierCountry ";
   
$result = mysql_query($query); $result = mysql_query($query);
if (!$result) echo mysql_error().$query; if (!$result) echo mysql_error().$query;
$countryValues = Array(); $countryValues = Array();
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$supplierCountry = strtoupper($row['supplierCountry']); $supplierCountry = strtoupper($row['supplierCountry']);
if ($supplierCountry == "MYANMAR") $supplierCountry = "BURMA"; if ($supplierCountry == "MYANMAR") $supplierCountry = "BURMA";
if ($supplierCountry == "RUSSIAN FEDERATION") $supplierCountry = "RUSSIA"; if ($supplierCountry == "RUSSIAN FEDERATION") $supplierCountry = "RUSSIA";
if ($supplierCountry == "TAIWAN, PROVINCE OF CHINA") $supplierCountry = "TAIWAN"; if ($supplierCountry == "TAIWAN, PROVINCE OF CHINA") $supplierCountry = "TAIWAN";
$countryValues[$supplierCountry] = $row['sum(value)']; $countryValues[$supplierCountry] = $row['sum(value)'];
} }
mysql_free_result($result); mysql_free_result($result);
   
$query = "SELECT supplierPostcode, sum(value) FROM `contractnotice` where childCN = 0 AND (YEAR(contractStart) = $year) AND supplierCountry = 'Australia' GROUP BY supplierPostcode "; $query = "SELECT supplierPostcode, sum(value) FROM `contractnotice` where childCN = 0 AND (YEAR(contractStart) = $year) AND supplierCountry = 'Australia' GROUP BY supplierPostcode ";
   
$result = mysql_query($query); $result = mysql_query($query);
if (!$result) echo mysql_error().$query; if (!$result) echo mysql_error().$query;
$postcodeValues = Array(); $postcodeValues = Array();
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$postcodeValues[$row['supplierPostcode']] = $row['sum(value)']; $postcodeValues[$row['supplierPostcode']] = $row['sum(value)'];
} }
mysql_free_result($result); mysql_free_result($result);