2013-06-27 10:14:41 +02:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013 Icinga Development Team | GPLv2+ */
|
2013-08-20 11:44:05 +02:00
|
|
|
|
2015-08-28 09:40:28 +02:00
|
|
|
namespace Icinga\Module\Monitoring\Controllers;
|
|
|
|
|
2015-08-28 09:41:13 +02:00
|
|
|
use Zend_Form;
|
2015-08-28 09:39:48 +02:00
|
|
|
use Icinga\Data\Filter\Filter;
|
2014-06-06 09:37:37 +02:00
|
|
|
use Icinga\Module\Monitoring\Backend;
|
2015-08-28 09:39:48 +02:00
|
|
|
use Icinga\Module\Monitoring\Controller;
|
|
|
|
use Icinga\Module\Monitoring\DataView\DataView;
|
2015-05-07 16:20:59 +02:00
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
2014-11-14 11:17:22 +01:00
|
|
|
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm;
|
2015-08-28 09:39:48 +02:00
|
|
|
use Icinga\Module\Monitoring\Forms\StatehistoryForm;
|
2014-06-06 09:37:37 +02:00
|
|
|
use Icinga\Web\Url;
|
2013-10-09 16:38:46 +02:00
|
|
|
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
2015-09-30 14:47:42 +02:00
|
|
|
use Icinga\Web\Widget\Tabextension\MenuAction;
|
2013-10-09 16:38:46 +02:00
|
|
|
use Icinga\Web\Widget\Tabextension\OutputFormat;
|
|
|
|
use Icinga\Web\Widget\Tabs;
|
2013-09-24 15:26:10 +02:00
|
|
|
|
2015-08-28 09:40:28 +02:00
|
|
|
class ListController extends Controller
|
2013-06-27 10:14:41 +02:00
|
|
|
{
|
2013-08-14 12:42:32 +02:00
|
|
|
/**
|
|
|
|
* @see ActionController::init
|
|
|
|
*/
|
2013-06-27 10:14:41 +02:00
|
|
|
public function init()
|
|
|
|
{
|
2015-05-11 13:36:58 +02:00
|
|
|
parent::init();
|
2013-08-08 16:22:22 +02:00
|
|
|
$this->createTabs();
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
|
2013-08-30 15:50:49 +02:00
|
|
|
/**
|
|
|
|
* Overwrite the backend to use (used for testing)
|
|
|
|
*
|
|
|
|
* @param Backend $backend The Backend that should be used for querying
|
|
|
|
*/
|
|
|
|
public function setBackend($backend)
|
|
|
|
{
|
|
|
|
$this->backend = $backend;
|
|
|
|
}
|
|
|
|
|
2013-08-14 12:42:32 +02:00
|
|
|
/**
|
2016-03-31 09:49:02 +02:00
|
|
|
* List hosts
|
2013-08-14 12:42:32 +02:00
|
|
|
*/
|
2013-06-27 10:14:41 +02:00
|
|
|
public function hostsAction()
|
|
|
|
{
|
2016-03-31 09:49:02 +02:00
|
|
|
$this->addTitleTab(
|
|
|
|
'hosts',
|
|
|
|
$this->translate('Hosts'),
|
|
|
|
$this->translate('List hosts')
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->setAutorefreshInterval(10);
|
|
|
|
|
2014-06-26 00:42:38 +02:00
|
|
|
// Handle soft and hard states
|
2015-01-20 16:14:56 +01:00
|
|
|
if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') {
|
2014-06-26 00:42:38 +02:00
|
|
|
$stateColumn = 'host_hard_state';
|
|
|
|
$stateChangeColumn = 'host_last_hard_state_change';
|
|
|
|
} else {
|
|
|
|
$stateColumn = 'host_state';
|
|
|
|
$stateChangeColumn = 'host_last_state_change';
|
|
|
|
}
|
2016-03-31 09:49:02 +02:00
|
|
|
|
|
|
|
$hosts = $this->backend->select()->from('hoststatus', array_merge(array(
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_icon_image',
|
2015-05-21 14:59:12 +02:00
|
|
|
'host_icon_image_alt',
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_name',
|
2015-01-20 16:23:12 +01:00
|
|
|
'host_display_name',
|
2014-06-26 00:42:38 +02:00
|
|
|
'host_state' => $stateColumn,
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_acknowledged',
|
|
|
|
'host_output',
|
2014-08-22 11:23:45 +02:00
|
|
|
'host_attempt',
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_in_downtime',
|
|
|
|
'host_is_flapping',
|
|
|
|
'host_state_type',
|
|
|
|
'host_handled',
|
2014-06-26 00:42:38 +02:00
|
|
|
'host_last_state_change' => $stateChangeColumn,
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_notifications_enabled',
|
|
|
|
'host_active_checks_enabled',
|
2018-07-03 14:41:55 +02:00
|
|
|
'host_passive_checks_enabled',
|
|
|
|
'host_check_command'
|
2015-05-18 16:29:33 +02:00
|
|
|
), $this->addColumns()));
|
2016-03-31 09:49:02 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $hosts);
|
|
|
|
|
|
|
|
$this->setupPaginationControl($hosts);
|
|
|
|
$this->setupSortControl(array(
|
|
|
|
'host_severity' => $this->translate('Severity'),
|
|
|
|
'host_state' => $this->translate('Current State'),
|
|
|
|
'host_display_name' => $this->translate('Hostname'),
|
|
|
|
'host_address' => $this->translate('Address'),
|
|
|
|
'host_last_check' => $this->translate('Last Check'),
|
|
|
|
'host_last_state_change' => $this->translate('Last State Change')
|
|
|
|
), $hosts);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($hosts);
|
|
|
|
$this->setupLimitControl();
|
2016-03-31 09:49:02 +02:00
|
|
|
|
2015-06-03 14:16:22 +02:00
|
|
|
$stats = $this->backend->select()->from('hoststatussummary', array(
|
2014-11-14 16:50:34 +01:00
|
|
|
'hosts_total',
|
|
|
|
'hosts_up',
|
|
|
|
'hosts_down',
|
|
|
|
'hosts_down_handled',
|
|
|
|
'hosts_down_unhandled',
|
|
|
|
'hosts_unreachable',
|
|
|
|
'hosts_unreachable_handled',
|
|
|
|
'hosts_unreachable_unhandled',
|
|
|
|
'hosts_pending',
|
2015-06-03 14:16:22 +02:00
|
|
|
));
|
|
|
|
$this->applyRestriction('monitoring/filter/objects', $stats);
|
2015-08-07 15:37:35 +02:00
|
|
|
|
2016-03-31 09:49:02 +02:00
|
|
|
$summary = $hosts->getQuery()->queryServiceProblemSummary();
|
|
|
|
|
|
|
|
$this->view->hosts = $hosts;
|
|
|
|
$this->view->stats = $stats;
|
2015-08-07 15:37:35 +02:00
|
|
|
$this->view->summary = $summary->fetchPairs();
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
|
2013-08-14 12:42:32 +02:00
|
|
|
/**
|
2016-03-31 10:05:21 +02:00
|
|
|
* List services
|
2013-08-14 12:42:32 +02:00
|
|
|
*/
|
2013-06-27 10:14:41 +02:00
|
|
|
public function servicesAction()
|
|
|
|
{
|
2016-03-31 10:05:21 +02:00
|
|
|
$this->addTitleTab(
|
|
|
|
'services',
|
|
|
|
$this->translate('Services'),
|
|
|
|
$this->translate('List services')
|
|
|
|
);
|
|
|
|
|
2014-06-26 00:42:38 +02:00
|
|
|
// Handle soft and hard states
|
2015-01-20 16:14:56 +01:00
|
|
|
if (strtolower($this->params->shift('stateType', 'soft')) === 'hard') {
|
2014-06-26 00:42:38 +02:00
|
|
|
$stateColumn = 'service_hard_state';
|
|
|
|
$stateChangeColumn = 'service_last_hard_state_change';
|
|
|
|
} else {
|
|
|
|
$stateColumn = 'service_state';
|
|
|
|
$stateChangeColumn = 'service_last_state_change';
|
|
|
|
}
|
|
|
|
|
2014-03-04 13:33:02 +01:00
|
|
|
$this->setAutorefreshInterval(10);
|
2014-07-16 17:49:25 +02:00
|
|
|
|
2016-03-31 10:05:21 +02:00
|
|
|
$services = $this->backend->select()->from('servicestatus', array_merge(array(
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_name',
|
2015-01-21 09:41:52 +01:00
|
|
|
'host_display_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_state',
|
|
|
|
'service_description',
|
|
|
|
'service_display_name',
|
2014-06-26 00:42:38 +02:00
|
|
|
'service_state' => $stateColumn,
|
2014-06-06 09:37:37 +02:00
|
|
|
'service_in_downtime',
|
|
|
|
'service_acknowledged',
|
|
|
|
'service_handled',
|
|
|
|
'service_output',
|
|
|
|
'service_perfdata',
|
|
|
|
'service_attempt',
|
2014-06-26 00:42:38 +02:00
|
|
|
'service_last_state_change' => $stateChangeColumn,
|
2014-06-06 09:37:37 +02:00
|
|
|
'service_icon_image',
|
2015-05-21 14:59:12 +02:00
|
|
|
'service_icon_image_alt',
|
2014-06-06 09:37:37 +02:00
|
|
|
'service_is_flapping',
|
|
|
|
'service_state_type',
|
|
|
|
'service_handled',
|
|
|
|
'service_severity',
|
|
|
|
'service_notifications_enabled',
|
|
|
|
'service_active_checks_enabled',
|
2018-07-03 14:41:55 +02:00
|
|
|
'service_passive_checks_enabled',
|
|
|
|
'service_check_command'
|
2016-03-31 10:05:21 +02:00
|
|
|
), $this->addColumns()));
|
|
|
|
$this->applyRestriction('monitoring/filter/objects', $services);
|
2015-05-15 10:56:52 +02:00
|
|
|
|
2016-03-31 10:05:21 +02:00
|
|
|
$this->setupPaginationControl($services);
|
2013-09-03 18:43:17 +02:00
|
|
|
$this->setupSortControl(array(
|
2015-12-18 15:48:55 +01:00
|
|
|
'service_severity' => $this->translate('Service Severity'),
|
|
|
|
'service_state' => $this->translate('Current Service State'),
|
|
|
|
'service_display_name' => $this->translate('Service Name'),
|
|
|
|
'service_last_check' => $this->translate('Last Service Check'),
|
2015-12-21 10:33:21 +01:00
|
|
|
'service_last_state_change' => $this->translate('Last State Change'),
|
2015-12-18 15:48:55 +01:00
|
|
|
'host_severity' => $this->translate('Host Severity'),
|
|
|
|
'host_state' => $this->translate('Current Host State'),
|
|
|
|
'host_display_name' => $this->translate('Hostname'),
|
|
|
|
'host_address' => $this->translate('Host Address'),
|
2015-12-21 10:33:21 +01:00
|
|
|
'host_last_check' => $this->translate('Last Host Check')
|
2016-03-31 10:05:21 +02:00
|
|
|
), $services);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($services);
|
|
|
|
$this->setupLimitControl();
|
2014-09-05 17:40:57 +02:00
|
|
|
|
2015-06-03 14:44:36 +02:00
|
|
|
$stats = $this->backend->select()->from('servicestatussummary', array(
|
2014-09-05 17:40:57 +02:00
|
|
|
'services_critical',
|
|
|
|
'services_critical_handled',
|
2015-06-03 14:44:36 +02:00
|
|
|
'services_critical_unhandled',
|
|
|
|
'services_ok',
|
|
|
|
'services_pending',
|
|
|
|
'services_total',
|
2014-09-05 17:40:57 +02:00
|
|
|
'services_unknown',
|
|
|
|
'services_unknown_handled',
|
2015-06-03 14:44:36 +02:00
|
|
|
'services_unknown_unhandled',
|
|
|
|
'services_warning',
|
|
|
|
'services_warning_handled',
|
|
|
|
'services_warning_unhandled'
|
|
|
|
));
|
|
|
|
$this->applyRestriction('monitoring/filter/objects', $stats);
|
2016-03-31 10:05:21 +02:00
|
|
|
|
|
|
|
$this->view->services = $services;
|
2015-06-23 08:49:11 +02:00
|
|
|
$this->view->stats = $stats;
|
2016-03-31 10:05:21 +02:00
|
|
|
if (strpos($this->params->get('host_name', '*'), '*') === false) {
|
|
|
|
$this->view->showHost = false;
|
|
|
|
} else {
|
|
|
|
$this->view->showHost = true;
|
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|
|
|
|
|
2013-07-30 17:17:19 +02:00
|
|
|
/**
|
2016-03-31 09:25:56 +02:00
|
|
|
* List downtimes
|
2013-07-30 17:17:19 +02:00
|
|
|
*/
|
|
|
|
public function downtimesAction()
|
|
|
|
{
|
2016-03-31 09:25:56 +02:00
|
|
|
$this->addTitleTab(
|
|
|
|
'downtimes',
|
|
|
|
$this->translate('Downtimes'),
|
|
|
|
$this->translate('List downtimes')
|
|
|
|
);
|
|
|
|
|
2014-03-09 21:58:01 +01:00
|
|
|
$this->setAutorefreshInterval(12);
|
2015-04-17 16:13:22 +02:00
|
|
|
|
2016-03-31 09:25:56 +02:00
|
|
|
$downtimes = $this->backend->select()->from('downtime', array(
|
2014-06-06 09:37:37 +02:00
|
|
|
'id' => 'downtime_internal_id',
|
2015-05-26 17:07:58 +02:00
|
|
|
'objecttype' => 'object_type',
|
2014-06-06 09:37:37 +02:00
|
|
|
'comment' => 'downtime_comment',
|
2015-04-10 14:23:05 +02:00
|
|
|
'author_name' => 'downtime_author_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'start' => 'downtime_start',
|
|
|
|
'scheduled_start' => 'downtime_scheduled_start',
|
2014-08-19 17:03:35 +02:00
|
|
|
'scheduled_end' => 'downtime_scheduled_end',
|
2014-06-06 09:37:37 +02:00
|
|
|
'end' => 'downtime_end',
|
|
|
|
'duration' => 'downtime_duration',
|
|
|
|
'is_flexible' => 'downtime_is_flexible',
|
|
|
|
'is_fixed' => 'downtime_is_fixed',
|
|
|
|
'is_in_effect' => 'downtime_is_in_effect',
|
|
|
|
'entry_time' => 'downtime_entry_time',
|
2016-08-31 14:05:36 +02:00
|
|
|
'name' => 'downtime_name',
|
2015-05-26 17:07:58 +02:00
|
|
|
'host_state',
|
|
|
|
'service_state',
|
2015-04-10 14:19:38 +02:00
|
|
|
'host_name',
|
|
|
|
'service_description',
|
2015-01-21 12:53:26 +01:00
|
|
|
'host_display_name',
|
|
|
|
'service_display_name'
|
2015-01-21 12:55:41 +01:00
|
|
|
));
|
2016-03-31 09:25:56 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $downtimes);
|
2015-05-15 10:56:52 +02:00
|
|
|
|
2016-03-31 09:25:56 +02:00
|
|
|
$this->setupPaginationControl($downtimes);
|
2013-09-03 18:43:17 +02:00
|
|
|
$this->setupSortControl(array(
|
2015-01-21 10:33:05 +01:00
|
|
|
'downtime_is_in_effect' => $this->translate('Is In Effect'),
|
2015-01-21 13:06:32 +01:00
|
|
|
'host_display_name' => $this->translate('Host'),
|
|
|
|
'service_display_name' => $this->translate('Service'),
|
2015-01-21 10:33:05 +01:00
|
|
|
'downtime_entry_time' => $this->translate('Entry Time'),
|
|
|
|
'downtime_author' => $this->translate('Author'),
|
|
|
|
'downtime_start' => $this->translate('Start Time'),
|
|
|
|
'downtime_end' => $this->translate('End Time'),
|
|
|
|
'downtime_scheduled_start' => $this->translate('Scheduled Start'),
|
|
|
|
'downtime_scheduled_end' => $this->translate('Scheduled End'),
|
|
|
|
'downtime_duration' => $this->translate('Duration')
|
2016-03-31 09:25:56 +02:00
|
|
|
), $downtimes);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($downtimes);
|
|
|
|
$this->setupLimitControl();
|
2016-03-31 09:25:56 +02:00
|
|
|
|
|
|
|
$this->view->downtimes = $downtimes;
|
2014-11-06 13:22:38 +01:00
|
|
|
|
2015-01-23 09:16:30 +01:00
|
|
|
if ($this->Auth()->hasPermission('monitoring/command/downtime/delete')) {
|
|
|
|
$this->view->delDowntimeForm = new DeleteDowntimeCommandForm();
|
2015-05-07 16:20:59 +02:00
|
|
|
$this->view->delDowntimeForm->handleRequest();
|
2015-01-23 09:16:30 +01:00
|
|
|
}
|
2013-07-30 17:17:19 +02:00
|
|
|
}
|
|
|
|
|
2013-08-14 12:42:32 +02:00
|
|
|
/**
|
2016-03-31 09:52:11 +02:00
|
|
|
* List notifications
|
2013-08-14 12:42:32 +02:00
|
|
|
*/
|
2013-08-09 11:23:42 +02:00
|
|
|
public function notificationsAction()
|
|
|
|
{
|
2015-02-23 17:00:30 +01:00
|
|
|
$this->addTitleTab(
|
|
|
|
'notifications',
|
|
|
|
$this->translate('Notifications'),
|
|
|
|
$this->translate('List notifications')
|
|
|
|
);
|
2016-03-31 09:52:11 +02:00
|
|
|
|
2014-05-09 18:01:47 +02:00
|
|
|
$this->setAutorefreshInterval(15);
|
2015-04-17 16:13:36 +02:00
|
|
|
|
2016-03-31 09:52:11 +02:00
|
|
|
$notifications = $this->backend->select()->from('notification', array(
|
2016-09-14 16:18:08 +02:00
|
|
|
'host_display_name',
|
2015-04-13 15:24:15 +02:00
|
|
|
'host_name',
|
2015-04-13 15:26:06 +02:00
|
|
|
'notification_contact_name',
|
2016-09-14 16:18:08 +02:00
|
|
|
'notification_output',
|
2015-01-21 15:48:04 +01:00
|
|
|
'notification_state',
|
2016-09-14 16:18:08 +02:00
|
|
|
'notification_timestamp',
|
|
|
|
'service_description',
|
2015-01-21 15:48:04 +01:00
|
|
|
'service_display_name'
|
2014-06-20 19:12:10 +02:00
|
|
|
));
|
2016-03-31 09:52:11 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $notifications);
|
2015-04-17 16:13:36 +02:00
|
|
|
|
2016-03-31 09:52:11 +02:00
|
|
|
$this->setupPaginationControl($notifications);
|
2015-05-15 10:56:52 +02:00
|
|
|
$this->setupSortControl(array(
|
2016-09-15 14:07:19 +02:00
|
|
|
'notification_timestamp' => $this->translate('Notification Start')
|
2016-03-31 09:52:11 +02:00
|
|
|
), $notifications);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($notifications);
|
|
|
|
$this->setupLimitControl();
|
2016-03-31 09:52:11 +02:00
|
|
|
|
|
|
|
$this->view->notifications = $notifications;
|
2013-10-04 10:09:00 +02:00
|
|
|
}
|
|
|
|
|
2016-03-31 09:18:21 +02:00
|
|
|
/**
|
|
|
|
* List contacts
|
|
|
|
*/
|
2013-10-04 10:09:00 +02:00
|
|
|
public function contactsAction()
|
|
|
|
{
|
2016-03-31 09:18:21 +02:00
|
|
|
$this->addTitleTab(
|
|
|
|
'contacts',
|
|
|
|
$this->translate('Contacts'),
|
|
|
|
$this->translate('List contacts')
|
|
|
|
);
|
2015-04-17 16:13:56 +02:00
|
|
|
|
2016-03-31 09:18:21 +02:00
|
|
|
$contacts = $this->backend->select()->from('contact', array(
|
2014-06-06 09:37:37 +02:00
|
|
|
'contact_name',
|
2015-04-10 12:23:35 +02:00
|
|
|
'contact_alias',
|
|
|
|
'contact_email',
|
2014-06-06 09:37:37 +02:00
|
|
|
'contact_pager',
|
|
|
|
'contact_notify_service_timeperiod',
|
2015-06-15 13:48:13 +02:00
|
|
|
'contact_notify_host_timeperiod'
|
2014-06-06 09:37:37 +02:00
|
|
|
));
|
2016-03-31 09:18:21 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $contacts);
|
2015-05-15 10:56:52 +02:00
|
|
|
|
2016-03-31 09:18:21 +02:00
|
|
|
$this->setupPaginationControl($contacts);
|
2013-10-04 10:09:00 +02:00
|
|
|
$this->setupSortControl(array(
|
2016-03-31 09:18:21 +02:00
|
|
|
'contact_name' => $this->translate('Name'),
|
2015-04-10 12:23:35 +02:00
|
|
|
'contact_alias' => $this->translate('Alias'),
|
|
|
|
'contact_email' => $this->translate('Email'),
|
2016-03-31 09:18:35 +02:00
|
|
|
'contact_pager' => $this->translate('Pager Address / Number')
|
2016-03-31 09:18:21 +02:00
|
|
|
), $contacts);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($contacts);
|
|
|
|
$this->setupLimitControl();
|
2016-03-31 09:18:21 +02:00
|
|
|
|
|
|
|
$this->view->contacts = $contacts;
|
2013-10-04 10:09:00 +02:00
|
|
|
}
|
|
|
|
|
2014-11-13 18:38:42 +01:00
|
|
|
public function eventgridAction()
|
2014-02-21 11:44:03 +01:00
|
|
|
{
|
2015-02-23 17:00:30 +01:00
|
|
|
$this->addTitleTab('eventgrid', $this->translate('Event Grid'), $this->translate('Show the Event Grid'));
|
2014-09-16 15:58:24 +02:00
|
|
|
|
2014-09-17 18:21:32 +02:00
|
|
|
$form = new StatehistoryForm();
|
|
|
|
$form->setEnctype(Zend_Form::ENCTYPE_URLENCODED);
|
|
|
|
$form->setMethod('get');
|
|
|
|
$form->setTokenDisabled();
|
2014-09-30 11:34:04 +02:00
|
|
|
$form->setUidDisabled();
|
|
|
|
$form->render();
|
2014-09-17 18:21:32 +02:00
|
|
|
$this->view->form = $form;
|
|
|
|
|
2017-11-24 17:16:33 +01:00
|
|
|
$this->params
|
|
|
|
->remove('view')
|
|
|
|
->remove('format');
|
2014-11-13 18:40:13 +01:00
|
|
|
$orientation = $this->params->shift('vertical', 0) ? 'vertical' : 'horizontal';
|
2014-11-16 00:37:58 +01:00
|
|
|
/*
|
2014-09-16 15:58:24 +02:00
|
|
|
$orientationBox = new SelectBox(
|
|
|
|
'orientation',
|
|
|
|
array(
|
2014-10-21 17:22:16 +02:00
|
|
|
'0' => mt('monitoring', 'Vertical'),
|
|
|
|
'1' => mt('monitoring', 'Horizontal')
|
2014-09-16 15:58:24 +02:00
|
|
|
),
|
2014-10-21 17:22:16 +02:00
|
|
|
mt('monitoring', 'Orientation'),
|
2014-09-16 15:58:24 +02:00
|
|
|
'horizontal'
|
|
|
|
);
|
|
|
|
$orientationBox->applyRequest($this->getRequest());
|
2014-11-16 00:37:58 +01:00
|
|
|
*/
|
2019-05-22 21:28:47 +02:00
|
|
|
$objectType = $form->getValue('objecttype');
|
2019-05-22 21:28:24 +02:00
|
|
|
$from = $form->getValue('from');
|
2014-06-06 09:37:37 +02:00
|
|
|
$query = $this->backend->select()->from(
|
2018-01-04 16:09:35 +01:00
|
|
|
'eventgrid' . $objectType,
|
2014-09-17 18:21:32 +02:00
|
|
|
array('day', $form->getValue('state'))
|
2014-09-16 15:58:24 +02:00
|
|
|
);
|
2014-09-30 11:34:04 +02:00
|
|
|
$this->params->remove(array('objecttype', 'from', 'to', 'state', 'btn_submit'));
|
2014-11-19 12:07:40 +01:00
|
|
|
$this->view->filter = Filter::fromQuerystring((string) $this->params);
|
|
|
|
$query->applyFilter($this->view->filter);
|
2018-01-04 16:09:35 +01:00
|
|
|
$query->applyFilter(Filter::fromQuerystring('timestamp >= ' . $from));
|
2015-06-12 16:27:34 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $query);
|
2015-08-03 16:06:21 +02:00
|
|
|
$this->view->summary = $query;
|
2014-09-17 18:21:32 +02:00
|
|
|
$this->view->column = $form->getValue('state');
|
2014-11-16 00:37:58 +01:00
|
|
|
// $this->view->orientationBox = $orientationBox;
|
2014-09-16 15:58:24 +02:00
|
|
|
$this->view->orientation = $orientation;
|
2014-02-21 11:44:03 +01:00
|
|
|
}
|
|
|
|
|
2016-03-31 09:14:15 +02:00
|
|
|
/**
|
|
|
|
* List contact groups
|
|
|
|
*/
|
2013-10-04 10:09:00 +02:00
|
|
|
public function contactgroupsAction()
|
|
|
|
{
|
2015-02-23 17:00:30 +01:00
|
|
|
$this->addTitleTab(
|
|
|
|
'contactgroups',
|
|
|
|
$this->translate('Contact Groups'),
|
|
|
|
$this->translate('List contact groups')
|
|
|
|
);
|
2015-04-17 16:14:13 +02:00
|
|
|
|
2016-03-31 09:14:15 +02:00
|
|
|
$contactGroups = $this->backend->select()->from('contactgroup', array(
|
2014-06-06 09:37:37 +02:00
|
|
|
'contactgroup_name',
|
|
|
|
'contactgroup_alias',
|
2016-03-31 09:14:15 +02:00
|
|
|
'contact_count'
|
2015-04-17 16:14:13 +02:00
|
|
|
));
|
2016-03-31 09:14:15 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $contactGroups);
|
2014-06-06 09:37:37 +02:00
|
|
|
|
2016-03-31 09:14:15 +02:00
|
|
|
$this->setupPaginationControl($contactGroups);
|
2015-06-15 14:15:51 +02:00
|
|
|
$this->setupSortControl(array(
|
|
|
|
'contactgroup_name' => $this->translate('Contactgroup Name'),
|
|
|
|
'contactgroup_alias' => $this->translate('Contactgroup Alias')
|
2016-03-31 09:14:15 +02:00
|
|
|
), $contactGroups);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($contactGroups);
|
|
|
|
$this->setupLimitControl();
|
2015-06-15 15:08:25 +02:00
|
|
|
|
2016-03-31 09:14:15 +02:00
|
|
|
$this->view->contactGroups = $contactGroups;
|
2013-07-12 14:33:17 +02:00
|
|
|
}
|
|
|
|
|
2016-03-30 18:02:40 +02:00
|
|
|
/**
|
|
|
|
* List all comments
|
|
|
|
*/
|
2013-09-26 17:02:56 +02:00
|
|
|
public function commentsAction()
|
|
|
|
{
|
2016-03-30 18:02:40 +02:00
|
|
|
$this->addTitleTab(
|
|
|
|
'comments',
|
|
|
|
$this->translate('Comments'),
|
|
|
|
$this->translate('List comments')
|
|
|
|
);
|
|
|
|
|
2014-03-09 19:31:59 +01:00
|
|
|
$this->setAutorefreshInterval(12);
|
2015-04-17 16:14:29 +02:00
|
|
|
|
2016-03-30 18:02:40 +02:00
|
|
|
$comments = $this->backend->select()->from('comment', array(
|
2014-06-06 09:37:37 +02:00
|
|
|
'id' => 'comment_internal_id',
|
2015-05-29 15:38:03 +02:00
|
|
|
'objecttype' => 'object_type',
|
2014-06-06 09:37:37 +02:00
|
|
|
'comment' => 'comment_data',
|
2015-04-09 13:07:50 +02:00
|
|
|
'author' => 'comment_author_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'timestamp' => 'comment_timestamp',
|
|
|
|
'type' => 'comment_type',
|
|
|
|
'persistent' => 'comment_is_persistent',
|
|
|
|
'expiration' => 'comment_expiration',
|
2016-08-31 13:04:11 +02:00
|
|
|
'name' => 'comment_name',
|
2015-04-09 12:49:06 +02:00
|
|
|
'host_name',
|
|
|
|
'service_description',
|
2015-01-21 16:10:02 +01:00
|
|
|
'host_display_name',
|
|
|
|
'service_display_name'
|
2014-06-06 09:37:37 +02:00
|
|
|
));
|
2016-03-30 18:02:40 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $comments);
|
2015-05-15 10:56:52 +02:00
|
|
|
|
2016-03-30 18:02:40 +02:00
|
|
|
$this->setupPaginationControl($comments);
|
2013-09-26 17:02:56 +02:00
|
|
|
$this->setupSortControl(
|
|
|
|
array(
|
2015-01-21 16:15:38 +01:00
|
|
|
'comment_timestamp' => $this->translate('Comment Timestamp'),
|
|
|
|
'host_display_name' => $this->translate('Host'),
|
|
|
|
'service_display_name' => $this->translate('Service'),
|
|
|
|
'comment_type' => $this->translate('Comment Type'),
|
|
|
|
'comment_expiration' => $this->translate('Expiration')
|
2015-05-12 10:16:51 +02:00
|
|
|
),
|
2016-03-30 18:02:40 +02:00
|
|
|
$comments
|
2013-09-26 17:02:56 +02:00
|
|
|
);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($comments);
|
|
|
|
$this->setupLimitControl();
|
2015-01-23 09:18:29 +01:00
|
|
|
|
2016-03-30 18:02:40 +02:00
|
|
|
$this->view->comments = $comments;
|
|
|
|
|
2015-01-23 09:18:29 +01:00
|
|
|
if ($this->Auth()->hasPermission('monitoring/command/comment/delete')) {
|
2015-05-07 16:20:59 +02:00
|
|
|
$this->view->delCommentForm = new DeleteCommentCommandForm();
|
|
|
|
$this->view->delCommentForm->handleRequest();
|
2015-01-23 09:18:29 +01:00
|
|
|
}
|
2013-09-26 17:02:56 +02:00
|
|
|
}
|
|
|
|
|
2016-03-31 09:59:18 +02:00
|
|
|
/**
|
|
|
|
* List service groups
|
|
|
|
*/
|
2013-10-15 12:49:58 +02:00
|
|
|
public function servicegroupsAction()
|
|
|
|
{
|
2015-02-23 17:00:30 +01:00
|
|
|
$this->addTitleTab(
|
|
|
|
'servicegroups',
|
|
|
|
$this->translate('Service Groups'),
|
|
|
|
$this->translate('List service groups')
|
|
|
|
);
|
2016-03-31 09:59:18 +02:00
|
|
|
|
2014-06-06 09:37:37 +02:00
|
|
|
$this->setAutorefreshInterval(12);
|
2015-04-17 16:14:46 +02:00
|
|
|
|
2016-03-31 09:59:18 +02:00
|
|
|
$serviceGroups = $this->backend->select()->from('servicegroupsummary', array(
|
2015-05-21 12:41:59 +02:00
|
|
|
'servicegroup_alias',
|
|
|
|
'servicegroup_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'services_critical_handled',
|
|
|
|
'services_critical_unhandled',
|
2015-05-21 12:41:59 +02:00
|
|
|
'services_ok',
|
|
|
|
'services_pending',
|
|
|
|
'services_total',
|
|
|
|
'services_unknown_handled',
|
|
|
|
'services_unknown_unhandled',
|
|
|
|
'services_warning_handled',
|
|
|
|
'services_warning_unhandled'
|
|
|
|
));
|
2016-03-31 09:59:18 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $serviceGroups);
|
2015-05-15 10:56:52 +02:00
|
|
|
|
2016-03-31 09:59:18 +02:00
|
|
|
$this->setupPaginationControl($serviceGroups);
|
2013-10-15 14:55:01 +02:00
|
|
|
$this->setupSortControl(array(
|
2015-01-23 15:46:51 +01:00
|
|
|
'servicegroup_alias' => $this->translate('Service Group Name'),
|
2018-04-04 10:05:27 +02:00
|
|
|
'services_severity' => $this->translate('Severity'),
|
2015-05-21 12:42:53 +02:00
|
|
|
'services_total' => $this->translate('Total Services')
|
2016-03-31 09:59:18 +02:00
|
|
|
), $serviceGroups);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($serviceGroups);
|
|
|
|
$this->setupLimitControl();
|
2016-03-31 09:59:18 +02:00
|
|
|
|
|
|
|
$this->view->serviceGroups = $serviceGroups;
|
2013-10-15 12:49:58 +02:00
|
|
|
}
|
|
|
|
|
2018-05-14 15:23:01 +02:00
|
|
|
/**
|
|
|
|
* List service groups
|
|
|
|
*/
|
|
|
|
public function servicegroupGridAction()
|
|
|
|
{
|
|
|
|
$this->addTitleTab(
|
|
|
|
'servicegroup-grid',
|
|
|
|
$this->translate('Service Group Grid'),
|
|
|
|
$this->translate('Show the Service Group Grid')
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->setAutorefreshInterval(15);
|
|
|
|
|
|
|
|
$serviceGroups = $this->backend->select()->from('servicegroupsummary', array(
|
|
|
|
'servicegroup_alias',
|
|
|
|
'servicegroup_name',
|
|
|
|
'services_critical_handled',
|
|
|
|
'services_critical_unhandled',
|
|
|
|
'services_ok',
|
|
|
|
'services_pending',
|
|
|
|
'services_total',
|
|
|
|
'services_unknown_handled',
|
|
|
|
'services_unknown_unhandled',
|
|
|
|
'services_warning_handled',
|
|
|
|
'services_warning_unhandled'
|
|
|
|
));
|
|
|
|
$this->applyRestriction('monitoring/filter/objects', $serviceGroups);
|
|
|
|
$this->filterQuery($serviceGroups);
|
|
|
|
|
|
|
|
$this->setupSortControl(array(
|
|
|
|
'servicegroup_alias' => $this->translate('Service Group Name'),
|
|
|
|
'services_severity' => $this->translate('Severity'),
|
|
|
|
'services_total' => $this->translate('Total Services')
|
|
|
|
), $serviceGroups, ['services_severity' => 'desc']);
|
|
|
|
|
|
|
|
$this->view->serviceGroups = $serviceGroups;
|
|
|
|
}
|
|
|
|
|
2016-03-31 09:49:02 +02:00
|
|
|
/**
|
|
|
|
* List host groups
|
|
|
|
*/
|
2013-10-15 15:12:59 +02:00
|
|
|
public function hostgroupsAction()
|
|
|
|
{
|
2016-03-31 09:38:02 +02:00
|
|
|
$this->addTitleTab(
|
|
|
|
'hostgroups',
|
|
|
|
$this->translate('Host Groups'),
|
|
|
|
$this->translate('List host groups')
|
|
|
|
);
|
|
|
|
|
2014-06-06 09:37:37 +02:00
|
|
|
$this->setAutorefreshInterval(12);
|
2015-04-17 16:14:59 +02:00
|
|
|
|
2016-03-31 09:38:02 +02:00
|
|
|
$hostGroups = $this->backend->select()->from('hostgroupsummary', array(
|
2015-01-23 11:22:00 +01:00
|
|
|
'hostgroup_alias',
|
2015-05-20 16:06:45 +02:00
|
|
|
'hostgroup_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'hosts_down_handled',
|
|
|
|
'hosts_down_unhandled',
|
|
|
|
'hosts_pending',
|
2015-05-20 17:02:49 +02:00
|
|
|
'hosts_total',
|
2015-05-20 16:06:45 +02:00
|
|
|
'hosts_unreachable_handled',
|
|
|
|
'hosts_unreachable_unhandled',
|
|
|
|
'hosts_up',
|
|
|
|
'services_critical_handled',
|
|
|
|
'services_critical_unhandled',
|
2014-06-06 09:37:37 +02:00
|
|
|
'services_ok',
|
2015-05-20 16:06:45 +02:00
|
|
|
'services_pending',
|
|
|
|
'services_total',
|
2014-06-06 09:37:37 +02:00
|
|
|
'services_unknown_handled',
|
|
|
|
'services_unknown_unhandled',
|
|
|
|
'services_warning_handled',
|
2015-05-20 16:06:45 +02:00
|
|
|
'services_warning_unhandled'
|
2015-05-21 12:36:05 +02:00
|
|
|
));
|
2016-03-31 09:38:02 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $hostGroups);
|
2015-05-15 10:56:52 +02:00
|
|
|
|
2016-03-31 09:38:02 +02:00
|
|
|
$this->setupPaginationControl($hostGroups);
|
2013-10-15 15:12:59 +02:00
|
|
|
$this->setupSortControl(array(
|
2015-01-23 15:46:51 +01:00
|
|
|
'hostgroup_alias' => $this->translate('Host Group Name'),
|
2018-04-04 10:05:27 +02:00
|
|
|
'hosts_severity' => $this->translate('Severity'),
|
2015-05-21 12:38:20 +02:00
|
|
|
'hosts_total' => $this->translate('Total Hosts'),
|
|
|
|
'services_total' => $this->translate('Total Services')
|
2016-03-31 09:38:02 +02:00
|
|
|
), $hostGroups);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($hostGroups);
|
|
|
|
$this->setupLimitControl();
|
2016-03-31 09:38:02 +02:00
|
|
|
|
2016-03-31 09:44:48 +02:00
|
|
|
$this->view->hostGroups = $hostGroups;
|
2013-10-15 15:12:59 +02:00
|
|
|
}
|
|
|
|
|
2018-05-14 15:25:54 +02:00
|
|
|
/**
|
|
|
|
* List host groups
|
|
|
|
*/
|
|
|
|
public function hostgroupGridAction()
|
|
|
|
{
|
|
|
|
$this->addTitleTab(
|
|
|
|
'hostgroup-grid',
|
|
|
|
$this->translate('Host Group Grid'),
|
|
|
|
$this->translate('Show the Host Group Grid')
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->setAutorefreshInterval(15);
|
|
|
|
|
|
|
|
$hostGroups = $this->backend->select()->from('hostgroupsummary', [
|
|
|
|
'hostgroup_alias',
|
|
|
|
'hostgroup_name',
|
|
|
|
'hosts_down_handled',
|
|
|
|
'hosts_down_unhandled',
|
|
|
|
'hosts_pending',
|
|
|
|
'hosts_total',
|
|
|
|
'hosts_unreachable_handled',
|
|
|
|
'hosts_unreachable_unhandled',
|
|
|
|
'hosts_up'
|
|
|
|
]);
|
|
|
|
$this->applyRestriction('monitoring/filter/objects', $hostGroups);
|
|
|
|
$this->filterQuery($hostGroups);
|
|
|
|
|
|
|
|
$this->setupSortControl([
|
|
|
|
'hosts_severity' => $this->translate('Severity'),
|
|
|
|
'hostgroup_alias' => $this->translate('Host Group Name'),
|
|
|
|
'hosts_total' => $this->translate('Total Hosts'),
|
|
|
|
'services_total' => $this->translate('Total Services')
|
|
|
|
], $hostGroups, ['hosts_severity' => 'desc']);
|
|
|
|
|
|
|
|
$this->view->hostGroups = $hostGroups;
|
|
|
|
}
|
|
|
|
|
2013-10-14 12:56:06 +02:00
|
|
|
public function eventhistoryAction()
|
|
|
|
{
|
2015-02-23 17:00:30 +01:00
|
|
|
$this->addTitleTab(
|
|
|
|
'eventhistory',
|
|
|
|
$this->translate('Event Overview'),
|
|
|
|
$this->translate('List event records')
|
|
|
|
);
|
2014-09-26 14:59:06 +02:00
|
|
|
|
2015-06-12 14:42:49 +02:00
|
|
|
$query = $this->backend->select()->from('eventhistory', array(
|
2017-12-06 17:43:42 +01:00
|
|
|
'id',
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_name',
|
2015-01-21 09:55:17 +01:00
|
|
|
'host_display_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'service_description',
|
2015-01-21 09:55:17 +01:00
|
|
|
'service_display_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'object_type',
|
|
|
|
'timestamp',
|
|
|
|
'state',
|
|
|
|
'output',
|
2015-04-09 14:17:27 +02:00
|
|
|
'type'
|
2014-06-06 09:37:37 +02:00
|
|
|
));
|
2014-11-20 17:19:26 +01:00
|
|
|
|
2015-06-12 12:52:29 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $query);
|
2015-05-15 14:32:58 +02:00
|
|
|
$this->view->history = $query;
|
2014-12-01 13:45:25 +01:00
|
|
|
|
2015-05-15 10:56:52 +02:00
|
|
|
$this->setupSortControl(array(
|
|
|
|
'timestamp' => $this->translate('Occurence')
|
|
|
|
), $query);
|
2017-10-17 16:05:07 +02:00
|
|
|
$this->filterQuery($query);
|
|
|
|
$this->setupLimitControl();
|
2013-10-14 12:56:06 +02:00
|
|
|
}
|
|
|
|
|
2014-11-12 15:06:48 +01:00
|
|
|
public function servicegridAction()
|
2014-03-12 14:41:17 +01:00
|
|
|
{
|
2015-02-23 17:00:30 +01:00
|
|
|
$this->addTitleTab('servicegrid', $this->translate('Service Grid'), $this->translate('Show the Service Grid'));
|
2014-06-06 09:37:37 +02:00
|
|
|
$this->setAutorefreshInterval(15);
|
2015-06-12 14:42:49 +02:00
|
|
|
$query = $this->backend->select()->from('servicestatus', array(
|
2015-08-19 12:41:58 +02:00
|
|
|
'host_display_name',
|
2014-06-06 09:37:37 +02:00
|
|
|
'host_name',
|
|
|
|
'service_description',
|
2015-08-19 12:41:58 +02:00
|
|
|
'service_display_name',
|
|
|
|
'service_handled',
|
2014-06-06 09:37:37 +02:00
|
|
|
'service_output',
|
2015-08-19 12:41:58 +02:00
|
|
|
'service_state'
|
2014-06-06 09:37:37 +02:00
|
|
|
));
|
2015-06-05 15:06:34 +02:00
|
|
|
$this->applyRestriction('monitoring/filter/objects', $query);
|
2015-08-21 11:20:56 +02:00
|
|
|
$this->filterQuery($query);
|
2015-08-19 12:41:58 +02:00
|
|
|
$filter = (bool) $this->params->shift('problems', false) ? Filter::where('service_problem', 1) : null;
|
2018-05-07 14:14:34 +02:00
|
|
|
if ($this->params->get('flipped', false)) {
|
2018-05-02 13:44:13 +02:00
|
|
|
$pivot = $query
|
|
|
|
->pivot(
|
|
|
|
'host_name',
|
|
|
|
'service_description',
|
|
|
|
$filter,
|
|
|
|
$filter ? clone $filter : null
|
|
|
|
)
|
|
|
|
->setYAxisHeader('service_display_name')
|
|
|
|
->setXAxisHeader('host_display_name');
|
|
|
|
} else {
|
|
|
|
$pivot = $query
|
|
|
|
->pivot(
|
|
|
|
'service_description',
|
|
|
|
'host_name',
|
|
|
|
$filter,
|
|
|
|
$filter ? clone $filter : null
|
|
|
|
)
|
|
|
|
->setXAxisHeader('service_display_name')
|
|
|
|
->setYAxisHeader('host_display_name');
|
|
|
|
}
|
2014-06-06 09:37:37 +02:00
|
|
|
$this->setupSortControl(array(
|
2015-08-25 15:51:20 +02:00
|
|
|
'host_display_name' => $this->translate('Hostname'),
|
|
|
|
'service_display_name' => $this->translate('Service Name')
|
2015-08-18 14:23:12 +02:00
|
|
|
), $pivot);
|
2014-06-06 09:37:37 +02:00
|
|
|
$this->view->horizontalPaginator = $pivot->paginateXAxis();
|
2015-08-19 12:41:58 +02:00
|
|
|
$this->view->verticalPaginator = $pivot->paginateYAxis();
|
2015-08-25 14:54:15 +02:00
|
|
|
list($pivotData, $pivotHeader) = $pivot->toArray();
|
|
|
|
$this->view->pivotData = $pivotData;
|
|
|
|
$this->view->pivotHeader = $pivotHeader;
|
2018-05-07 14:14:34 +02:00
|
|
|
if ($this->params->get('flipped', false)) {
|
2018-05-03 09:34:36 +02:00
|
|
|
$this->render('servicegrid-flipped');
|
|
|
|
}
|
2014-06-06 09:37:37 +02:00
|
|
|
}
|
2014-03-12 14:41:17 +01:00
|
|
|
|
2015-05-19 13:29:21 +02:00
|
|
|
/**
|
2015-05-19 15:43:47 +02:00
|
|
|
* Apply filters on a DataView
|
2015-05-19 13:29:21 +02:00
|
|
|
*
|
2015-05-19 15:43:47 +02:00
|
|
|
* @param DataView $dataView The DataView to apply filters on
|
2015-05-19 13:29:21 +02:00
|
|
|
*
|
2015-05-19 15:43:47 +02:00
|
|
|
* @return DataView $dataView
|
2015-05-19 13:29:21 +02:00
|
|
|
*/
|
2015-05-19 18:00:47 +02:00
|
|
|
protected function filterQuery(DataView $dataView)
|
2014-11-15 23:53:06 +01:00
|
|
|
{
|
2015-11-10 11:51:26 +01:00
|
|
|
$this->setupFilterControl($dataView, null, null, array(
|
|
|
|
'format', // handleFormatRequest()
|
|
|
|
'stateType', // hostsAction() and servicesAction()
|
|
|
|
'addColumns', // addColumns()
|
2018-05-02 13:44:13 +02:00
|
|
|
'problems', // servicegridAction()
|
|
|
|
'flipped' // servicegridAction()
|
2015-11-10 11:51:26 +01:00
|
|
|
));
|
2015-05-19 15:43:47 +02:00
|
|
|
$this->handleFormatRequest($dataView);
|
|
|
|
return $dataView;
|
2014-03-12 14:41:17 +01:00
|
|
|
}
|
|
|
|
|
2015-05-19 10:11:54 +02:00
|
|
|
/**
|
|
|
|
* Get columns to be added from URL parameter 'addColumns'
|
|
|
|
* and assign to $this->view->addColumns (as array)
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2015-05-18 16:29:33 +02:00
|
|
|
protected function addColumns()
|
2014-03-21 11:24:17 +01:00
|
|
|
{
|
2014-06-06 09:37:37 +02:00
|
|
|
$columns = preg_split(
|
|
|
|
'~,~',
|
2015-03-13 09:07:02 +01:00
|
|
|
$this->params->shift('addColumns', ''),
|
2014-06-06 09:37:37 +02:00
|
|
|
-1,
|
|
|
|
PREG_SPLIT_NO_EMPTY
|
|
|
|
);
|
2015-05-18 16:29:33 +02:00
|
|
|
$this->view->addColumns = $columns;
|
2014-06-06 09:37:37 +02:00
|
|
|
return $columns;
|
2014-03-21 11:24:17 +01:00
|
|
|
}
|
|
|
|
|
2015-02-23 17:00:30 +01:00
|
|
|
protected function addTitleTab($action, $title, $tip)
|
2014-02-21 11:41:05 +01:00
|
|
|
{
|
|
|
|
$this->getTabs()->add($action, array(
|
2015-02-23 17:00:30 +01:00
|
|
|
'title' => $tip,
|
|
|
|
'label' => $title,
|
|
|
|
'url' => Url::fromRequest()
|
2014-02-21 11:41:05 +01:00
|
|
|
))->activate($action);
|
2014-06-06 09:37:37 +02:00
|
|
|
$this->view->title = $title;
|
2014-02-21 11:41:05 +01:00
|
|
|
}
|
|
|
|
|
2013-09-03 18:43:17 +02:00
|
|
|
/**
|
|
|
|
* Return all tabs for this controller
|
|
|
|
*
|
|
|
|
* @return Tabs
|
|
|
|
*/
|
|
|
|
private function createTabs()
|
|
|
|
{
|
2015-09-30 14:47:42 +02:00
|
|
|
$this->getTabs()->extend(new OutputFormat())->extend(new DashboardAction())->extend(new MenuAction());
|
2013-07-30 17:17:19 +02:00
|
|
|
}
|
2013-06-27 10:14:41 +02:00
|
|
|
}
|