Пример #1
0
            // 1. output format csv file
            $dFormat = "csv";
            $formatOut = format_out($dFormat, $cleanOut);
            echo "<table><tr><td style='vertical-align: top;'><button onclick='goBack()'>Go Back</button></td><td><form method='post' action='php_ot.php'>\n\t\t<input type='hidden' name='dataSend' value='" . $formatOut . "'/>\n\t\t<input type='hidden' name='FileName' value='" . $csvFileName . "'/>\n\t\t<input type='submit' value='Download CSV'/></form></td>";
            // 3. Output format graph
            $dFormat = "TarraY";
            $formatOut = format_out($dFormat, $cleanOut);
            $formatOut = TwoArrays($formatOut);
            $xdata = QuotedXdata($formatOut[0]);
            // quoted output required for serialization
            $ydata = implode(',', $formatOut[1]);
            //print_r($xdata);
            echo "<td><form method='post' action='" . $phpSelf . "'>\n\t\t<input type='hidden' name='xdata' value=" . serialize($xdata) . "/>\n\t\t<input type='hidden' name='ydata' value='" . $ydata . "'/>\n\t\t<input type='submit' value='Output Chart'/></form></td>";
            // 2. Output Format table
            $dFormat = "table";
            $formatOut = format_out($dFormat, $cleanOut);
            print_r($formatOut);
            // sub-functions 1. asCSVStr, 2. asTable
            // Should be used only after TnV function
            //$formatOut2 = asTable($formatOut);
            //print_r($formatOut2);
        } else {
            echo "<br/>Enter Correct Time Interval <br/>";
        }
    }
    //session_start();
}
echo "</div></body>";
echo "</html>";
//
if (isset($_POST['xdata']) && isset($_POST['ydata'])) {
 function GetAllObs($StoreRawURL, $AllThisTog, $GetObsPre, $ProPre, $EvtTimePre, $ObsProPre, $GetObsEnd)
 {
     //echo "<h3> Sensor Observations </h3>";
     $AllSensorObsData = array();
     $rawServUrl = $StoreRawURL;
     for ($i = 0; $i < sizeof($AllThisTog); $i++) {
         $myCurentOffering = $AllThisTog[$i]['ObservationOffering'];
         $nProc = $AllThisTog[$i]['procedure'];
         $Nsens = $AllThisTog[$i]['observedProperty'];
         $SenStart = $AllThisTog[$i]['beginPosition'];
         $SenEnd = $AllThisTog[$i]['endPosition'];
         //echo $myCurentOffering."||".$nProc."||".$Nsens."||".$SenStart."||".$SenEnd."<br/>";
         $getObsURL = $rawServUrl . $GetObsPre . $myCurentOffering . $ProPre . $nProc . $EvtTimePre . $SenEnd . $ObsProPre . $Nsens . $GetObsEnd;
         $GetObsStr = "";
         $GetObsOutput = post_data($getObsURL, $GetObsStr);
         // extract
         $cleanOut = parse_GetObs($GetObsOutput);
         // format to a. csv. b. 'TarraY' three dimensional array, c. table, d. 'TnV' only time and value
         // 1. output format csv file
         $dFormat = "TarraY";
         $formatOut = format_out($dFormat, $cleanOut);
         $AllSensorObsData[$i]['ObservationOffering'] = $myCurentOffering;
         $AllSensorObsData[$i]['procedure'] = $nProc;
         $AllSensorObsData[$i]['observedProperty'] = $Nsens;
         $AllSensorObsData[$i]['time'] = $formatOut[0]['time'];
         $AllSensorObsData[$i]['value'] = $formatOut[0]['value'];
     }
     return $AllSensorObsData;
 }