} $screen = $screen->get(); $pre = new CPre(); foreach ($screen as $text) { $pre->addItem([$text, BR()]); } $historyWidget->addItem($pre); } else { $historyWidget->setTitle($header['left'])->setControls($header['right']); if (isset($this->data['iv_string'][$this->data['value_type']])) { $filterForm->addNavigator(); } if (in_array($this->data['action'], [HISTORY_VALUES, HISTORY_GRAPH, HISTORY_BATCH_GRAPH])) { if (!isset($filterForm)) { $filterForm = new CFilter('web.history.filter.state'); } // display the graph type filter for graphs with multiple items if ($this->data['action'] == HISTORY_BATCH_GRAPH) { $filterForm->addColumn((new CFormList())->addRow(_('Graph type'), (new CRadioButtonList('graphtype', (int) $this->data['graphtype']))->addValue(_('Normal'), GRAPH_TYPE_NORMAL)->addValue(_('Stacked'), GRAPH_TYPE_STACKED)->setModern(true))); $filterForm->removeButtons(); $filterForm->addVar('fullscreen', $this->data['fullscreen']); $filterForm->addVar('action', $this->data['action']); $filterForm->addVar('itemids', $this->data['itemids']); } $filterForm->addNavigator(); $historyWidget->addItem($filterForm); } $historyWidget->addItem($screen->get()); CScreenBuilder::insertScreenStandardJs(['timeline' => $screen->timeline, 'profileIdx' => $screen->profileIdx]); } return $historyWidget;
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $hostInventoryWidget = (new CWidget())->setTitle(_('Host inventory')); $hostInventoryWidget->setControls($rForm = (new CForm('get'))->addItem((new CList())->addItem([_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB()]))); // filter $filterForm = new CFilter('web.hostinventories.filter.state'); $filterColumn = new CFormList(); // getting inventory fields to make a drop down $inventoryFields = getHostInventories(true); // 'true' means list should be ordered by title $inventoryFieldsComboBox = new CComboBox('filter_field', $this->data['filterField']); foreach ($inventoryFields as $inventoryField) { $inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title']); } $filterColumn->addRow(_('Field'), [$inventoryFieldsComboBox, (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), new CComboBox('filter_exact', $this->data['filterExact'], null, [0 => _('like'), 1 => _('exactly')]), (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), (new CTextBox('filter_field_value', $this->data['filterFieldValue']))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH)]); $filterForm->addColumn($filterColumn); $hostInventoryWidget->addItem($filterForm); $table = (new CTableInfo())->setHeader([make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder'])]); foreach ($this->data['hosts'] as $host) { $hostGroups = []; foreach ($host['groups'] as $group) { $hostGroups[] = $group['name']; } natsort($hostGroups); $hostGroups = implode(', ', $hostGroups); $row = [(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid')))->addClass($host['status'] == HOST_STATUS_NOT_MONITORED ? ZBX_STYLE_RED : null), $hostGroups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a'])]; $table->addRow($row); } $table = [$table, $this->data['paging']]; $hostInventoryWidget->addItem($table); return $hostInventoryWidget;
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $auditWidget = (new CWidget())->setTitle(_('Audit log')); // header // create filter $filterForm = new CFilter('web.auditlogs.filter.state'); $filterColumn = new CFormList(); $filterColumn->addRow(_('User'), [(new CTextBox('alias', $this->data['alias']))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH), (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), (new CButton('btn1', _('Select')))->addClass(ZBX_STYLE_BTN_GREY)->onClick('return PopUp("popup.php?dstfrm=zbx_filter&dstfld1=alias&srctbl=users&srcfld1=alias");')]); $filterColumn->addRow(_('Action'), new CComboBox('action', $this->data['action'], null, [-1 => _('All'), AUDIT_ACTION_LOGIN => _('Login'), AUDIT_ACTION_LOGOUT => _('Logout'), AUDIT_ACTION_ADD => _('Add'), AUDIT_ACTION_UPDATE => _('Update'), AUDIT_ACTION_DELETE => _('Delete'), AUDIT_ACTION_ENABLE => _('Enable'), AUDIT_ACTION_DISABLE => _('Disable')])); $filterColumn->addRow(_('Resource'), new CComboBox('resourcetype', $this->data['resourcetype'], null, [-1 => _('All')] + audit_resource2str())); $filterForm->addColumn($filterColumn)->addNavigator(); $auditWidget->addItem($filterForm); // create form $auditForm = (new CForm('get'))->setName('auditForm'); // create table $auditTable = (new CTableInfo())->setHeader([_('Time'), _('User'), _('IP'), _('Resource'), _('Action'), _('ID'), _('Description'), _('Details')]); foreach ($this->data['actions'] as $action) { $details = []; if (is_array($action['details'])) { foreach ($action['details'] as $detail) { $details[] = [$detail['table_name'] . '.' . $detail['field_name'] . NAME_DELIMITER . $detail['oldvalue'] . ' => ' . $detail['newvalue'], BR()]; } } else { $details = $action['details']; } $auditTable->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $action['clock']), $action['alias'], $action['ip'], $action['resourcetype'], $action['action'], $action['resourceid'], $action['resourcename'], $details]);