/** * Retrieve the data needed for computation of this form */ function prepareStatsData() { global $statsinfo; $timeRange = $statsinfo->getRangeArray(); $this->dateFormat = $statsinfo->getDateFormat($timeRange['interval']); $timeRange['interval'] = $statsinfo->getIntervalTicks($timeRange['interval']); $diagram = $this->summaryType; $paramArray = array('api_call' => $this->summaryType); if (substr($diagram, 0, 8) == "nxhours:") { $paramArray = array('what' => substr($diagram, 8), 'api_call' => "hours"); $this->hours = true; } else { if (substr($diagram, 0, 11) == "nxweekdays:") { $paramArray = array('what' => substr($diagram, 11), 'api_call' => "weekdays"); $this->weekdays = true; } } if (substr($diagram, 0, 11) == "nxweekdays:") { $weekdays = true; $diagram = substr($diagram, 11); } $constraint = array(); if ($this->spid != "") { $constraint["constraints"] = array('document_string' => $this->spid); } $this->data = phpOpenTracker::get(array_merge($paramArray, $timeRange, $constraint)); $this->minTs = getMinTs($this->data); $this->maxTs = getMaxTs($this->data); $this->median = getMedian($this->data); $this->total = getTotal($this->data); $this->average = getAverage($this->data); }
protected function readTrack($filepath) { $arstr = file($filepath); $this->trackCount[$filepath] = 0; $armag = array(); for ($i = 2; $i < count($arstr); $i++) { $armeas = $arstr[$i]; $meas = explode(" ", $armeas); $del = 13 - count($meas); $mag = (double) $meas[11 - $del]; $armag[] = $mag; } $trackparams = array(); $trackparams['mag'] = getMedian($armag); for ($i = 2; $i < count($arstr); $i++) { $armeas = $arstr[$i]; $trackId = $filepath; $this->trackCount[$filepath] += 1; $meas = explode(" ", $armeas); $del = 13 - count($meas); //поправка, если в track калесы значения с минусами $x = (double) $meas[7 - $del]; $y = 3056 - (double) $meas[9 - $del]; $mag = (double) $meas[11 - $del]; $fitpath = array_pop($meas); //$this->arrayTrack["$trackId"][]=array('x'=>$x,'y'=>$y,'fitpath'=>$fitpath); $p = array('x' => $x, 'y' => $y, 'fitpath' => $fitpath); if (!in_array($p, $this->uniqPoints)) { $this->arrayTrack[] = new Point($trackId, array('x' => $x, 'y' => $y, 'fitpath' => $fitpath, 'mag' => $mag), 'Kalesa', $trackparams); array_push($this->uniqPoints, $p); } else { $key = array_search($p, $this->uniqPoints); //$m = $this->arrayTrack[$key]; //$m->SetTrackId('Kalesa',$trackId); $this->arrayTrack[$key]->SetTrackId('Kalesa', $trackId); //echo "KEY = ".$m->GetTrackId('Kalesa')."\n"; } } return; }