1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
5 * op5, and the op5 logo are trademarks, servicemarks, registered servicemarks
6 * or registered trademarks of op5 AB.
7 * All other trademarks, servicemarks, registered trademarks, and registered
8 * servicemarks mentioned herein may be the property of their respective owner(s).
9 * The information contained herein is provided AS IS with NO WARRANTY OF ANY
10 * KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR A
13 class Showlog_Controller
extends Authenticated_Controller
16 private $options = array();
18 public function __construct()
20 parent
::__construct();
25 protected function get_options()
27 $this->options
= $this->input
->get();
28 if (empty($this->options
))
29 $this->options
= $this->input
->post();
32 if (!empty($this->options
['cal_start']) && isset($this->options
['time_start'])) {
33 $this->options
['first'] = strtotime($this->options
['cal_start'] . ' ' . $this->options
['time_start']);
34 } else if (isset($this->options
['first']) && !empty($this->options
['first'])) {
35 $this->options
['first'] = strtotime($this->options
['first']);
39 if (!empty($this->options
['cal_end']) && isset($this->options
['time_end'])) {
40 $this->options
['last'] = strtotime($this->options
['cal_end'] . ' ' . $this->options
['time_end']);
41 } else if (isset($this->options
['last']) && !empty($this->options
['last'])) {
42 $this->options
['last'] = strtotime($this->options
['last']);
45 if (!isset($this->options
['host_state_options'])) {
46 $this->options
['host_state_options'] = array();
48 if (!isset($this->options
['service_state_options'])) {
49 $this->options
['service_state_options'] = array();
54 # set default if no options are found
56 'state_type' => array('soft' => true, 'hard' => true),
57 'host_state_options' => array('r' => true, 'd' => true, 'u' => true),
58 'service_state_options' => array('r' => true, 'w' => true, 'c' => true, 'u' => true),
59 'hide_initial' => true
61 foreach($defaults as $key => $value) {
62 if(!isset($this->options
[$key])) {
63 $this->options
[$key] = $value;
67 if (!Auth
::instance()->authorized_for('system_information')) {
68 $this->options
['hide_process'] = 1;
69 $this->options
['hide_commands'] = 1;
73 public function _show_log_entries()
75 showlog
::show_log_entries($this->options
);
78 public function basic_setup()
80 $this->template
->js
[] = 'application/media/js/jquery.datePicker.js';
81 $this->template
->js
[] = 'application/media/js/jquery.timePicker.js';
82 $this->template
->js
[] = $this->add_path('reports/js/common.js');
83 $this->template
->js
[] = $this->add_path('showlog/js/showlog.js');
86 $this->template
->css
[] = $this->add_path('reports/css/datePicker.css');
87 $this->template
->css
[] = $this->add_path('showlog/css/showlog.css');
88 $this->js_strings
.= reports
::js_strings();
89 $this->template
->inline_js
= $this->inline_js
;
90 $this->template
->js_strings
= $this->js_strings
;
92 $host_state_options = array
93 (_('Host down') => 'd',
94 _('Host unreachable') => 'u',
95 _('Host recovery') => 'r');
96 $service_state_options = array
97 (_('Service warning') => 'w',
98 _('Service unknown') => 'u',
99 _('Service critical') => 'c',
100 _('Service recovery') => 'r');
102 $this->template
->content
->host_state_options
= $host_state_options;
103 $this->template
->content
->service_state_options
= $service_state_options;
106 public function showlog()
108 $this->template
->content
= $this->add_view('showlog/showlog');
109 $this->basic_setup();
110 $this->template
->title
= _("Reporting ยป Event Log");
112 $is_authorized = false;
113 if (Auth
::instance()->authorized_for('system_information')) {
114 $is_authorized = true;
117 $this->template
->toolbar
= new Toolbar_Controller( _( "Event Log" ) );
119 $this->template
->content
->is_authorized
= $is_authorized;
120 $this->template
->content
->options
= $this->options
;