+ $gDefs = ''; $gGraphs = ''; $addSpecial = '';
+
+ if ($timeframe == 'day') {
+ $duration = isset($extra['duration'])?$extra['duration']:30*3600; // 30 hours
+ $slice = isset($extra['slice'])?$extra['slice']:300; // 5 minutes
+ // vertical lines at day borders
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d')).'#FF0000';
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d').' -1 day').'#FF0000';
+ if (!isset($extra['grid_x'])) { $extra['grid_x'] = 'HOUR:1:HOUR:6:HOUR:2:0:%-H'; }
+ }
+ elseif ($timeframe == 'week') {
+ $duration = isset($extra['duration'])?$extra['duration']:8*86400; // 8 days
+ $slice = isset($extra['slice'])?$extra['slice']:1800; // 30 minutes
+ // vertical lines at week borders
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d').' '.(-date('w')+1).' day').'#FF0000';
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-m-d').' '.(-date('w')-6).' day').'#FF0000';
+ }
+ elseif ($timeframe == 'month') {
+ $duration = isset($extra['duration'])?$extra['duration']:36*86400; // 36 days
+ $slice = isset($extra['slice'])?$extra['slice']:7200; // 2 hours
+ // vertical lines at month borders
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-m-01')).'#FF0000';
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-m-01').' -1 month').'#FF0000';
+ }
+ elseif ($timeframe == 'year') {
+ $duration = isset($extra['duration'])?$extra['duration']:396*86400; // 365+31 days
+ $slice = isset($extra['slice'])?$extra['slice']:86400; // 1 day
+ // vertical lines at month borders
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-01-01')).'#FF0000';
+ $addSpecial .= ' VRULE:'.strtotime(date('Y-01-01').' -1 year').'#FF0000';
+ }
+ else {
+ $duration = isset($extra['duration'])?$extra['duration']:$this->rrd_step*500; // 500 steps
+ $slice = isset($extra['slice'])?$extra['slice']:$this->rrd_step; // whatever our step is
+ }
+