Commit 61193896f72fa1ad85f6a536ed58978f7ae0c22a
1 parent
9846ec70
Exists in
master
and in
95 other branches
WS - getParameter accept multi params (#6959)
Showing
1 changed file
with
27 additions
and
6 deletions
Show diff stats
php/WebServices/WebServer.php
@@ -234,7 +234,7 @@ class WebServer | @@ -234,7 +234,7 @@ class WebServer | ||
234 | $params[] = $param; | 234 | $params[] = $param; |
235 | } | 235 | } |
236 | 236 | ||
237 | - $ref_sampling_param = isset($formatInfo['ref_sampling_param']) ? $formatInfo['ref_sampling_param'] : NULL; | 237 | + $ref_sampling_param = isset($interval['ref_sampling_param']) ? $interval['ref_sampling_param'] : NULL; |
238 | 238 | ||
239 | $obj = (object)array( | 239 | $obj = (object)array( |
240 | "sampling" => $interval['sampling'], | 240 | "sampling" => $interval['sampling'], |
@@ -426,28 +426,49 @@ class WebServer | @@ -426,28 +426,49 @@ class WebServer | ||
426 | $timeFormat = $vars["timeFormat"]; | 426 | $timeFormat = $vars["timeFormat"]; |
427 | } | 427 | } |
428 | 428 | ||
429 | + $sampling = !empty($vars["sampling"]) ? $vars["sampling"] : NULL; | ||
430 | + $ref_sampling_param = NULL; | ||
431 | + $file_info = ""; | ||
429 | 432 | ||
430 | if (empty($vars["parameterID"])) { | 433 | if (empty($vars["parameterID"])) { |
431 | $this->throwError("requestError", "Missing parameterID definition"); | 434 | $this->throwError("requestError", "Missing parameterID definition"); |
432 | } | 435 | } |
433 | $paramId = array(); | 436 | $paramId = array(); |
434 | - array_push($paramId, $vars["parameterID"]); | 437 | + if (strpos($vars["parameterID"], ',')) { |
438 | + $paramId = explode(',', $vars["parameterID"]); | ||
439 | + | ||
440 | + if (!isset($sampling)) | ||
441 | + { | ||
442 | + $ref_sampling_param = trim($paramId[0]); | ||
443 | + } | ||
444 | + | ||
445 | + foreach ($paramId as &$id) { | ||
446 | + $id = trim($id); | ||
447 | + if (!empty($file_info)) { | ||
448 | + $file_info .= "-"; | ||
449 | + } | ||
450 | + $file_info .= $id; | ||
451 | + } | ||
452 | + } | ||
453 | + else { | ||
454 | + array_push($paramId, $vars["parameterID"]); | ||
455 | + $file_info = $vars["parameterID"]; | ||
456 | + } | ||
435 | 457 | ||
436 | if (empty($vars["gzip"])) | 458 | if (empty($vars["gzip"])) |
437 | $gzip = 0; | 459 | $gzip = 0; |
438 | else | 460 | else |
439 | $gzip = ($vars["gzip"] == 1); | 461 | $gzip = ($vars["gzip"] == 1); |
440 | 462 | ||
441 | - $sampling = !empty($vars["sampling"]) ? $vars["sampling"] : NULL; | ||
442 | - | ||
443 | $outputFormat = !empty($vars["outputFormat"]) ? $vars["outputFormat"] : 'ASCII'; | 463 | $outputFormat = !empty($vars["outputFormat"]) ? $vars["outputFormat"] : 'ASCII'; |
444 | 464 | ||
445 | $this->service = strtolower(__FUNCTION__); | 465 | $this->service = strtolower(__FUNCTION__); |
446 | 466 | ||
447 | $res = $this->doDownloadRequest( | 467 | $res = $this->doDownloadRequest( |
448 | - array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling), | 468 | + array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling, |
469 | + "ref_sampling_param" => $ref_sampling_param), | ||
449 | array("params" => $paramId), | 470 | array("params" => $paramId), |
450 | - array("format" => $outputFormat, "timeFormat"=> $timeFormat, "gzip"=>$gzip), $paramId); | 471 | + array("format" => $outputFormat, "timeFormat"=> $timeFormat, "gzip"=>$gzip), $file_info); |
451 | 472 | ||
452 | if ($res['success']) | 473 | if ($res['success']) |
453 | return $res; | 474 | return $res; |