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