<?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"); |
include('db.inc.php'); |
|
|
if (!$conn) { |
define('ROOT', pathinfo(__FILE__, PATHINFO_DIRNAME)); |
die("A database error occurred.\n"); |
if (strstr($_SERVER['PHP_SELF'], "labs/") || strstr($_SERVER['PHP_SELF'], "admin/") || strstr($_SERVER['PHP_SELF'], "heuristics/")) { |
} |
$basePath = "../"; |
|
} |
define('ROOT', pathinfo(__FILE__, PATHINFO_DIRNAME)); |
/*require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php'; |
if (strstr($_SERVER['PHP_SELF'], "labs/")) { |
require(ROOT.'/solarium/vendor/autoload.php'); |
$basePath = "../"; |
require(ROOT.'/solarium/library/Solarium/Autoloader.php'); |
} |
Solarium\Autoloader::register(); |
require $basePath."lib/amon-php/amon.php"; |
// check solarium version available |
Amon::config(array('address'=> 'http://127.0.0.1:2465', |
//echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - '; |
'protocol' => 'http', |
$config = array( |
'secret_key' => "g99127n3lkzigg8ob2rllth97d1pb4sj")); |
'endpoint' => array( |
Amon::setup_exception_handler(); |
'localhost' => array( |
|
'host' => '127.0.0.1', |
require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php'; |
'port' => 8983, |
$openid = new LightOpenID($_SERVER['HTTP_HOST']); |
'path' => '/solr/contracts/', |
|
) |
function login() { |
) |
global $openid; |
); |
if (!$openid->mode) { |
// create a client instance |
$openid->required = array('contact/email'); |
$solr_client = new Solarium\Client($config); |
$openid->identity = 'https://www.google.com/accounts/o8/id'; |
|
header('Location: ' . $openid->authUrl()); |
|
} |
$openid = new LightOpenID($_SERVER['HTTP_HOST']); |
} |
// you have to open the session to be able to modify or remove it |
|
session_start(); |
function auth() { |
function login() { |
global $openid; |
global $openid; |
if ($_SESSION['authed'] == true) { |
if (!$openid->mode) { |
return true; |
$openid->required = array('contact/email'); |
} |
$openid->identity = 'https://www.google.com/accounts/o8/id'; |
|
header('Location: ' . $openid->authUrl()); |
if ($openid->mode) { |
} |
$attr = $openid->getAttributes(); |
} |
if ($attr['contact/email'] != 'maxious@gmail.com') { |
|
die('Access Denied'); |
function auth() { |
} else { |
global $openid; |
$_SESSION['authed'] = true; |
if ($_SESSION['authed'] == true) { |
} |
return true; |
} else { |
} |
login(); |
|
} |
if ($openid->mode) { |
} |
$attr = $openid->getAttributes(); |
|
if ($attr['contact/email'] != 'maxious@gmail.com') { |
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
die('Access Denied'); |
function databaseError($errMsg) { |
} else { |
if ($errMsg[2] != "") { |
$_SESSION['authed'] = true; |
echo '<div class="alert-message error">'; |
} |
Amon::log(print_r($errMsg, true), array('error')); |
} else { |
die(print_r($errMsg, true)); |
login(); |
echo "</div>"; |
} |
} |
}*/ |
} |
|
|
// $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
function ucsmart($str) { |
function databaseError($errMsg) { |
$shortWords = Array("The", "Pty", "Ltd", "Inc", "Red", "Oil", "A", "An", "And", "At", "For", "In" |
if ($errMsg[2] != "") { |
, "Of", "On", "Or", "The", "To", "With"); |
echo '<div class="alert-message error">'; |
$strArray = explode(" ", preg_replace("/(?<=(?<!:|’s)\W) |
die(print_r($errMsg, true)); |
(A|An|And|At|For|In|Of|On|Or|The|To|With) |
echo "</div>"; |
(?=\W)/e", 'strtolower("$1")', ucwords(strtolower($str)))); |
} |
foreach ($strArray as &$word) { |
} |
if (strlen($word) <= 4 && !in_array($word, $shortWords)) |
function cleanseName($input) { |
$word = strtoupper($word); |
|
} |
return trim(join(" ",array_filter(explode(" ",strtolower($input)), function($v, $k) { |
return implode(" ", $strArray); |
$cleanseNamesCorp = Array( |
} |
"ltd", |
|
"limited", |
function percent($num_amount, $num_total) { |
"australia", |
$count1 = $num_amount / $num_total; |
"australian", |
$count2 = $count1 * 100; |
"australasia", |
$count = number_format($count2, 2); |
"(aus)", |
return $count; |
"(aust)", |
} |
"(australia)", |
|
"the", |
function array_sum_all($a) { |
"pty", |
if (!is_array($a)) |
"contractors", |
return $a; |
"p/l", |
foreach ($a as $key => $value) |
"inc.", |
$totale += array_sum_all($value); |
"inc", |
return $totale; |
"incorporated" |
} |
); |
|
return !in_array($v,$cleanseNamesCorp) ; |
// magic query modifiers |
}, ARRAY_FILTER_USE_BOTH))); |
$agency = filter_var($_REQUEST['agency'], FILTER_SANITIZE_STRING); |
} |
if ($agency != "") |
function ucsmart($str) { |
$agencyQ = "agencyName = '" . $agency . "' AND "; |
$shortWords = Array("The", "Pty", "Ltd", "Inc", "Red", "Oil", "A", "An", "And", "At", "For", "In" |
|
, "Of", "On", "Or", "The", "To", "With"); |
$supplier = filter_var($_REQUEST['supplier'], FILTER_SANITIZE_STRING); |
$strArray = explode(" ", preg_replace_callback("/(?<=(?<!:|’s)\W) |
if ($supplier != "") { |
(A|An|And|At|For|In|Of|On|Or|The|To|With) |
$supplierParts = explode("-", $supplier); |
(?=\W)/", |
$supplierName = "%" . $supplierParts[1] . "%"; |
function($matches) { return strtolower($matches[1]); } , ucwords(strtolower($str)))); |
$supplierABN = $supplierParts[0]; |
foreach ($strArray as &$word) { |
if ($supplierParts[0] > 0) |
if (strlen($word) <= 4 && !in_array($word, $shortWords)) |
$supplierQ = ' "supplierABN" = :supplierABN AND '; |
$word = strtoupper($word); |
else |
} |
$supplierQ = ' "supplierName" LIKE :supplierName AND '; |
return implode(" ", $strArray); |
} |
} |
|
|
$startYear = 2007; |
function percent($num_amount, $num_total) { |
$year = filter_var($_REQUEST['year'], FILTER_SANITIZE_NUMBER_INT); |
$count1 = $num_amount / $num_total; |
if ($year != "") { |
$count2 = $count1 * 100; |
$yearQ = "YEAR(publishDate) = " . $year . " AND "; |
$count = number_format($count2, 2); |
} |
return $count; |
$standardQ = ' "childCN" is null '; // AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010'; |
} |
$start = 0.0; |
|
|
function array_sum_all($a) { |
function local_url() { |
if (!is_array($a)) |
return "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/"; |
return $a; |
} |
$totale = 0; |
|
foreach ($a as $key => $value) |
function include_header($title) { |
$totale += array_sum_all($value); |
global $start; |
return $totale; |
?> |
} |
<!DOCTYPE html> |
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" version="XHTML+RDFa 1.1" |
function show_stats($stats) { |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
setlocale(LC_MONETARY, 'en_US'); |
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
$value = number_format(doubleval($stats['total_value']) , 2); |
xmlns:gr="http://purl.org/goodrelations/v1#" |
echo "<br/> {$stats['total']} contracts, total value $$value <br/>"; |
xmlns:dc="http://purl.org/dc/terms/" |
if ($stats['consultancy'] > 0) { |
xmlns:pc="http://purl.org/procurement#" |
echo "<b>Consultancies:</b> {$stats['consultancy']} contracts, ".percent($stats['consultancy'],$stats['total']); |
xmlns:unspsc="http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml#" |
echo "%<br/>"; |
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" |
} |
xmlns:pcdt="http://purl.org/procurement/public-contracts-datatypes#" |
if ($stats['confidentialityContract']+$stats['confidentialityOutputs'] > 0) { |
prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# |
$confidentialities = $stats['confidentialityContract']+$stats['confidentialityOutputs']; |
rdfs: http://www.w3.org/2000/01/rdf-schema# |
echo "<b>Confidentialities:</b> $confidentialities contracts, ".percent( $confidentialities,$stats['total'])."%"; |
gr: http://purl.org/goodrelations/v1# |
echo "( {$stats['confidentialityContract']} on the contract, {$stats['confidentialityOutputs']} on the outputs)"; |
dcterms: http://purl.org/dc/terms/ |
echo "<br/>"; |
pc: http://purl.org/procurement/public-contracts# |
} |
cpv: http://purl.org/weso/pscs/cpv/2008/resource/ |
echo "<b>Procurement methods:</b> "; |
unspsc: http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml# |
if ($stats['open'] > 0) { |
v: http://www.w3.org/2006/vcard/ns# |
echo "Open {$stats['open']} contracts, ".percent($stats['open'],$stats['total']); |
payment: http://reference.data.gov.uk/def/payment# |
echo "%, "; |
br: http://purl.org/business-register# |
} |
xsd: http://www.w3.org/2001/XMLSchema# |
if ($stats['openSON'] > 0) { |
pcdt: http://purl.org/procurement/public-contracts-datatypes#"> |
echo "Open via SON {$stats['openSON']} contracts, ".percent($stats['openSON'],$stats['total']); |
<head> |
echo "%, "; |
<title><?php echo $title; ?> - Contract Dashboard</title> |
} |
<link rel="stylesheet" type="text/css" href="bootstrap.min.css"> |
if ($stats['prequalified'] > 0) { |
<link rel="stylesheet" type="text/css" href="bootstrap-responsive.css"> |
echo "Prequalified {$stats['prequalified']} contracts, ".percent($stats['prequalified'],$stats['total']); |
<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> |
echo "%, "; |
<!--[if lt IE 9]> |
} |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
if ($stats['limited'] > 0) { |
<![endif]--> |
echo "limited {$stats['limited']} contracts, ".percent($stats['limited'],$stats['total']); |
<script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script> |
echo "%, "; |
<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> |
} |
<script type="text/javascript"> |
|
$(document).ready(function() |
// magic query modifiers |
{ |
$agency = filter_var($_REQUEST['agency'], FILTER_SANITIZE_STRING); |
//hide the all of the element with class msg_body |
if ($agency != "") |
$(".msg_body").hide(); |
$agencyQ = "agencyName = '" . $agency . "' AND "; |
//toggle the componenet with class msg_body |
|
$(".msg_head").click(function() |
$supplier = filter_var($_REQUEST['supplier'], FILTER_SANITIZE_STRING); |
{ |
if ($supplier != "") { |
$(this).next(".msg_body").slideToggle(600); |
if ($supplier[0] !== '-') { |
}); |
$supplierParts = explode("-", $supplier); |
}); |
|
</script> |
$supplierABN = array_shift($supplierParts); |
|
$supplierName = "%" . implode('-',$supplierParts) . "%"; |
<style type="text/css" title="currentStyle"> |
|
@import "media/css/demo_table.css"; |
$supplierQ = ' "supplierABN" = :supplierABN AND '; |
</style> |
} else { |
<script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script> |
$supplierName = "%" . substr($supplier,1) . "%"; |
<script type="text/javascript" language="javascript" src="lib/bootstrap-dropdown.js"></script> |
$supplierQ = ' "supplierName" ILIKE :supplierName AND '; |
<script type="text/javascript" charset="utf-8"> |
} |
jQuery.fn.dataTableExt.aTypes.unshift( |
} |
function ( sData ) |
|
{ |
$startYear = 2007; |
var sValidChars = "0123456789.-,"; |
$year = filter_var($_REQUEST['year'], FILTER_SANITIZE_NUMBER_INT); |
var Char; |
if ($year != "") { |
|
$yearQ = 'extract(year from "contractStart") = ' . $year . " AND "; |
/* Check the numeric part */ |
} |
for ( i=1 ; i<sData.length ; i++ ) |
$standardQ = ' "childCN" is null '; // AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010'; |
{ |
$start = 0.0; |
Char = sData.charAt(i); |
|
if (sValidChars.indexOf(Char) == -1) |
function local_url() { |
{ |
return "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/"; |
return null; |
} |
} |
|
} |
function include_header($title) { |
|
global $start; |
/* Check prefixed by currency */ |
?> |
if ( sData.charAt(0) == '$' || sData.charAt(0) == '£' ) |
<!DOCTYPE html> |
{ |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" version="XHTML+RDFa 1.1" |
return 'currency'; |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
} |
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
return null; |
xmlns:gr="http://purl.org/goodrelations/v1#" |
} |
xmlns:dc="http://purl.org/dc/terms/" |
); |
xmlns:pc="http://purl.org/procurement#" |
jQuery.fn.dataTableExt.oSort['currency-asc'] = function(a,b) { |
xmlns:unspsc="http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml#" |
/* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */ |
xmlns:xsd="http://www.w3.org/2001/XMLSchema#" |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
xmlns:pcdt="http://purl.org/procurement/public-contracts-datatypes#" |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# |
|
rdfs: http://www.w3.org/2000/01/rdf-schema# |
/* Remove the currency sign */ |
gr: http://purl.org/goodrelations/v1# |
x = x.substring( 1 ); |
dcterms: http://purl.org/dc/terms/ |
y = y.substring( 1 ); |
pc: http://purl.org/procurement/public-contracts# |
|
cpv: http://purl.org/weso/pscs/cpv/2008/resource/ |
/* Parse and return */ |
unspsc: http://www.ksl.stanford.edu/projects/DAML/UNSPSC.daml# |
x = parseFloat( x ); |
v: http://www.w3.org/2006/vcard/ns# |
y = parseFloat( y ); |
payment: http://reference.data.gov.uk/def/payment# |
return x - y; |
br: http://purl.org/business-register# |
}; |
xsd: http://www.w3.org/2001/XMLSchema# |
|
pcdt: http://purl.org/procurement/public-contracts-datatypes#"> |
jQuery.fn.dataTableExt.oSort['currency-desc'] = function(a,b) { |
<head> |
/* Remove any commas (assumes that if present all strings will have a fixed number of d.p) */ |
<title><?php echo $title; ?> - Contract Dashboard</title> |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
<link rel="stylesheet" type="text/css" href="bootstrap.min.css"> |
|
<link rel="stylesheet" type="text/css" href="bootstrap-responsive.css"> |
/* Remove the currency sign */ |
<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> |
x = x.substring( 1 ); |
<!--[if lt IE 9]> |
y = y.substring( 1 ); |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
|
<![endif]--> |
/* Parse and return */ |
<script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script> |
x = parseFloat( x ); |
<link rel="stylesheet" href="autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" /> |
y = parseFloat( y ); |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> |
return y - x; |
<script type="text/javascript"> |
}; |
$(document).ready(function() |
$(document).ready(function() { |
{ |
$('table').dataTable(); |
//hide the all of the element with class msg_body |
} ); |
$(".msg_body").hide(); |
</script> |
//toggle the componenet with class msg_body |
<link type="text/css" rel="stylesheet" href="style.css"> |
$(".msg_head").click(function() |
</head> |
{ |
<body> |
$(this).next(".msg_body").slideToggle(600); |
<div class="navbar"> |
}); |
<div class="navbar-inner"> |
}); |
<div class="container-fluid"> |
</script> |
<a class="brand" href="#">contract dashboard</a> |
|
<ul class="nav"> |
<style type="text/css" title="currentStyle"> |
<li><a href="displayAgency.php">agencies</a></li> |
@import "media/css/demo_table.css"; |
<li><a href="displaySupplier.php">suppliers</a></li> |
</style> |
<li><a href="displayCategory.php">categories</a></li> |
<script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script> |
<li><a href="displayCalendar.php">time periods</a></li> |
<script type="text/javascript" language="javascript" src="lib/bootstrap-dropdown.js"></script> |
<!-- <li class="dropdown"> |
<script type="text/javascript" charset="utf-8"> |
<a href="#" class="dropdown-toggle">metrics</a> |
jQuery.fn.dataTableExt.aTypes.unshift( |
<ul class="dropdown-menu">--> |
function ( sData ) |
<li><a href="displayProcurementMethod.php">tenderm</a></li> |
{ |
<li><a href="displayConfidentialities.php">confidentiality</a></li> |
var sValidChars = "0123456789.-,"; |
<li><a href="displayConsultancies.php">consultancies</a></li> |
var Char; |
<li><a href="displayAmendments.php">amendments</a></li> |
|
<li><a href="displayMap.php">geo</a></li> |
/* Check the numeric part */ |
</ul> |
for ( i=1 ; i<sData.length ; i++ ) |
|
{ |
|
Char = sData.charAt(i); |
<form method="post" action="search.php" class="pull-right"> |
if (sValidChars.indexOf(Char) == -1) |
<input type="text" id="searchKeyword" name="searchKeyword" value="" placeholder="Search" /> |
{ |
<input type="hidden" id="searchID" name="searchID" value=""/> |
return null; |
</form> |
} |
|
} |
</div> |
|
</div><!-- /topbar-inner --> |
/* Check prefixed by currency */ |
</div><!-- /topbar --> |
if ( sData.charAt(0) == '$' || sData.charAt(0) == '£' ) |
</div><!-- /topbar-wrapper --> |
{ |
<script type="text/javascript"> |
return 'currency'; |
|
} |
var options_xml = { |
return null; |
script: function (input) { return "search_autosuggest.php?input="+input; }, |
} |
varname:"input", |
); |
callback: function (obj) { document.getElementById('searchID').value = obj.id; } |
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 as_xml = new bsn.AutoSuggest('searchKeyword', options_xml); |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
</script> |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
<div class="container-fluid"> |
|
<div class="row-fluid"> |
/* Remove the currency sign */ |
<div class="span3"> |
x = x.substring( 1 ); |
<div class="well sidebar-nav"> |
y = y.substring( 1 ); |
<li class="nav-header">Filter by:</li> |
|
<li>2008</li> |
/* Parse and return */ |
</div> |
x = parseFloat( x ); |
</div> |
y = parseFloat( y ); |
<div class="span9"> |
return x - y; |
<?php |
}; |
$start = (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) */ |
function include_footer() { |
var x = a == "-" ? 0 : a.replace( /,/g, "" ); |
global $start; |
var y = b == "-" ? 0 : b.replace( /,/g, "" ); |
$end = (float) array_sum(explode(' ', microtime())); |
|
|
/* Remove the currency sign */ |
echo '</div> <footer>' . "Processing time: " . sprintf("%.4f", ($end - $start)) . " seconds" . ' <footer>'; |
x = x.substring( 1 ); |
|
y = y.substring( 1 ); |
if (strpos($_SERVER['SERVER_NAME'], ".gs")) { |
|
?> |
/* Parse and return */ |
<script type="text/javascript"> |
x = parseFloat( x ); |
|
y = parseFloat( y ); |
var _gaq = _gaq || []; |
return y - x; |
_gaq.push(['_setAccount', 'UA-12341040-3']); |
}; |
_gaq.push(['_trackPageview']); |
$(document).ready(function() { |
|
$('table').dataTable(); |
(function() { |
} ); |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
</script> |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
<link type="text/css" rel="stylesheet" href="style.css"> |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
</head> |
})(); |
<body> |
|
<div class="navbar"> |
</script> |
<div class="navbar-inner"> |
<?php |
<div class="container-fluid"> |
} |
<a class="brand" href="#">contract dashboard</a> |
echo '</div> </div></body> </html>'; |
<ul class="nav"> |
} |
<li><a href="displayAgency.php">agencies</a></li> |
|
<li><a href="displaySupplier.php">suppliers</a></li> |
include ("graphs.inc.php"); |
<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"> |
|
<h3> Filter by: </h3> |
|
<div class="well sidebar-nav"> |
|
<li class="nav-header">Year</li> |
|
<?php |
|
foreach (range(2007,2017) as $year) { |
|
$get = $_GET; |
|
$get['year'] = $year; |
|
$query = http_build_query($get); |
|
echo "<li><A href='?$query'>"; |
|
if ($_GET['year'] == $year) echo "<b>"; |
|
echo "$year"; |
|
if ($_GET['year'] == $year) echo "</b>"; |
|
echo "</a></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']); |
|
|
|
(function() { |
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
|
})(); |
|
|
|
/** |
|
* https://gist.github.com/remy/370590 |
|
* Note that this script is intended to be included at the *end* of the document, before </body> |
|
*/ |
|
(function (window, document) { |
|
if ('open' in document.createElement('details')) return; |
|
|
|
// made global by myself to be reused elsewhere |
|
var addEvent = (function () { |
|
if (document.addEventListener) { |
|
return function (el, type, fn) { |
|
if (el && el.nodeName || el === window) { |
|
el.addEventListener(type, fn, false); |
|
} else if (el && el.length) { |
|
for (var i = 0; i < el.length; i++) { |
|
addEvent(el[i], type, fn); |
|
} |
|
} |
|
}; |
|
} else { |
|
return function (el, type, fn) { |
|
if (el && el.nodeName || el === window) { |
|
el.attachEvent('on' + type, function () { return fn.call(el, window.event); }); |
|
} else if (el && el.length) { |
|
for (var i = 0; i < el.length; i++) { |
|
addEvent(el[i], type, fn); |
|
} |
|
} |
|
}; |
|
} |
|
})(); |
|
|
|
|
|
/** details support - typically in it's own script */ |
|
// find the first /real/ node |
|
function firstNode(source) { |
|
var node = null; |
|
if (source.firstChild.nodeName != "#text") { |
|
return source.firstChild; |
|
} else { |
|
source = source.firstChild; |
|
do { |
|
source = source.nextSibling; |
|
} while (source && source.nodeName == '#text'); |
|
|
|
return source || null; |
|
} |
|
} |
|
|
|
function isSummary(el) { |
|
var nn = el.nodeName.toUpperCase(); |
|
if (nn == 'DETAILS') { |
|
return false; |
|
} else if (nn == 'SUMMARY') { |
|
return true; |
|
} else { |
|
return isSummary(el.parentNode); |
|
} |
|
} |
|
|
|
function toggleDetails(event) { |
|
// more sigh - need to check the clicked object |
|
var keypress = event.type == 'keypress', |
|
target = event.target || event.srcElement; |
|
if (keypress || isSummary(target)) { |
|
if (keypress) { |
|
// if it's a keypress, make sure it was enter or space |
|
keypress = event.which || event.keyCode; |
|
if (keypress == 32 || keypress == 13) { |
|
// all's good, go ahead and toggle |
|
} else { |
|
return; |
|
} |
|
} |
|
|
|
var open = this.getAttribute('open'); |
|
if (open === null) { |
|
this.setAttribute('open', 'open'); |
|
} else { |
|
this.removeAttribute('open'); |
|
} |
|
|
|
// this.className = open ? 'open' : ''; // Lame |
|
// trigger reflow (required in IE - sometimes in Safari too) |
|
setTimeout(function () { |
|
document.body.className = document.body.className; |
|
}, 13); |
|
|
|
if (keypress) { |
|
event.preventDefault && event.preventDefault(); |
|
return false; |
|
} |
|
} |
|
} |
|
|
|
function addStyle() { |
|
var style = document.createElement('style'), |
|
head = document.getElementsByTagName('head')[0], |
|
key = style.innerText === undefined ? 'textContent' : 'innerText'; |
|
|
|
var rules = ['details{display: block;}','details > *{display: none;}','details.open > *{display: block;}','details[open] > *{display: block;}','details > summary:first-child{display: block;cursor: pointer;}','details[open]{display: block;}']; |
|
i = rules.length; |
|
|
|
style[key] = rules.join("\n"); |
|
head.insertBefore(style, head.firstChild); |
|
} |
|
|
|
var details = document.getElementsByTagName('details'), |
|
wrapper, |
|
i = details.length, |
|
j, |
|
first = null, |
|
label = document.createElement('summary'); |
|
|
|
label.appendChild(document.createTextNode('Details')); |
|
|
|
while (i--) { |
|
first = firstNode(details[i]); |
|
|
|
if (first != null && first.nodeName.toUpperCase() == 'SUMMARY') { |
|
// we've found that there's a details label already |
|
} else { |
|
// first = label.cloneNode(true); // cloned nodes weren't picking up styles in IE - random |
|
first = document.createElement('summary'); |
|
first.appendChild(document.createTextNode('Details')); |
|
if (details[i].firstChild) { |
|
details[i].insertBefore(first, details[i].firstChild); |
|
} else { |
|
details[i].appendChild(first); |
|
} |
|
} |
|
|
|
// this feels *really* nasty, but we can't target details :text in css :( |
|
j = details[i].childNodes.length; |
|
while (j--) { |
|
if (details[i].childNodes[j].nodeName === '#text' && (details[i].childNodes[j].nodeValue||'').replace(/\s/g, '').length) { |
|
wrapper = document.createElement('text'); |
|
wrapper.appendChild(details[i].childNodes[j]); |
|
details[i].insertBefore(wrapper, details[i].childNodes[j]); |
|
} |
|
} |
|
|
|
first.legend = true; |
|
first.tabIndex = 0; |
|
} |
|
|
|
// trigger details in case this being used on it's own |
|
document.createElement('details'); |
|
addEvent(details, 'click', toggleDetails); |
|
addEvent(details, 'keypress', toggleDetails); |
|
addStyle(); |
|
|
|
})(window, document); |
|
|
|
</script> |
|
<?php |
|
} |
|
echo '</div> </div></body> </html>'; |
|
} |
|
|
|
include ("graphs.inc.php"); |
|
|