--- a/lib/common.inc.php +++ b/lib/common.inc.php @@ -4,7 +4,7 @@ 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) { die("A database error occurred.\n"); @@ -14,7 +14,25 @@ if (strstr($_SERVER['PHP_SELF'], "labs/") || strstr($_SERVER['PHP_SELF'], "admin/") || strstr($_SERVER['PHP_SELF'], "heuristics/")) { $basePath = "../"; } -require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php'; +/*require ROOT . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'openid.php'; +require(ROOT.'/solarium/vendor/autoload.php'); +require(ROOT.'/solarium/library/Solarium/Autoloader.php'); +Solarium\Autoloader::register(); +// check solarium version available +//echo 'Solarium library version: ' . Solarium\Client::VERSION . ' - '; +$config = array( + 'endpoint' => array( + 'localhost' => array( + 'host' => '127.0.0.1', + 'port' => 8983, + 'path' => '/solr/contracts/', + ) + ) +); +// create a client instance +$solr_client = new Solarium\Client($config); + + $openid = new LightOpenID($_SERVER['HTTP_HOST']); // you have to open the session to be able to modify or remove it session_start(); @@ -43,7 +61,7 @@ } else { login(); } -} +}*/ // $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); function databaseError($errMsg) { @@ -57,9 +75,10 @@ function ucsmart($str) { $shortWords = Array("The", "Pty", "Ltd", "Inc", "Red", "Oil", "A", "An", "And", "At", "For", "In" , "Of", "On", "Or", "The", "To", "With"); - $strArray = explode(" ", preg_replace("/(?<=(? $value) $totale += array_sum_all($value); return $totale; @@ -95,13 +115,13 @@ if ($supplierParts[0] > 0) $supplierQ = ' "supplierABN" = :supplierABN AND '; else - $supplierQ = ' "supplierName" LIKE :supplierName AND '; + $supplierQ = ' "supplierName" ILIKE :supplierName AND '; } $startYear = 2007; $year = filter_var($_REQUEST['year'], FILTER_SANITIZE_NUMBER_INT); if ($year != "") { - $yearQ = "YEAR(publishDate) = " . $year . " AND "; + $yearQ = 'extract(year from "contractStart") = ' . $year . " AND "; } $standardQ = ' "childCN" is null '; // AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010'; $start = 0.0; @@ -232,11 +252,9 @@ -
+
@@ -266,9 +284,21 @@
@@ -304,4 +334,3 @@ include ("graphs.inc.php"); -