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