--- a/displayContract.php +++ b/displayContract.php @@ -1,44 +1,120 @@ - $value) { - echo "$key "; -switch ($key) { -case "supplierName": -case "supplierABN": - echo ''.$value.""; - break; -case "agencyName": - echo ''.$value.""; - break; -case "value": - echo "$".number_format(doubleval($value),2); - break; -default: - echo str_replace(" ","
",$value); -} -echo "
"; -} -} -echo '
View original record @ tenders.gov.au
'; - -mysql_free_result($result); - -$query = "SELECT * FROM `heuristic_results` where CNID = ".$_REQUEST['CNID']; -$result = mysql_query($query); -if (!$result) echo mysql_error().$query; -while ($r = mysql_fetch_array($result, MYSQL_ASSOC)) { - echo "{$r['heuristic_name']}: {$r['heuristic_value']} (raw value: {$r['raw_value']}, mean: {$r['mean']}, stddev: {$r['stddev']})
"; -} - -include_footer(); -?> +prepare($query); +$query->bindParam(":CNID", $_REQUEST['CNID']); +$query->execute(); +$contractResult = $query->fetch(PDO::FETCH_ASSOC); +if (!$contractResult) { + header("Status: 404 Not Found"); + header("HTTP/1.0 404 Not Found"); +include_header("Contract Not Found"); + echo "

No Contract Notice with that ID found

"; +databaseError($conn->errorInfo()); +} else { +$description = ucsmart($contractResult["description"]); +include_header($description); + echo '

'.$description.'

+
'; +databaseError($conn->errorInfo()); + setlocale(LC_MONETARY, 'en_US'); + foreach (array_filter($contractResult) as $key => $value) { + echo "$key "; + switch ($key) { + case "supplierABN": + break; + case "supplierName": + echo ' + + + ' + . $contractResult['supplierName'] . + ''. + (isset($contractResult['supplierABN']) && $contractResult['supplierABN'] != '' ? ' (ABN: '.$contractResult['supplierABN'].')' : '') + .''; + break; + case "CNID": + echo ''.$value.''; + break; + case "categoryUNSPSC": + break; + case "category": + echo ''.$value.''; + break; + case "SONID": + echo '' . $value . ""; + break; + case "agencyName": + echo '' . $value . ""; + break; + case "contractStart": + echo ''.$value.''; + break; + case "contractEnd": + echo ''.$value.''; + break; + case "value": + echo ' + $ + ' . number_format(doubleval($value), 2) + .''; + break; + case "description": + echo ''.$value.''; + break; + default: + echo str_replace(" ", "
", ucsmart($value)); + } + echo "
\n"; + } +echo '
View original record @ tenders.gov.au
+ +
'; + +/*$query = $solr_client->createMoreLikeThis(); + +$query->setQuery('id:'.$_REQUEST['CNID']); +$query->setMltFields('description'); +$query->setMinimumDocumentFrequency(1); +$query->setMinimumTermFrequency(1); +$query->setInterestingTerms('description'); +$query->setMatchInclude(true); + +// this executes the query and returns the result +$resultset = $solr_client->select($query); + +// display the total number of documents found by solr +echo 'Found '.$resultset->getNumFound(). ' similar results: '; + + +foreach ($resultset as $row) { +setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value'][0]), 2); + echo (" + + + + + + "); +} +echo "
{$row['id']}{$row['description'][0]}\$$value{$row['agencyName'][0]}{$row['contractStart'][0]}{$row['supplierName'][0]}
";*/ + + +$query = 'SELECT * FROM heuristic_results where "CNID" = :CNID'; +$query = $conn->prepare($query); +$agencyName = $input . '%'; +$query->bindParam(":CNID", $_REQUEST['CNID']); +$query->execute(); +databaseError($conn->errorInfo()); +foreach ($query->fetchAll() as $r) { + echo "{$r['heuristic_name']}: {$r['heuristic_value']} (raw value: {$r['raw_value']}, mean: {$r['mean']}, stddev: {$r['stddev']})
"; +} +} +include_footer(); +?> +