Blame view

src/DDSERVICES/REST/getStartStop.php 1.19 KB
c6b37322   Elena.Budnik   data version : ne...
1
2
3
4
5
6
7
8
<?php
  
/** 
*   @file getStartStop.php
*   @brief Returns GlobalStart - GlobalStop for a given DataSet 
*   @version $Id:  $ 
*/

3765ffaf   Elena.Budnik   isset GET
9
10
		if (!isset($_GET['id'])) exit('INPUT ERROR');
		
c6b37322   Elena.Budnik   data version : ne...
11
		require_once './DDserverWeb_ini.php';
3765ffaf   Elena.Budnik   isset GET
12
		
c6b37322   Elena.Budnik   data version : ne...
13
14
15
16
17
18
		error_reporting(E_ERROR | E_WARNING | E_PARSE);

		$replace = array("-" => "_");

		$dataSet = strtr($_GET['id'], $replace); 

a95d1dc4   Elena.Budnik   / in path
19
		$referXML = baseDir."/DDsys.xml";
c6b37322   Elena.Budnik   data version : ne...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
		$DDsys = new DOMDocument("1.0");
		$DDsys->load($referXML);
		$xp = new domxpath($DDsys);
		$VI_NAME = $xp->query("//NAME[.='".$dataSet."']");

		if ($VI_NAME->item(0)->nodeValue != NULL)
		{
				$VI = $VI_NAME->item(0)->parentNode;
				$location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;           
				$info = basename($VI->getElementsByTagName("INFO")->item(0)->nodeValue, '.nc').'.xml'; 
				if (!file_exists($location.$info))
						exit('NO INFO XML');
				
				$infoDom = new DOMDocument("1.0");
				$infoDom->loadXML(file_get_contents($location.$info)); // for NFS

				$Start = $infoDom->getElementsByTagName("GlobalStart")->item(0)->nodeValue;
				$Stop = $infoDom->getElementsByTagName("GlobalStop")->item(0)->nodeValue;
						exit($Start.",".$Stop);
		}
		else {
				exit('NO SUCH DATASET');
		}
?>