<?php |
<?php |
date_default_timezone_set("Australia/ACT"); |
date_default_timezone_set("Australia/ACT"); |
|
|
error_reporting(E_ALL ^ E_NOTICE); |
error_reporting(E_ALL ^ E_NOTICE); |
|
|
|
|
$conn = new PDO("pgsql:dbname=contractDashboard;user=postgres;password=snmc;host=localhost"); |
$conn = new PDO("pgsql:dbname=contractdashboard;user=postgres;password=snmc;host=localhost"); |
|
|
if (!$conn) { |
if (!$conn) { |
die("A database error occurred.\n"); |
die("A database error occurred.\n"); |
} |
} |
|
|
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
define('ROOT', pathinfo(__FILE__, PATHINFO_DIRNAME)); |
function databaseError($errMsg) { |
if (strstr($_SERVER['PHP_SELF'], "labs/") || strstr($_SERVER['PHP_SELF'], "admin/") || strstr($_SERVER['PHP_SELF'], "heuristics/")) { |
if ($errMsg[2] != "") { |
$basePath = "../"; |
echo '<div class="alert-message error">'; |
} |
die(print_r($errMsg, true)); |
require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php'; |
echo "</div>"; |
require(ROOT.'/solarium/vendor/autoload.php'); |
} |
require(ROOT.'/solarium/library/Solarium/Autoloader.php'); |
} |
Solarium\Autoloader::register(); |
|
// check solarium version available |
function ucsmart($str) { |
//echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - '; |
$shortWords = Array("The", "Pty", "Ltd", "Inc", "Red", "Oil", "A", "An", "And", "At", "For", "In" |
$config = array( |
, "Of", "On", "Or", "The", "To", "With"); |
'endpoint' => array( |
$strArray = explode(" ", preg_replace("/(?<=(?<!:|’s)\W) |
'localhost' => array( |
(A|An|And|At|For|In|Of|On|Or|The|To|With) |
'host' => '127.0.0.1', |
(?=\W)/e", 'strtolower("$1")', ucwords(strtolower($str)))); |
'port' => 8983, |
foreach ($strArray as &$word) { |
'path' => '/solr/contracts/', |
if (strlen($word) <= 4 && !in_array($word, $shortWords)) |
) |
$word = strtoupper($word); |
) |
} |
); |
return implode(" ", $strArray); |
// create a client instance |
} |
$solr_client = new Solarium\Client($config); |
|
|
function percent($num_amount, $num_total) { |
|
$count1 = $num_amount / $num_total; |
$openid = new LightOpenID($_SERVER['HTTP_HOST']); |
$count2 = $count1 * 100; |
// you have to open the session to be able to modify or remove it |
$count = number_format($count2, 2); |
session_start(); |
return $count; |
function login() { |
} |
global $openid; |
|
if (!$openid->mode) { |
function array_sum_all($a) { |
$openid->required = array('contact/email'); |
if (!is_array($a)) |
$openid->identity = 'https://www.google.com/accounts/o8/id'; |
return $a; |
header('Location: ' . $openid->authUrl()); |
foreach ($a as $key => $value) |
} |
$totale += array_sum_all($value); |
} |
return $totale; |
|
} |
function auth() { |
|
global $openid; |
// magic query modifiers |
if ($_SESSION['authed'] == true) { |
$agency = filter_var($_REQUEST['agency'], FILTER_SANITIZE_STRING); |
return true; |
if ($agency != "") |
} |
$agencyQ = "agencyName = '" . $agency . "' AND "; |
|
|
if ($openid->mode) { |
$supplier = filter_var($_REQUEST['supplier'], FILTER_SANITIZE_STRING); |
$attr = $openid->getAttributes(); |
if ($supplier != "") { |
if ($attr['contact/email'] != 'maxious@gmail.com') { |
$supplierParts = explode("-", $supplier); |
die('Access Denied'); |
$supplierName = "%" . $supplierParts[1] . "%"; |
} else { |
$supplierABN = $supplierParts[0]; |
$_SESSION['authed'] = true; |
if ($supplierParts[0] > 0) |
} |
$supplierQ = ' "supplierABN" = :supplierABN AND '; |
} else { |
else |
login(); |
$supplierQ = ' "supplierName" LIKE :supplierName AND '; |
} |
} |
} |
|
|
$startYear = 2007; |
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
$year = filter_var($_REQUEST['year'], FILTER_SANITIZE_NUMBER_INT); |
function databaseError($errMsg) { |
if ($year != "") |
if ($errMsg[2] != "") { |
$yearQ = "YEAR(publishDate) = " . $year . " AND "; |
echo '<div class="alert-message error">'; |
|
die(print_r($errMsg, true)); |
$standardQ = ' "childCN" is null '; // AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010'; |
echo "</div>"; |
$start = 0.0; |
} |
|
} |
function include_header($title) { |
|
global $start; |
function ucsmart($str) { |
?> |
$shortWords = Array("The", "Pty", "Ltd", "Inc", "Red", "Oil", "A", "An", "And", "At", "For", "In" |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
, "Of", "On", "Or", "The", "To", "With"); |
"http://www.w3.org/TR/html4/strict.dtd"> |
$strArray = explode(" ", preg_replace_callback("/(?<=(?<!:|’s)\W) |
<html> |
(A|An|And|At|For|In|Of|On|Or|The|To|With) |
<head> |
(?=\W)/", |
<title>Contract Dashboard - <?php echo $title; ?></title> |
function($matches) { return strtolower($matches[1]); } , ucwords(strtolower($str)))); |
<link rel="stylesheet" type="text/css" href="bootstrap.min.css"> |
foreach ($strArray as &$word) { |
<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> |
if (strlen($word) <= 4 && !in_array($word, $shortWords)) |
<!--[if lt IE 9]> |
$word = strtoupper($word); |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
} |
<![endif]--> |
return implode(" ", $strArray); |
<script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script> |
} |
<link rel="stylesheet" href="autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" /> |
|
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> |
function percent($num_amount, $num_total) { |
<script type="text/javascript"> |
$count1 = $num_amount / $num_total; |
$(document).ready(function() |
$count2 = $count1 * 100; |
{ |
$count = number_format($count2, 2); |
//hide the all of the element with class msg_body |
return $count; |
$(".msg_body").hide(); |
} |
//toggle the componenet with class msg_body |
|
$(".msg_head").click(function() |
function array_sum_all($a) { |
{ |
if (!is_array($a)) |
$(this).next(".msg_body").slideToggle(600); |
return $a; |
}); |
foreach ($a as $key => $value) |
}); |
$totale += array_sum_all($value); |
</script> |
return $totale; |
|
} |
<style type="text/css" title="currentStyle"> |
|
@import "media/css/demo_table.css"; |
// magic query modifiers |
</style> |
$agency = filter_var($_REQUEST['agency'], FILTER_SANITIZE_STRING); |
<script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script> |
if ($agency != "") |
<script type="text/javascript" language="javascript" src="lib/bootstrap-dropdown.js"></script> |
$agencyQ = "agencyName = '" . $agency . "' AND "; |
<script type="text/javascript" charset="utf-8"> |
|
jQuery.fn.dataTableExt.aTypes.unshift( |
$supplier = filter_var($_REQUEST['supplier'], FILTER_SANITIZE_STRING); |
function ( sData ) |
if ($supplier != "") { |
{ |
$supplierParts = explode("-", $supplier); |
var sValidChars = "0123456789.-,"; |
$supplierName = "%" . $supplierParts[1] . "%"; |
var Char; |
$supplierABN = $supplierParts[0]; |
|
if ($supplierParts[0] > 0) |
/* Check the numeric part */ |
$supplierQ = ' "supplierABN" = :supplierABN AND '; |
for ( i=1 ; i<sData.length ; i++ ) |
else |
{ |
$supplierQ = ' "supplierName" ILIKE :supplierName AND '; |
Char = sData.charAt(i); |
} |
if (sValidChars.indexOf(Char) == -1) |
|
{ |
$startYear = 2007; |
return null; |
$year = filter_var($_REQUEST['year'], FILTER_SANITIZE_NUMBER_INT); |
} |
if ($year != "") { |
} |
$yearQ = 'extract(year from "contractStart") = ' . $year . " AND "; |
|
} |
/* Check prefixed by currency */ |
$standardQ = ' "childCN" is null '; // AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010'; |
if ( sData.charAt(0) == '$' || sData.charAt(0) == '£' ) |
$start = 0.0; |
{ |
|
return 'currency'; |
function local_url() { |
} |
return "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/"; |
return null; |
} |
} |
|
); |
function include_header($title) { |
jQuery.fn.dataTableExt.oSort['currency-asc'] = function(a,b) { |
global $start; |
/* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */ |
?> |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
<!DOCTYPE html> |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" version="XHTML+RDFa 1.1" |
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
/* Remove the currency sign */ |
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
x = x.substring( 1 ); |
xmlns:gr="http://purl.org/goodrelations/v1#" |
y = y.substring( 1 ); |
xmlns:dc="http://purl.org/dc/terms/" |
|
xmlns:pc="http://purl.org/procurement#" |
/* Parse and return */ |
xmlns:unspsc="http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml#" |
x = parseFloat( x ); |
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" |
y = parseFloat( y ); |
xmlns:pcdt="http://purl.org/procurement/public-contracts-datatypes#" |
return x - y; |
prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# |
}; |
rdfs: http://www.w3.org/2000/01/rdf-schema# |
|
gr: http://purl.org/goodrelations/v1# |
jQuery.fn.dataTableExt.oSort['currency-desc'] = function(a,b) { |
dcterms: http://purl.org/dc/terms/ |
/* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */ |
pc: http://purl.org/procurement/public-contracts# |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
cpv: http://purl.org/weso/pscs/cpv/2008/resource/ |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
unspsc: http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml# |
|
v: http://www.w3.org/2006/vcard/ns# |
/* Remove the currency sign */ |
payment: http://reference.data.gov.uk/def/payment# |
x = x.substring( 1 ); |
br: http://purl.org/business-register# |
y = y.substring( 1 ); |
xsd: http://www.w3.org/2001/XMLSchema# |
|
pcdt: http://purl.org/procurement/public-contracts-datatypes#"> |
/* Parse and return */ |
<head> |
x = parseFloat( x ); |
<title><?php echo $title; ?> - Contract Dashboard</title> |
y = parseFloat( y ); |
<link rel="stylesheet" type="text/css" href="bootstrap.min.css"> |
return y - x; |
<link rel="stylesheet" type="text/css" href="bootstrap-responsive.css"> |
}; |
<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> |
$(document).ready(function() { |
<!--[if lt IE 9]> |
$('table').dataTable(); |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
} ); |
<![endif]--> |
</script> |
<script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script> |
<link type="text/css" rel="stylesheet" href="style.css"> |
<link rel="stylesheet" href="autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" /> |
</head> |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> |
<body> |
<script type="text/javascript"> |
<div class="topbar"> |
$(document).ready(function() |
<div class="topbar-inner"> |
{ |
<div class="container-fluid"> |
//hide the all of the element with class msg_body |
<a class="brand" href="#">contract dashboard</a> |
$(".msg_body").hide(); |
<ul class="nav"> |
//toggle the componenet with class msg_body |
<li><a href="displayAgency.php">agencies</a></li> |
$(".msg_head").click(function() |
<li><a href="displaySupplier.php">suppliers</a></li> |
{ |
<li><a href="displayCategory.php">categories</a></li> |
$(this).next(".msg_body").slideToggle(600); |
<li><a href="displayCalendar.php">time periods</a></li> |
}); |
<!-- <li class="dropdown"> |
}); |
<a href="#" class="dropdown-toggle">metrics</a> |
</script> |
<ul class="dropdown-menu">--> |
|
<li><a href="displayProcurementMethod.php">tenderm</a></li> |
<style type="text/css" title="currentStyle"> |
<li><a href="displayConfidentialities.php">confidentiality</a></li> |
@import "media/css/demo_table.css"; |
<li><a href="displayConsultancies.php">consultancies</a></li> |
</style> |
<li><a href="displayAmendments.php">amendments</a></li> |
<script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script> |
<li><a href="displayMap.php">geo</a></li> |
<script type="text/javascript" language="javascript" src="lib/bootstrap-dropdown.js"></script> |
<!-- </ul> |
<script type="text/javascript" charset="utf-8"> |
</li>--> |
jQuery.fn.dataTableExt.aTypes.unshift( |
</ul> |
function ( sData ) |
|
{ |
|
var sValidChars = "0123456789.-,"; |
<form method="post" action="search.php" class="pull-right"> |
var Char; |
<input type="text" id="searchKeyword" name="searchKeyword" value="" placeholder="Search" /> |
|
<input type="hidden" id="searchID" name="searchID" value=""/> |
/* Check the numeric part */ |
</form> |
for ( i=1 ; i<sData.length ; i++ ) |
|
{ |
</div> |
Char = sData.charAt(i); |
</div><!-- /topbar-inner --> |
if (sValidChars.indexOf(Char) == -1) |
</div><!-- /topbar --> |
{ |
</div><!-- /topbar-wrapper --> |
return null; |
<script type="text/javascript"> |
} |
|
} |
var options_xml = { |
|
script: function (input) { return "search_autosuggest.php?input="+input; }, |
/* Check prefixed by currency */ |
varname:"input", |
if ( sData.charAt(0) == '$' || sData.charAt(0) == '£' ) |
callback: function (obj) { document.getElementById('searchID').value = obj.id; } |
{ |
}; |
return 'currency'; |
var as_xml = new bsn.AutoSuggest('searchKeyword', options_xml); |
} |
</script> |
return null; |
<div class="container-fluid"> |
} |
<div class="sidebar"> |
); |
<div class="well"> |
jQuery.fn.dataTableExt.oSort['currency-asc'] = function(a,b) { |
Filter by:<li> |
/* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */ |
<li>year |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
<li><li>2008</li> |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
</li> |
|
</li> |
/* Remove the currency sign */ |
</li> <br> |
x = x.substring( 1 ); |
</div> </div> |
y = y.substring( 1 ); |
<div class="content"> |
|
<?php |
/* Parse and return */ |
$start = (float) array_sum(explode(' ', microtime())); |
x = parseFloat( x ); |
} |
y = parseFloat( y ); |
|
return x - y; |
function include_footer() { |
}; |
global $start; |
|
$end = (float) array_sum(explode(' ', microtime())); |
jQuery.fn.dataTableExt.oSort['currency-desc'] = function(a,b) { |
|
/* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */ |
echo ' <footer>' . "Processing time: " . sprintf("%.4f", ($end - $start)) . " seconds" . ' <footer>'; |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
echo '</div> </div></body> </html>'; |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
} |
|
|
/* Remove the currency sign */ |
include ("graphs.inc.php"); |
x = x.substring( 1 ); |
?> |
y = y.substring( 1 ); |
|
|
|
/* Parse and return */ |
|
x = parseFloat( x ); |
|
y = parseFloat( y ); |
|
return y - x; |
|
}; |
|
$(document).ready(function() { |
|
$('table').dataTable(); |
|
} ); |
|
</script> |
|
<link type="text/css" rel="stylesheet" href="style.css"> |
|
</head> |
|
<body> |
|
<div class="navbar"> |
|
<div class="navbar-inner"> |
|
<div class="container-fluid"> |
|
<a class="brand" href="#">contract dashboard</a> |
|
<ul class="nav"> |
|
<li><a href="displayAgency.php">agencies</a></li> |
|
<li><a href="displaySupplier.php">suppliers</a></li> |
|
<li><a href="displaySON.php">standing offers</a></li> |
|
<li><a href="displayCategory.php">categories</a></li> |
|
<li><a href="displayCalendar.php">dates</a></li> |
|
<li><a href="displayProcurementMethod.php">tenderm</a></li> |
|
<li><a href="displayConfidentialities.php">confidentiality</a></li> |
|
<li><a href="displayConsultancies.php">consultancies</a></li> |
|
<li><a href="displayAmendments.php">amendments</a></li> |
|
<li><a href="displayMap.php">geo</a></li> |
|
</ul> |
|
|
|
|
|
<form method="get" action="search.php" class="pull-right"> |
|
<input type="text" id="searchKeyword" name="searchKeyword" value="" placeholder="Search" /> |
|
<input type="hidden" id="searchID" name="searchID" value=""/> |
|
</form> |
|
|
|
</div> |
|
</div><!-- /topbar-inner --> |
|
</div><!-- /topbar --> |
|
</div><!-- /topbar-wrapper --> |
|
<script type="text/javascript"> |
|
|
|
var options_xml = { |
|
script: function (input) { return "search_autosuggest.php?input="+input; }, |
|
varname:"input", |
|
callback: function (obj) { document.getElementById('searchID').value = obj.id; } |
|
}; |
|
var as_xml = new bsn.AutoSuggest('searchKeyword', options_xml); |
|
</script> |
|
<div class="container-fluid"> |
|
<div class="row-fluid"> |
|
<div class="span3"> |