public function __construct(TESTReader &$reader, OPTIONS &$opts, &$items, INTERVAL &$ivl, $resample) { $period = $opts->Get('period'); $this->multiplier = $reader->GetFractionalMultiplier($period); $this->period = $this->multiplier * $period; $this->resample = $this->multiplier * $resample; $from = $this->multiplier * $ivl->GetWindowStart(); $ifrom = ceil($from); $rem = $ifrom % $this->period; if ($rem) { $this->from = $ifrom + ($this->period - $rem); } else { $this->from = $ifrom; } $this->to = $this->multiplier * $ivl->GetWindowEnd(); $limit = $ivl->GetItemLimit(); if ($limit) { if ($limit > 0) { $to = $this->from + $this->period * $limit; if ($to < $this->to) { $this->to = $to; } } else { $from = $this->to + $this->period * $limit; if ($from > $this->from) { $this->from = $from; } } } $this->items =& $items; $limit = $opts->GetDateLimit(TESTData::DEFAULT_START, time()); $this->start = $limit[0]; }
public function __construct(RRDReader &$reader, OPTIONS &$opts, &$items, INTERVAL &$ivl, $resample) { parent::__construct($props); $data_start = $opts->Get('data_start'); $data_start = date("F j, Y", $data_start); $this->period = $opts->Get('step'); $this->file = $reader->rrd_folder . "/" . $reader->rrd_prefix . $opts->Get('file') . ".rrd"; $this->info = $reader::GetRRDInfo($opts->Get('file'), $reader); //get information on the rrd and its archives $this->resample = $resample; $from = $ivl->GetWindowStart(); $ifrom = ceil($from); //get start point as integer $rem = $ifrom % $this->period; //checks whether start point as integer is a multiple of period if ($rem) { $this->from = $ifrom + ($this->period - $rem); } else { $this->from = $ifrom; } //if yes, from is ifrom $this->pos = $this->from; $this->to = $ivl->GetWindowEnd(); $limit = $ivl->GetItemLimit(); //get interval's item limit, if any (defines how many datapoints to show and adjusts to or from based on that?) if ($limit) { if ($limit > 0) { $to = $this->from + $this->period * $limit; if ($to < $this->to) { $this->to = $to; } } else { $from = $this->to + $this->period * $limit; if ($from > $this->from) { $this->from = $from; } } } $this->items =& $items; //items to show (rra:s in this case) //this sets the caching starting point based on the longest rra:s datapoints $limit = $opts->GetDateLimit($data_start, time()); //$limit = $opts->GetDateLimit($this::DEFAULT_START, time());//gets the window limits (as in, the first and last possible timestamp values) $this->start = $limit[0]; }