<?php declare(strict_types = 0);
namespace Widgets\HostAvail\Actions;
CControllerDashboardWidgetView,
class WidgetView extends CControllerDashboardWidgetView {
private const INTERFACE_STATUSES = [
INTERFACE_AVAILABLE_UNKNOWN,
INTERFACE_AVAILABLE_TRUE,
INTERFACE_AVAILABLE_FALSE,
INTERFACE_AVAILABLE_MIXED
protected function doAction(): void {
$interface_types = array_merge([INTERFACE_TYPE_AGENT_ACTIVE], CItemGeneral::INTERFACE_TYPES_BY_PRIORITY);
$this->fields_values['interface_type'] = array_values(
array_intersect($interface_types, $this->fields_values['interface_type'])
$interface_types = $this->fields_values['interface_type'] ?: $interface_types;
$interface_totals = array_fill_keys($interface_types, 0);
$interface_type_count = array_fill_keys($interface_types, array_fill_keys(self::INTERFACE_STATUSES, 0));
$total_hosts = array_fill_keys(self::INTERFACE_STATUSES, 0);
if (!$this->isTemplateDashboard() || ($this->isTemplateDashboard() && $this->fields_values['override_hostid'])) {
'output' => in_array(INTERFACE_TYPE_AGENT_ACTIVE, $interface_types) ? ['active_available'] : [],
'selectInterfaces' => ['type', 'available'],
'monitored_hosts' => true,
if (!$this->isTemplateDashboard() && $this->fields_values['groupids']) {
$options['groupids'] = getSubGroups($this->fields_values['groupids']);
if ($this->isTemplateDashboard()) {
$options['hostids'] = $this->fields_values['override_hostid'];
if ($this->fields_values['maintenance'] == HOST_MAINTENANCE_STATUS_OFF) {