ResourceID)); return end($name); } protected function setHelpAttribute($node, $helpFile) { $node->setAttribute('att', ""); } protected function setSimulationRunNodeDescription($runNode,$sr) { $coords = $this->getCoordinateSystem($sr->SimulationDomain->CoordinateSystem); $domain = $this->getRegionBoundaries($sr->SimulationDomain, null); $properties = $this->getProperties($sr); $runNode->setAttribute('desc', $coords.$domain.$properties); } protected function getAccessUrl($no) { $url = $no->AccessInformation->AccessURL->URL; $resourceID = $no->ResourceID; if ($url == '') { foreach ($this->tree->Granule as $granule) { $granuleID = $granule->ParentID; if ("$granuleID" == "$resourceID") { $url = $granule->Source->URL; break; } } } return $url; } protected function getStartTime($no) { $start = $no->TemporalDescription->TimeSpan->StartDate; $stpos = strpos($start, '+'); if ($stpos > 0) $start = substr($start,0,$stpos); return $start."Z"; } protected function getStopTime($no) { $stop = $no->TemporalDescription->TimeSpan->StopDate; $stpos = strpos($stop, '+'); if ($stpos > 0) $stop = substr($stop,0,$stpos); return $stop."Z"; } protected function getProperties($sr) { $descInternal = "
Internal Magnetic Field :
: "; $inputFields = $sr->InputField; foreach ($inputFields as $field) { $descInternal .= $field->Name."
"; } $descInternal .= "Input Neutrals : "; $inputPopulations = $sr->InputPopulation; foreach ($inputPopulations as $population) { $descInternal .= $population->Name.";"; } return $descInternal; } protected function getRegionBoundaries($domain, $region = null) { $desc = "
Domain:

"; $spatialDimension = $domain->SpatialDimension; $ValidMinsDom = preg_split ("/\s+/", $domain->ValidMin); $ValidMaxsDom = preg_split ("/\s+/", $domain->ValidMax); $unitsDomain = preg_split ("/\s+/", $domain->Units); $coordLabel = preg_split ("/\s+/",$domain->CoordinatesLabel); for($j=0; $j< $spatialDimension; $j++) { $desc .= $coordLabel[$j]." : [ ".$ValidMinsDom[$j].", ".$ValidMaxsDom[$j]."] ".$unitsDomain[$j]."
"; } return $desc; } public function getFileName($resourceID, $templateArgs = null, $start = null) { $strpos = strrpos($resourceID, "/"); if ($strpos > 0) $fileName = substr(strtr($resourceID, $this->impex_pairs),0,$strpos); $fileName .= ".cdf"; return $fileName; } public function getMask($resourceID, $templateArgs = null) { return $this->getFileName($resourceID); } public function getData($params) { // $r = print_r($params,true); // error_log($params['accessUrl'],3,'/home/budnik/LOG'); return $params['accessUrl']; } public function getTableDefinition($viID = null) { $res = array(); if ($viID) { // amdaParam (like EISCAT) } else { $res["tableDefType"] = "SELECT"; $res["channelsDefType"] = "CENTER"; $res["data"] = array(); $res["data"]["center"] = $this->energyTableName; $res["data"]["width"] = $this->energyTableWidth; } return $res; } public function validateStartStop($fileName, $startTime, $stopTime) { $res = array(); exec('cdfstartstopfromdata '.IHMConfigClass::getLocalBasePath().$fileName, $start_stop); $tempArr = explode(' ', $start_stop[0]); $res["start"] = date("Y-m-d\TH:i:s",(int)$tempArr[0]); $res["stop"] = date("Y-m-d\TH:i:s",(int)$tempArr[1]); if ( strtotime($startTime) >= (int)$tempArr[1] || strtotime($stopTime) <= (int)$tempArr[0] ) $res["success"] = false; else $res["success"] = true; return $res; } } ?>