climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boust...@apache.org
Subject svn commit: r1477407 - /incubator/climate/trunk/site/views/rcmed/parameters/index.php
Date Mon, 29 Apr 2013 23:07:33 GMT
Author: boustani
Date: Mon Apr 29 23:07:32 2013
New Revision: 1477407

URL: http://svn.apache.org/r1477407
Log:
Postgres version of Parameter page on RCMES website

Modified:
    incubator/climate/trunk/site/views/rcmed/parameters/index.php

Modified: incubator/climate/trunk/site/views/rcmed/parameters/index.php
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/site/views/rcmed/parameters/index.php?rev=1477407&r1=1477406&r2=1477407&view=diff
==============================================================================
--- incubator/climate/trunk/site/views/rcmed/parameters/index.php (original)
+++ incubator/climate/trunk/site/views/rcmed/parameters/index.php Mon Apr 29 23:07:32 2013
@@ -6,48 +6,48 @@ $activeTab = 'data';
 // Get the global application object
 $app = App::Get();
 
-// Connect to the WRM MySql catalog
-require_once("Org/Apache/Oodt/Balance/Providers/Data/MySqlDataProvider.class.php");
-$provider = new Org_Apache_Oodt_Balance_Providers_Data_MySqlDataProvider();
+// Connect to the RCMES Postgres catalog
+require_once("Org/Apache/Oodt/Balance/Providers/Data/PostgresDataProvider.class.php");
+$provider = new Org_Apache_Oodt_Balance_Providers_Data_PostgresDataProvider();
 $provider->connect(array(
 	"username" => $app->settings['wrm_user'],
 	"password" => $app->settings['wrm_pass'],
 	"server"   => $app->settings['wrm_server'],
 	"database" => $app->settings['wrm_database']));
 
-
 /******************************************************************************
  * If no specific parameter has been specified, show all in a table
  ******************************************************************************/
 if (empty ($app->request->segments[0])):
 	
 	// Request the parameter information
-	$response = $provider->request("SELECT parameter.*,dataset.longName as dsLongName,dataset.shortName
as dsShortName "
-								  ."FROM `parameter`,`dataset` "
-								  ."WHERE dataset.dataset_id=parameter.dataset_id",
-							array("format"   => "assoc"));
-	
+	$response = $provider->request("SELECT parameter.shortname, parameter.longname, parameter.parameter_id,
parameter.units, parameter.start_date, parameter.end_date"
+								.",dataset.longname as dslongname,dataset.shortname as dsshortname "
+								."FROM parameter,dataset "
+								."WHERE dataset.dataset_id=parameter.dataset_id order by parameter_id;",
+								array("format"   => "assoc"));
 	// Build the table widget
 	require_once(HOME . '/scripts/widgets/HtmlTableWidget.php');
 	$tableWidget = new HtmlTableWidget();
+	$tableWidget->addColumn('Id');
 	$tableWidget->addColumn('Parameter Name');
 	$tableWidget->addColumn('Dataset');
-	$tableWidget->addColumn('Id');
 	$tableWidget->addColumn('Unit');
 	$tableWidget->addColumn('Start date');
 	$tableWidget->addColumn('End date');
 
 	foreach ($response->data as $row) {
 		$tableWidget->addRow(array(
-			"<a href=\"" . SITE_ROOT . "/rcmed/parameters/{$row['shortName']}\">{$row['longName']}</a>",
-		    "{$row['dsLongName']} ({$row['dsShortName']}) ",
 			$row['parameter_id'],
+			"<a href=\"" . SITE_ROOT . "/rcmed/parameters/{$row['shortname']}\">{$row['longname']}</a>",
+		        "{$row['dslongname']} ({$row['dsshortname']})",
 			$row['units'],
 			$row['start_date'],
 			$row['end_date']
 		));
 	}
 ?>
+
 <div class="breadcrumbs">
 <a href="<?php echo SITE_ROOT?>/">Home</a>&nbsp;&rarr;&nbsp;
 <a href="<?php echo SITE_ROOT?>/data">Data</a>&nbsp;&rarr;&nbsp;
@@ -73,9 +73,11 @@ else: 
 $paramShortName = $app->request->segments[0];
 
 $response = $provider->request(
-	"SELECT  `parameter`.*,`dataset`.`longName` as dsLongName FROM `parameter`,`dataset` "
-	. "WHERE `parameter`.`shortName`='{$paramShortName}' "
-	. "AND   `dataset`.`dataset_id`=`parameter`.`dataset_id` ",
+	"SELECT  parameter.longname, parameter.description, parameter.units, parameter.referenceurl,
parameter.dataset_id, parameter.parameter_id"
+	.",dataset.longname as dslongname "
+	."FROM parameter,dataset "
+	. "WHERE parameter.shortname='{$paramShortName}' "
+	. "AND   dataset.dataset_id=parameter.dataset_id ",
 	array("format"=>"assoc"));
 $info     = $response->data[0];
 
@@ -84,23 +86,23 @@ $info     = $response->data[0];
 <a href="<?php echo SITE_ROOT?>/">Home</a>&nbsp;&rarr;&nbsp;
 <a href="<?php echo SITE_ROOT?>/data">Data</a>&nbsp;&rarr;&nbsp;
 <a href="<?php echo SITE_ROOT?>/rcmed/parameters">Parameter Index</a>&nbsp;&rarr;&nbsp;
-<?php echo $info['longName']?>
+<?php echo $info['longname'] ?>
 </div>
 <div class="span-7">&nbsp;</div>
 <div class="span-17 last" id="mainSection">
 	<h2 class="larger loud"><?php echo $paramShortName?></h2>
-	<h3>Provided By Dataset: <?php echo $info['dsLongName']?></h3>
+	<h3>Provided By Dataset: <?php echo $info['dslongname']?></h3>
 	<table class="vertical" style="width:100%;">
-	  <tr><th>Long Name</th><td><?php echo $info['longName']?></td></tr>
+	  <tr><th>Long Name</th><td><?php echo $info['longname'] ?></td></tr>
 	  <tr><th>Description</th><td><?php echo $info['description']?></td></tr>
-	  <tr><th>Units</th><td><?php echo $info['units']?></td></tr>
-	  <tr><th>Reference URL</th><td><?php echo $info['referenceURL']?></td></tr>
+	  <tr><th>Units</th><td><?php echo $info['units'] ?></td></tr>
+	  <tr><th>Reference URL</th><td><?php echo $info['referenceurl']?></td></tr>
 	</table>
 
 	<h3>Search for Data...</h3>
 	<form method="GET" action="<?php echo SITE_ROOT?>/parameterQuery.do">
-		<input type="hidden" name="datasetId"   value="<?php echo $info['dataset_id']?>"
label="datasetId"/>
-		<input type="hidden" name="parameterId" value="<?php echo $info['parameter_id']?>"
label="parameterId"/>
+		<input type="hidden" name="datasetId"   value="<?php echo $info['dataset_id'] ?>"
label="datasetId"/>
+		<input type="hidden" name="parameterId" value="<?php echo $info['parameter_id'] ?>"
label="parameterId"/>
 		<table class="vertical">
 		  <tr><td colspan="4">
 		  	    Provide a spatial bound to your search. <br/>



Mime
View raw message