Merge branch 'maint/7.0'
[ninja.git] / application / widgets / tac_acknowledged / tac_acknowledged.php
blob57747274fce7d56a0364dc1a21c19200b824630a
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * Hosts widget for tactical overview
5 * @author op5 AB
6 */
7 class Tac_acknowledged_Widget extends widget_Base {
8 protected $duplicatable = true;
9 public function index()
11 # fetch widget view path
12 $view_path = $this->view_path('view');
14 $current_status = $this->get_current_status();
16 # HOSTS DOWN / problems
17 $problem = array();
18 $i = 0;
20 if ($current_status->hst->down_and_ack) {
21 $problem[$i]['type'] = _('Host');
22 $problem[$i]['status'] = _('Down');
23 $problem[$i]['url'] = 'status/host/all/'.nagstat::HOST_DOWN.'/?hostprops='.nagstat::HOST_STATE_ACKNOWLEDGED;
24 $problem[$i]['title'] = $current_status->hst->down_and_ack.' '._('Acknowledged hosts');
25 $i++;
28 if ($current_status->hst->unreachable_and_ack) {
29 $problem[$i]['type'] = _('Host');
30 $problem[$i]['status'] = _('Unreachable');
31 $problem[$i]['url'] = 'status/host/all/'.nagstat::HOST_UNREACHABLE.'/?hostprops='.nagstat::HOST_STATE_ACKNOWLEDGED;
32 $problem[$i]['title'] = $current_status->hst->unreachable_and_ack.' '._('Acknowledged hosts');
33 $i++;
36 if ($current_status->svc->critical_and_ack) {
37 $problem[$i]['type'] = _('Service');
38 $problem[$i]['status'] = _('Critical');
39 $problem[$i]['url'] = 'status/service/all/'.(nagstat::HOST_UP|nagstat::HOST_DOWN|nagstat::HOST_UNREACHABLE|nagstat::HOST_PENDING).
40 '/'.nagstat::SERVICE_CRITICAL.'/'.nagstat::SERVICE_STATE_ACKNOWLEDGED;
41 $problem[$i]['title'] = $current_status->svc->critical_and_ack.' '._('Acknowledged services');
42 $i++;
45 if ($current_status->svc->warning_and_ack) {
46 $problem[$i]['type'] = _('Service');
47 $problem[$i]['status'] = _('Warning');
48 $problem[$i]['url'] = 'status/service/all/'.(nagstat::HOST_UP|nagstat::HOST_DOWN|nagstat::HOST_UNREACHABLE|nagstat::HOST_PENDING).
49 '/'.nagstat::SERVICE_WARNING.'/'.nagstat::SERVICE_STATE_ACKNOWLEDGED;
50 $problem[$i]['title'] = $current_status->svc->warning_and_ack.' '._('Acknowledged services');
51 $i++;
54 if ($current_status->svc->unknown_and_ack) {
55 $problem[$i]['type'] = _('Service');
56 $problem[$i]['status'] = _('Unknown');
57 $problem[$i]['url'] = 'status/service/all/'.(nagstat::HOST_UP|nagstat::HOST_DOWN|nagstat::HOST_UNREACHABLE|nagstat::HOST_PENDING).
58 '/'.nagstat::SERVICE_UNKNOWN.'/'.nagstat::SERVICE_STATE_ACKNOWLEDGED;
59 $problem[$i]['title'] = $current_status->svc->unknown_and_ack.' '._('Acknowledged services');
60 $i++;
63 require($view_path);