1<?php defined('SYSPATH') OR die('No direct access allowed.'); 2/** 3 * Zoom controller. 4 * 5 * @package PNP4Nagios 6 * @author Joerg Linge 7 * @license GPL 8 */ 9class Zoom_Controller extends System_Controller { 10 11 12 public function __construct() 13 { 14 parent::__construct(); 15 $this->template = $this->add_view('zoom'); 16 #$this->tpl = $this->input->get('tpl'); 17 $this->graph_width = $this->config->conf['zgraph_width']; 18 $this->graph_height = $this->config->conf['zgraph_height']; 19 } 20 21 public function index() 22 { 23 #$this->source = intval($this->input->get('source')); 24 #$this->view = ""; 25 26 #if(isset($_GET['view']) && $_GET['view'] != "" ){ 27 # $this->view = pnp::clean($_GET['view']); 28 #}else{ 29 # $this->view = $this->config->conf['overview-range']; 30 #} 31 32 # 33 # Limit startto 2000/01/01 34 # 35 $start_limit = strtotime("2000/01/01"); 36 $this->start = abs((int)$this->start); 37 if($this->start < $start_limit) 38 $this->start = $start_limit; 39 # 40 # Limit end to now + one hour 41 # 42 $end_limit = time() + 3600; 43 $this->end = abs((int)$this->end); 44 if($this->end > $end_limit) 45 $this->end = $end_limit; 46 47 $this->data->getTimeRange($this->start,$this->end,$this->view); 48 49 if(isset($this->tpl) && $this->tpl != 'undefined' ){ 50 if($this->start && $this->end ){ 51 $this->session->set("start", $this->start); 52 $this->session->set("end", $this->end); 53 } 54 $this->template->tpl = $this->tpl; 55 $this->template->view = $this->view; 56 $this->template->source = $this->source; 57 $this->template->end = $this->end; 58 $this->template->start = $this->start; 59 $this->url = "?tpl=".$this->tpl; 60 $this->template->graph_height = $this->graph_height; 61 $this->template->graph_width = $this->graph_width; 62 }elseif(isset($this->host) && isset($this->service)){ 63 if($this->start && $this->end ){ 64 $this->session->set("start", $this->start); 65 $this->session->set("end", $this->end); 66 } 67 $this->template->host = $this->host; 68 $this->template->srv = $this->service; 69 $this->template->view = $this->view; 70 $this->template->source = $this->source; 71 $this->template->end = $this->end; 72 $this->template->start = $this->start; 73 $this->url = "?host=".urlencode($this->host)."&srv=".urlencode($this->service); 74 $this->template->graph_height = $this->graph_height; 75 $this->template->graph_width = $this->graph_width; 76 }else{ 77 url::redirect("/graph"); 78 } 79 } 80} 81