/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $hostids = array(); $dbHostGroups = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . zbx_dbstr($this->screenitem['resourceid'])); while ($dbHostGroup = DBfetch($dbHostGroups)) { $hostids[$dbHostGroup['hostid']] = $dbHostGroup['hostid']; } return $this->getOutput(getItemsDataOverview($hostids, $this->screenitem['application'], $this->screenitem['style'])); }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $hostids = array(); $dbHostGroups = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . zbx_dbstr($this->screenitem['resourceid'])); while ($dbHostGroup = DBfetch($dbHostGroups)) { $hostids[$dbHostGroup['hostid']] = $dbHostGroup['hostid']; } // application filter $applicationIds = null; if ($this->screenitem['application'] !== '') { $applications = API::Application()->get(array('output' => array('applicationid'), 'hostids' => $hostids, 'search' => array('name' => $this->screenitem['application']))); $applicationIds = zbx_objectValues($applications, 'applicationid'); } return $this->getOutput(getItemsDataOverview($hostids, $applicationIds, $this->screenitem['style'])); }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $hostids = []; $dbHostGroups = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . zbx_dbstr($this->screenitem['resourceid'])); while ($dbHostGroup = DBfetch($dbHostGroups)) { $hostids[$dbHostGroup['hostid']] = $dbHostGroup['hostid']; } // application filter $applicationIds = null; if ($this->screenitem['application'] !== '') { $applications = API::Application()->get(['output' => ['applicationid'], 'hostids' => $hostids, 'search' => ['name' => $this->screenitem['application']]]); $applicationIds = zbx_objectValues($applications, 'applicationid'); } $groups = API::HostGroup()->get(['output' => ['name'], 'groupids' => [$this->screenitem['resourceid']]]); $header = (new CDiv([new CTag('h4', true, _('Data overview')), (new CList())->addItem([_('Group'), ':', SPACE, $groups[0]['name']])]))->addClass(ZBX_STYLE_DASHBRD_WIDGET_HEAD); $table = getItemsDataOverview($hostids, $applicationIds, $this->screenitem['style']); $footer = (new CList())->addItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS)))->addClass(ZBX_STYLE_DASHBRD_WIDGET_FOOT); return $this->getOutput(new CUiWidget(uniqid(), [$header, $table, $footer])); }
$col = new CCol(new CDiv(new CDiv($col), 'overview-mon-severities-container')); $hintTable->addRow(array($col, _s('Age less than %s', convertUnitsS($config['blink_period'])))); } $hintTable->addRow(array(new CCol(SPACE), _('No trigger'))); } else { $hintTable->addRow(array(new CCol(SPACE), _('OK or no trigger'))); } $help = new CHelp('web.view.php', 'right'); $help->setHint($hintTable, '', '', true, false); // header right $overviewWidget->addPageHeader(_('OVERVIEW'), array(get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])), SPACE, $help)); // header left $styleComboBox = new CComboBox('view_style', $this->data['view_style'], 'submit()'); $styleComboBox->addItem(STYLE_TOP, _('Top')); $styleComboBox->addItem(STYLE_LEFT, _('Left')); $hostLocationForm = new CForm('get'); $hostLocationForm->addVar('groupid', $this->data['groupid']); $hostLocationForm->additem(array(_('Hosts location'), SPACE, $styleComboBox)); $overviewWidget->addHeader($hostLocationForm); if ($config['dropdown_first_entry'] || $this->data['pageFilter']->applicationsSelected || $this->data['pageFilter']->groupsSelected) { if ($this->data['type'] == SHOW_DATA) { $dataTable = getItemsDataOverview(array_keys($this->data['pageFilter']->hosts), $this->data['pageFilter']->application, $this->data['view_style']); } elseif ($this->data['type'] == SHOW_TRIGGERS) { global $page; $dataTable = getTriggersOverview(array_keys($this->data['pageFilter']->hosts), $this->data['pageFilter']->application, $page['file'], $this->data['view_style']); } } else { $dataTable = new CTableInfo(_('No items found.')); } $overviewWidget->addItem($dataTable); return $overviewWidget;