// SPACE added to extend CB width in Chrome $cbMain = new CCheckBox('maintenance', $maintenance, null, '1'); if (!$filterEnable) { $cbMain->setAttribute('disabled', 'disabled'); } $dashForm->addRow(S_HOSTS, array($cbMain, S_SHOW_HOSTS_IN_MAINTENANCE)); // Trigger $severity = zbx_toHash($severity); $trgSeverities = array(); $severities = array(TRIGGER_SEVERITY_NOT_CLASSIFIED, TRIGGER_SEVERITY_INFORMATION, TRIGGER_SEVERITY_WARNING, TRIGGER_SEVERITY_AVERAGE, TRIGGER_SEVERITY_HIGH, TRIGGER_SEVERITY_DISASTER); foreach ($severities as $snum => $sever) { $cb = new CCheckBox('trgSeverity[' . $sever . ']', isset($severity[$sever]), '', 1); $cb->setEnabled($filterEnable); $trgSeverities[] = array($cb, getSeverityCaption($sever)); $trgSeverities[] = BR(); } array_pop($trgSeverities); $dashForm->addRow(S_TRIGGERS_WITH_SEVERITY, $trgSeverities); $config = select_config(); $cb = new CComboBox('extAck', $extAck); $cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY)); $cb->setEnabled($filterEnable && $config['event_ack_enable']); if (!$config['event_ack_enable']) { $cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED); } $dashForm->addRow(S_PROBLEM_DISPLAY, $cb); //----- $dashForm->addItemToBottomRow(new CButton('save', S_SAVE)); $dashboard_wdgt->addItem($dashForm); $dashboard_wdgt->show(); include_once 'include/page_footer.php';
} $userTab->addTab('userTab', _('User'), $userFormList); if (isset($userMediaFormList)) { $userTab->addTab('mediaTab', _('Media'), $userMediaFormList); } if (!$this->data['is_profile']) { /* * Permissions tab */ $permissionsFormList = new CFormList('permissionsFormList'); $userTypeComboBox = new CComboBox('user_type', $this->data['user_type'], 'submit();'); $userTypeComboBox->addItem(USER_TYPE_ZABBIX_USER, user_type2str(USER_TYPE_ZABBIX_USER)); $userTypeComboBox->addItem(USER_TYPE_ZABBIX_ADMIN, user_type2str(USER_TYPE_ZABBIX_ADMIN)); $userTypeComboBox->addItem(USER_TYPE_SUPER_ADMIN, user_type2str(USER_TYPE_SUPER_ADMIN)); if (isset($this->data['userid']) && bccomp(CWebUser::$data['userid'], $this->data['userid']) == 0) { $userTypeComboBox->setEnabled('disabled'); $permissionsFormList->addRow(_('User type'), array($userTypeComboBox, SPACE, new CSpan(_('User can\'t change type for himself')))); $userForm->addVar('user_type', $this->data['user_type']); } else { $permissionsFormList->addRow(_('User type'), $userTypeComboBox); } $permissionsFormList = getPermissionsFormList($this->data['user_rights'], $this->data['user_type'], $permissionsFormList); $permissionsFormList->addInfo(_('Permissions can be assigned for user groups only.')); $userTab->addTab('permissionsTab', _('Permissions'), $permissionsFormList); } if (isset($userMessagingFormList)) { $userTab->addTab('messagingTab', _('Messaging'), $userMessagingFormList); } // append tab to form $userForm->addItem($userTab); // append buttons to form
function getItemFilterForm(&$items) { $filter_groupId = $_REQUEST['filter_groupid']; $filter_hostId = $_REQUEST['filter_hostid']; $filter_application = $_REQUEST['filter_application']; $filter_name = $_REQUEST['filter_name']; $filter_type = $_REQUEST['filter_type']; $filter_key = $_REQUEST['filter_key']; $filter_snmp_community = $_REQUEST['filter_snmp_community']; $filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname']; $filter_snmp_oid = $_REQUEST['filter_snmp_oid']; $filter_port = $_REQUEST['filter_port']; $filter_value_type = $_REQUEST['filter_value_type']; $filter_data_type = $_REQUEST['filter_data_type']; $filter_delay = $_REQUEST['filter_delay']; $filter_history = $_REQUEST['filter_history']; $filter_trends = $_REQUEST['filter_trends']; $filter_status = $_REQUEST['filter_status']; $filter_state = $_REQUEST['filter_state']; $filter_templated_items = $_REQUEST['filter_templated_items']; $filter_with_triggers = $_REQUEST['filter_with_triggers']; $subfilter_hosts = $_REQUEST['subfilter_hosts']; $subfilter_apps = $_REQUEST['subfilter_apps']; $subfilter_types = $_REQUEST['subfilter_types']; $subfilter_value_types = $_REQUEST['subfilter_value_types']; $subfilter_status = $_REQUEST['subfilter_status']; $subfilter_state = $_REQUEST['subfilter_state']; $subfilter_templated_items = $_REQUEST['subfilter_templated_items']; $subfilter_with_triggers = $_REQUEST['subfilter_with_triggers']; $subfilter_history = $_REQUEST['subfilter_history']; $subfilter_trends = $_REQUEST['subfilter_trends']; $subfilter_interval = $_REQUEST['subfilter_interval']; $form = new CForm('get'); $form->setAttribute('name', 'zbx_filter'); $form->setAttribute('id', 'zbx_filter'); $form->addVar('subfilter_hosts', $subfilter_hosts); $form->addVar('subfilter_apps', $subfilter_apps); $form->addVar('subfilter_types', $subfilter_types); $form->addVar('subfilter_value_types', $subfilter_value_types); $form->addVar('subfilter_status', $subfilter_status); $form->addVar('subfilter_state', $subfilter_state); $form->addVar('subfilter_templated_items', $subfilter_templated_items); $form->addVar('subfilter_with_triggers', $subfilter_with_triggers); $form->addVar('subfilter_history', $subfilter_history); $form->addVar('subfilter_trends', $subfilter_trends); $form->addVar('subfilter_interval', $subfilter_interval); // type select $fTypeVisibility = array(); $cmbType = new CComboBox('filter_type', $filter_type); $cmbType->setAttribute('id', 'filter_type'); $cmbType->addItem(-1, _('all')); foreach (array('filter_delay_label', 'filter_delay') as $vItem) { zbx_subarray_push($fTypeVisibility, -1, $vItem); } $itemTypes = item_type2str(); unset($itemTypes[ITEM_TYPE_HTTPTEST]); // httptest items are only for internal zabbix logic $cmbType->addItems($itemTypes); foreach ($itemTypes as $typeNum => $typeLabel) { if ($typeNum != ITEM_TYPE_TRAPPER) { zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label'); zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay'); } switch ($typeNum) { case ITEM_TYPE_SNMPV1: case ITEM_TYPE_SNMPV2C: $snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port'); foreach ($snmp_types as $vItem) { zbx_subarray_push($fTypeVisibility, $typeNum, $vItem); } break; case ITEM_TYPE_SNMPV3: foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port') as $vItem) { zbx_subarray_push($fTypeVisibility, $typeNum, $vItem); } break; } } zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ');'); // type of information select $fVTypeVisibility = array(); $cmbValType = new CComboBox('filter_value_type', $filter_value_type); $cmbValType->addItem(-1, _('all')); $cmbValType->addItem(ITEM_VALUE_TYPE_UINT64, _('Numeric (unsigned)')); $cmbValType->addItem(ITEM_VALUE_TYPE_FLOAT, _('Numeric (float)')); $cmbValType->addItem(ITEM_VALUE_TYPE_STR, _('Character')); $cmbValType->addItem(ITEM_VALUE_TYPE_LOG, _('Log')); $cmbValType->addItem(ITEM_VALUE_TYPE_TEXT, _('Text')); foreach (array('filter_data_type_label', 'filter_data_type') as $vItem) { zbx_subarray_push($fVTypeVisibility, ITEM_VALUE_TYPE_UINT64, $vItem); } zbx_add_post_js("var filterValueTypeSwitcher = new CViewSwitcher('filter_value_type', 'change', " . zbx_jsvalue($fVTypeVisibility, true) . ');'); // status select $cmbStatus = new CComboBox('filter_status', $filter_status); $cmbStatus->addItem(-1, _('all')); foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED) as $status) { $cmbStatus->addItem($status, item_status2str($status)); } // state select $cmbState = new CComboBox('filter_state', $filter_state); $cmbState->addItem(-1, _('all')); foreach (array(ITEM_STATE_NORMAL, ITEM_STATE_NOTSUPPORTED) as $state) { $cmbState->addItem($state, itemState($state)); } // update interval $updateIntervalLabel = new CSpan(array(bold(_('Update interval')), SPACE . _('(in sec)') . NAME_DELIMITER)); $updateIntervalLabel->setAttribute('id', 'filter_delay_label'); $updateIntervalInput = new CNumericBox('filter_delay', $filter_delay, 5, false, true); $updateIntervalInput->setEnabled('no'); // data type $dataTypeLabel = new CSpan(bold(_('Data type') . NAME_DELIMITER)); $dataTypeLabel->setAttribute('id', 'filter_data_type_label'); $dataTypeInput = new CComboBox('filter_data_type', $filter_data_type); $dataTypeInput->addItem(-1, _('all')); $dataTypeInput->addItems(item_data_type2str()); $dataTypeInput->setEnabled('no'); // filter table $table = new CTable('', 'filter'); $table->setCellPadding(0); $table->setCellSpacing(0); // SNMP community $snmpCommunityLabel = new CSpan(array(bold(_('SNMP community')), SPACE . _('like') . NAME_DELIMITER)); $snmpCommunityLabel->setAttribute('id', 'filter_snmp_community_label'); $snmpCommunityField = new CTextBox('filter_snmp_community', $filter_snmp_community, ZBX_TEXTBOX_FILTER_SIZE); $snmpCommunityField->setEnabled('no'); // SNMPv3 security name $snmpSecurityLabel = new CSpan(array(bold(_('Security name')), SPACE . _('like') . NAME_DELIMITER)); $snmpSecurityLabel->setAttribute('id', 'filter_snmpv3_securityname_label'); $snmpSecurityField = new CTextBox('filter_snmpv3_securityname', $filter_snmpv3_securityname, ZBX_TEXTBOX_FILTER_SIZE); $snmpSecurityField->setEnabled('no'); // SNMP OID $snmpOidLabel = new CSpan(array(bold(_('SNMP OID')), SPACE . _('like') . NAME_DELIMITER)); $snmpOidLabel->setAttribute('id', 'filter_snmp_oid_label'); $snmpOidField = new CTextBox('filter_snmp_oid', $filter_snmp_oid, ZBX_TEXTBOX_FILTER_SIZE); $snmpOidField->setEnabled('no'); // port $portLabel = new CSpan(array(bold(_('Port')), SPACE . _('like') . NAME_DELIMITER)); $portLabel->setAttribute('id', 'filter_port_label'); $portField = new CNumericBox('filter_port', $filter_port, 5, false, true); $portField->setEnabled('no'); // row 1 $groupFilter = null; if (!empty($filter_groupId)) { $getHostInfo = API::HostGroup()->get(array('groupids' => $filter_groupId, 'output' => array('name'))); $getHostInfo = reset($getHostInfo); if (!empty($getHostInfo)) { $groupFilter[] = array('id' => $getHostInfo['groupid'], 'name' => $getHostInfo['name']); } } $table->addRow(array(new CCol(bold(_('Host group') . NAME_DELIMITER), 'label col1'), new CCol(array(new CMultiSelect(array('name' => 'filter_groupid', 'selectedLimit' => 1, 'objectName' => 'hostGroup', 'objectOptions' => array('editable' => true), 'data' => $groupFilter, 'popup' => array('parameters' => 'srctbl=host_groups&dstfrm=' . $form->getName() . '&dstfld1=filter_groupid' . '&srcfld1=groupid&writeonly=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button')))), 'col1'), new CCol(bold(_('Type') . NAME_DELIMITER), 'label col2'), new CCol($cmbType, 'col2'), new CCol(bold(_('Type of information') . NAME_DELIMITER), 'label col3'), new CCol($cmbValType, 'col3'), new CCol(bold(_('State') . NAME_DELIMITER), 'label'), new CCol($cmbState, 'col4')), 'item-list-row'); // row 2 $hostFilterData = null; if (!empty($filter_hostId)) { $getHostInfo = API::Host()->get(array('hostids' => $filter_hostId, 'templated_hosts' => true, 'output' => array('name'))); $getHostInfo = reset($getHostInfo); if (!empty($getHostInfo)) { $hostFilterData[] = array('id' => $getHostInfo['hostid'], 'name' => $getHostInfo['name']); } } $table->addRow(array(new CCol(bold(_('Host') . NAME_DELIMITER), 'label'), new CCol(array(new CMultiSelect(array('name' => 'filter_hostid', 'selectedLimit' => 1, 'objectName' => 'hosts', 'objectOptions' => array('editable' => true, 'templated_hosts' => true), 'data' => $hostFilterData, 'popup' => array('parameters' => 'srctbl=host_templates&dstfrm=' . $form->getName() . '&dstfld1=filter_hostid' . '&srcfld1=hostid&writeonly=1', 'width' => 450, 'height' => 450, 'buttonClass' => 'input filter-multiselect-select-button')))), 'col1'), new CCol($updateIntervalLabel, 'label'), new CCol($updateIntervalInput), new CCol($dataTypeLabel, 'label'), new CCol($dataTypeInput), new CCol(bold(_('Status') . NAME_DELIMITER), 'label col4'), new CCol($cmbStatus, 'col4')), 'item-list-row'); // row 3 $table->addRow(array(new CCol(bold(_('Application') . NAME_DELIMITER), 'label'), new CCol(array(new CTextBox('filter_application', $filter_application, ZBX_TEXTBOX_FILTER_SIZE), new CButton('btn_app', _('Select'), 'return PopUp("popup.php?srctbl=applications&srcfld1=name' . '&dstfrm=' . $form->getName() . '&dstfld1=filter_application' . '&with_applications=1' . '" + (jQuery("input[name=\'filter_hostid\']").length > 0 ? "&hostid="+jQuery("input[name=\'filter_hostid\']").val() : "")' . ', 550, 450, "application");', 'filter-select-button')), 'col1'), new CCol(array($snmpCommunityLabel, $snmpSecurityLabel), 'label'), new CCol(array($snmpCommunityField, $snmpSecurityField)), new CCol(array(bold(_('History')), SPACE . _('(in days)') . NAME_DELIMITER), 'label'), new CCol(new CNumericBox('filter_history', $filter_history, 8, false, true)), new CCol(bold(_('Triggers') . NAME_DELIMITER), 'label'), new CCol(new CComboBox('filter_with_triggers', $filter_with_triggers, null, array(-1 => _('all'), 1 => _('With triggers'), 0 => _('Without triggers'))))), 'item-list-row'); // row 4 $table->addRow(array(new CCol(array(bold(_('Name')), SPACE . _('like') . NAME_DELIMITER), 'label'), new CCol(new CTextBox('filter_name', $filter_name, ZBX_TEXTBOX_FILTER_SIZE), 'col1'), new CCol($snmpOidLabel, 'label'), new CCol($snmpOidField), new CCol(array(bold(_('Trends')), SPACE . _('(in days)') . NAME_DELIMITER), 'label'), new CCol(new CNumericBox('filter_trends', $filter_trends, 8, false, true)), new CCol(bold(_('Template') . NAME_DELIMITER), 'label'), new CCol(new CComboBox('filter_templated_items', $filter_templated_items, null, array(-1 => _('all'), 1 => _('Templated items'), 0 => _('Not Templated items'))))), 'item-list-row'); // row 5 $table->addRow(array(new CCol(array(bold(_('Key')), SPACE . _('like') . NAME_DELIMITER), 'label'), new CCol(new CTextBox('filter_key', $filter_key, ZBX_TEXTBOX_FILTER_SIZE), 'col1'), new CCol($portLabel, 'label'), new CCol($portField), new CCol(null, 'label'), new CCol(), new CCol(null, 'label'), new CCol()), 'item-list-row'); $filter = new CSubmit('filter_set', _('Filter'), 'chkbxRange.clearSelectedOnFilterChange();'); $filter->useJQueryStyle('main'); $reset = new CSubmit('filter_rst', _('Reset'), 'chkbxRange.clearSelectedOnFilterChange();'); $reset->useJQueryStyle(); $div_buttons = new CDiv(array($filter, SPACE, $reset)); $div_buttons->setAttribute('style', 'padding: 4px 0px;'); $footer = new CCol($div_buttons, 'controls', 8); $table->addRow($footer); $form->addItem($table); // subfilters $table_subfilter = new CTable(null, 'filter sub-filter'); // array contains subfilters and number of items in each $item_params = array('hosts' => array(), 'applications' => array(), 'types' => array(), 'value_types' => array(), 'status' => array(), 'state' => array(), 'templated_items' => array(), 'with_triggers' => array(), 'history' => array(), 'trends' => array(), 'interval' => array()); // generate array with values for subfilters of selected items foreach ($items as $item) { // hosts if (zbx_empty($filter_hostId)) { $host = reset($item['hosts']); if (!isset($item_params['hosts'][$host['hostid']])) { $item_params['hosts'][$host['hostid']] = array('name' => $host['name'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_hosts') { continue; } $show_item &= $value; } if ($show_item) { $host = reset($item['hosts']); $item_params['hosts'][$host['hostid']]['count']++; } } // applications if (!empty($item['applications'])) { foreach ($item['applications'] as $application) { if (!isset($item_params['applications'][$application['name']])) { $item_params['applications'][$application['name']] = array('name' => $application['name'], 'count' => 0); } } } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_apps') { continue; } $show_item &= $value; } $sel_app = false; if ($show_item) { // if any of item applications are selected foreach ($item['applications'] as $app) { if (str_in_array($app['name'], $subfilter_apps)) { $sel_app = true; break; } } foreach ($item['applications'] as $app) { if (str_in_array($app['name'], $subfilter_apps) || !$sel_app) { $item_params['applications'][$app['name']]['count']++; } } } // types if ($filter_type == -1) { if (!isset($item_params['types'][$item['type']])) { $item_params['types'][$item['type']] = array('name' => item_type2str($item['type']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_types') { continue; } $show_item &= $value; } if ($show_item) { $item_params['types'][$item['type']]['count']++; } } // value types if ($filter_value_type == -1) { if (!isset($item_params['value_types'][$item['value_type']])) { $item_params['value_types'][$item['value_type']] = array('name' => itemValueTypeString($item['value_type']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_value_types') { continue; } $show_item &= $value; } if ($show_item) { $item_params['value_types'][$item['value_type']]['count']++; } } // status if ($filter_status == -1) { if (!isset($item_params['status'][$item['status']])) { $item_params['status'][$item['status']] = array('name' => item_status2str($item['status']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_status') { continue; } $show_item &= $value; } if ($show_item) { $item_params['status'][$item['status']]['count']++; } } // state if ($filter_state == -1) { if (!isset($item_params['state'][$item['state']])) { $item_params['state'][$item['state']] = array('name' => itemState($item['state']), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_state') { continue; } $show_item &= $value; } if ($show_item) { $item_params['state'][$item['state']]['count']++; } } // template if ($filter_templated_items == -1) { if ($item['templateid'] == 0 && !isset($item_params['templated_items'][0])) { $item_params['templated_items'][0] = array('name' => _('Not Templated items'), 'count' => 0); } elseif ($item['templateid'] > 0 && !isset($item_params['templated_items'][1])) { $item_params['templated_items'][1] = array('name' => _('Templated items'), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_templated_items') { continue; } $show_item &= $value; } if ($show_item) { if ($item['templateid'] == 0) { $item_params['templated_items'][0]['count']++; } else { $item_params['templated_items'][1]['count']++; } } } // with triggers if ($filter_with_triggers == -1) { if (count($item['triggers']) == 0 && !isset($item_params['with_triggers'][0])) { $item_params['with_triggers'][0] = array('name' => _('Without triggers'), 'count' => 0); } elseif (count($item['triggers']) > 0 && !isset($item_params['with_triggers'][1])) { $item_params['with_triggers'][1] = array('name' => _('With triggers'), 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_with_triggers') { continue; } $show_item &= $value; } if ($show_item) { if (count($item['triggers']) == 0) { $item_params['with_triggers'][0]['count']++; } else { $item_params['with_triggers'][1]['count']++; } } } // trends if (zbx_empty($filter_trends)) { if (!isset($item_params['trends'][$item['trends']])) { $item_params['trends'][$item['trends']] = array('name' => $item['trends'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_trends') { continue; } $show_item &= $value; } if ($show_item) { $item_params['trends'][$item['trends']]['count']++; } } // history if (zbx_empty($filter_history)) { if (!isset($item_params['history'][$item['history']])) { $item_params['history'][$item['history']] = array('name' => $item['history'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_history') { continue; } $show_item &= $value; } if ($show_item) { $item_params['history'][$item['history']]['count']++; } } // interval if (zbx_empty($filter_delay) && $filter_type != ITEM_TYPE_TRAPPER) { if (!isset($item_params['interval'][$item['delay']])) { $item_params['interval'][$item['delay']] = array('name' => $item['delay'], 'count' => 0); } $show_item = true; foreach ($item['subfilters'] as $name => $value) { if ($name == 'subfilter_interval') { continue; } $show_item &= $value; } if ($show_item) { $item_params['interval'][$item['delay']]['count']++; } } } // output if (zbx_empty($filter_hostId) && count($item_params['hosts']) > 1) { $hosts_output = prepareSubfilterOutput($item_params['hosts'], $subfilter_hosts, 'subfilter_hosts'); $table_subfilter->addRow(array(_('Hosts'), $hosts_output)); } if (!empty($item_params['applications']) && count($item_params['applications']) > 1) { $application_output = prepareSubfilterOutput($item_params['applications'], $subfilter_apps, 'subfilter_apps'); $table_subfilter->addRow(array(_('Applications'), $application_output)); } if ($filter_type == -1 && count($item_params['types']) > 1) { $type_output = prepareSubfilterOutput($item_params['types'], $subfilter_types, 'subfilter_types'); $table_subfilter->addRow(array(_('Types'), $type_output)); } if ($filter_value_type == -1 && count($item_params['value_types']) > 1) { $value_types_output = prepareSubfilterOutput($item_params['value_types'], $subfilter_value_types, 'subfilter_value_types'); $table_subfilter->addRow(array(_('Type of information'), $value_types_output)); } if ($filter_status == -1 && count($item_params['status']) > 1) { $status_output = prepareSubfilterOutput($item_params['status'], $subfilter_status, 'subfilter_status'); $table_subfilter->addRow(array(_('Status'), $status_output)); } if ($filter_state == -1 && count($item_params['state']) > 1) { $state_output = prepareSubfilterOutput($item_params['state'], $subfilter_state, 'subfilter_state'); $table_subfilter->addRow(array(_('State'), $state_output)); } if ($filter_templated_items == -1 && count($item_params['templated_items']) > 1) { $templated_items_output = prepareSubfilterOutput($item_params['templated_items'], $subfilter_templated_items, 'subfilter_templated_items'); $table_subfilter->addRow(array(_('Template'), $templated_items_output)); } if ($filter_with_triggers == -1 && count($item_params['with_triggers']) > 1) { $with_triggers_output = prepareSubfilterOutput($item_params['with_triggers'], $subfilter_with_triggers, 'subfilter_with_triggers'); $table_subfilter->addRow(array(_('With triggers'), $with_triggers_output)); } if (zbx_empty($filter_history) && count($item_params['history']) > 1) { $history_output = prepareSubfilterOutput($item_params['history'], $subfilter_history, 'subfilter_history'); $table_subfilter->addRow(array(_('History'), $history_output)); } if (zbx_empty($filter_trends) && count($item_params['trends']) > 1) { $trends_output = prepareSubfilterOutput($item_params['trends'], $subfilter_trends, 'subfilter_trends'); $table_subfilter->addRow(array(_('Trends'), $trends_output)); } if (zbx_empty($filter_delay) && $filter_type != ITEM_TYPE_TRAPPER && count($item_params['interval']) > 1) { $interval_output = prepareSubfilterOutput($item_params['interval'], $subfilter_interval, 'subfilter_interval'); $table_subfilter->addRow(array(_('Interval'), $interval_output)); } $form->addItem(new CDiv(_('Subfilter [affects only filtered data!]'), 'thin_header')); $form->addItem($table_subfilter); return $form; }
$form_list->addRow(_('Hide selected groups'), (new CMultiSelect(['name' => 'hidegroupids[]', 'objectName' => 'hostGroup', 'data' => $this->data['hideGroups'], 'disabled' => !$this->data['isFilterEnable'], 'popup' => ['parameters' => 'srctbl=host_groups&dstfrm=' . $form->getName() . '&dstfld1=hidegroupids_' . '&srcfld1=groupid&multiselect=1']]))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH)); } // append host in maintenance checkbox to form list $maintenanceCheckBox = (new CCheckBox('maintenance'))->setChecked($this->data['maintenance'] == 1); if (!$this->data['isFilterEnable']) { $maintenanceCheckBox->setAttribute('disabled', 'disabled'); } $form_list->addRow(_('Hosts'), new CLabel([$maintenanceCheckBox, _('Show hosts in maintenance')], 'maintenance')); // append trigger severities to form list $severities = []; foreach ($this->data['severities'] as $severity) { $serverityCheckBox = (new CCheckBox('trgSeverity[' . $severity . ']'))->setChecked(isset($this->data['severity'][$severity]))->setEnabled($this->data['isFilterEnable']); $severities[] = new CLabel([$serverityCheckBox, getSeverityName($severity, $this->data['config'])], 'trgSeverity[' . $severity . ']'); $severities[] = BR(); } array_pop($severities); $form_list->addRow(_('Triggers with severity'), $severities); $form_list->addRow(_('Trigger name like'), (new CTextBox('trigger_name', $data['trigger_name']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setEnabled($data['isFilterEnable'])); if ($data['config']['event_ack_enable']) { // append problem display to form list $ext_ack_combobox = new CComboBox('extAck', $data['extAck'], null, [EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only')]); $ext_ack_combobox->setEnabled($data['isFilterEnable']); $form_list->addRow(_('Problem display'), $ext_ack_combobox); } // create tab $tab = new CTabView(); $tab->addTab('dashconfTab', _('Filter'), $form_list); $tab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [new CButtonCancel()])); $form->addItem($tab); $widget->addItem($form); return $widget;
// append host in maintenance checkbox to form list $maintenanceCheckBox = new CCheckBox('maintenance', $this->data['maintenance'], null, '1'); if (!$this->data['isFilterEnable']) { $maintenanceCheckBox->setAttribute('disabled', 'disabled'); } $dashconfFormList->addRow(_('Hosts'), array($maintenanceCheckBox, _('Show hosts in maintenance'))); // append trigger severities to form list $severities = array(); foreach ($this->data['severities'] as $severity) { $serverityCheckBox = new CCheckBox('trgSeverity[' . $severity . ']', isset($this->data['severity'][$severity]), '', 1); $serverityCheckBox->setEnabled($this->data['isFilterEnable']); $severities[] = array($serverityCheckBox, getSeverityCaption($severity)); $severities[] = BR(); } array_pop($severities); $dashconfFormList->addRow(_('Triggers with severity'), $severities); // append problem display to form list $extAckComboBox = new CComboBox('extAck', $this->data['extAck']); $extAckComboBox->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only'))); $extAckComboBox->setEnabled($this->data['isFilterEnable'] && $this->data['config']['event_ack_enable']); if (!$this->data['config']['event_ack_enable']) { $extAckComboBox->setAttribute('title', _('Event acknowledging disabled')); } $dashconfFormList->addRow(_('Problem display'), $extAckComboBox); // create tab $dashconfTab = new CTabView(); $dashconfTab->addTab('dashconfTab', _('Filter'), $dashconfFormList); $dashconfForm->addItem($dashconfTab); $dashconfForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), new CButtonCancel())); $dashconfWidget->addItem($dashconfForm); return $dashconfWidget;
function insert_copy_elements_to_forms($elements_array_name) { $copy_type = get_request("copy_type", 0); $copy_mode = get_request("copy_mode", 0); $filter_groupid = get_request("filter_groupid", 0); $group_itemid = get_request($elements_array_name, array()); $copy_targetid = get_request("copy_targetid", array()); if (!is_array($group_itemid) || is_array($group_itemid) && count($group_itemid) < 1) { error("Incorrect list of items."); return; } $frmCopy = new CFormTable(count($group_itemid) . ' ' . S_X_ELEMENTS_COPY_TO_DOT_DOT_DOT, null, 'post', null, 'form_copy_to'); $frmCopy->SetHelp('web.items.copyto.php'); $frmCopy->addVar($elements_array_name, $group_itemid); $cmbCopyType = new CComboBox('copy_type', $copy_type, 'submit()'); $cmbCopyType->addItem(0, S_HOSTS); $cmbCopyType->addItem(1, S_HOST_GROUPS); $frmCopy->addRow(S_TARGET_TYPE, $cmbCopyType); $target_sql = 'SELECT DISTINCT g.groupid as target_id, g.name as target_name ' . ' FROM groups g, hosts_groups hg ' . ' WHERE hg.groupid=g.groupid ' . ' ORDER BY g.name'; if (0 == $copy_type) { $cmbGroup = new CComboBox('filter_groupid', $filter_groupid, 'submit()'); $cmbGroup->addItem(0, S_ALL_SMALL); $groups = DBselect($target_sql); while ($group = DBfetch($groups)) { $cmbGroup->addItem($group["target_id"], $group["target_name"]); } $frmCopy->addRow('Group', $cmbGroup); $target_sql = 'SELECT h.hostid as target_id, h.host as target_name FROM hosts h '; if ($filter_groupid > 0) { $target_sql .= ', hosts_groups hg WHERE hg.hostid=h.hostid AND hg.groupid=' . $filter_groupid; } $target_sql .= ' ORDER BY target_name'; } $db_targets = DBselect($target_sql); $target_list = array(); while ($target = DBfetch($db_targets)) { array_push($target_list, array(new CCheckBox('copy_targetid[' . $target['target_id'] . ']', uint_in_array($target['target_id'], $copy_targetid), null, $target['target_id']), SPACE, $target['target_name'], BR())); } $frmCopy->addRow(S_TARGET, $target_list); $cmbCopyMode = new CComboBox('copy_mode', $copy_mode); $cmbCopyMode->addItem(0, S_UPDATE_EXISTING_NON_LINKED_ITEMS); $cmbCopyMode->addItem(1, S_SKIP_EXISTING_ITEMS); $cmbCopyMode->setEnabled(false); $frmCopy->addRow(S_MODE, $cmbCopyMode); $frmCopy->addItemToBottomRow(new CButton("copy", S_COPY)); $frmCopy->addItemToBottomRow(array(SPACE, new CButtonCancel(url_param('groupid') . url_param("hostid") . url_param("config")))); $frmCopy->Show(); }
$customLabelImageTextArea = new CTextArea('label_string_image', $this->data['sysmap']['label_string_image']); if ($this->data['sysmap']['label_type_image'] != MAP_LABEL_TYPE_CUSTOM) { $customLabelImageTextArea->addClass('hidden'); } $sysmapList->addRow(_('Image label type'), array($labelTypeImageComboBox, BR(), $customLabelImageTextArea)); // append icon label to form list unset($this->data['labelTypes'][MAP_LABEL_TYPE_CUSTOM]); $sysmapList->addRow(_('Icon label type'), new CComboBox('label_type', $this->data['sysmap']['label_type'], null, $this->data['labelTypes'])); // append icon label location to form list $locationComboBox = new CComboBox('label_location', $this->data['sysmap']['label_location']); $locationComboBox->addItems(array(0 => _('Bottom'), 1 => _('Left'), 2 => _('Right'), 3 => _('Top'))); $sysmapList->addRow(_('Icon label location'), $locationComboBox); // append show unack to form list $showUnackComboBox = new CComboBox('show_unack', $this->data['sysmap']['show_unack']); $showUnackComboBox->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only'))); $showUnackComboBox->setEnabled($this->data['config']['event_ack_enable']); if (!$this->data['config']['event_ack_enable']) { $showUnackComboBox->setAttribute('title', _('Acknowledging disabled')); } $sysmapList->addRow(_('Problem display'), $showUnackComboBox); // append severity min to form list $sysmapList->addRow(_('Minimum trigger severity'), new CSeverity(array('name' => 'severity_min', 'value' => $this->data['sysmap']['severity_min']))); // create url table $urlTable = new CTable(_('No URLs defined.'), 'formElementTable'); $urlTable->setAttribute('style', 'min-width: 500px;'); $urlTable->setHeader(array(_('Name'), _('URL'), _('Element'), SPACE)); if (empty($this->data['sysmap']['urls'])) { $this->data['sysmap']['urls'][] = array('name' => '', 'url' => '', 'elementtype' => 0); } $i = 0; foreach ($this->data['sysmap']['urls'] as $url) {
$hostList->addRow(_('JMX interfaces'), (new CDiv($ifTab))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('data-type', 'jmx')->setWidth(ZBX_HOST_INTERFACE_WIDTH)); // IPMI interfaces $ifTab = (new CTable())->setId('IPMIInterfaces'); $row = (new CRow())->setId('IPMIInterfacesFooter'); if (!array_key_exists(INTERFACE_TYPE_IPMI, $existingInterfaceTypes)) { $row->addItem(new CCol()); $row->addItem((new CCol(_('No IPMI interfaces found.')))->setColSpan(6)); } $ifTab->addRow($row); $hostList->addRow(_('IPMI interfaces'), (new CDiv($ifTab))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('data-type', 'ipmi')->setWidth(ZBX_HOST_INTERFACE_WIDTH)); } $hostList->addRow(_('Description'), (new CTextArea('description', $data['description']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)); // Proxy if ($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED) { $proxy = new CComboBox('proxy_hostid', $data['proxy_hostid'], null, [0 => _('(no proxy)')] + $data['proxies']); $proxy->setEnabled($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED); } else { $proxy = (new CTextBox(null, $data['proxy_hostid'] != 0 ? $data['proxies'][$data['proxy_hostid']] : _('(no proxy)'), true))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH); $hostList->addVar('proxy_hostid', $data['proxy_hostid']); } $hostList->addRow(_('Monitored by proxy'), $proxy); $hostList->addRow(_('Enabled'), (new CCheckBox('status', HOST_STATUS_MONITORED))->setChecked($data['status'] == HOST_STATUS_MONITORED)); if ($data['clone_hostid'] != 0) { // host applications $hostApps = API::Application()->get(['output' => ['name'], 'hostids' => [$data['clone_hostid']], 'inherited' => false, 'preservekeys' => true, 'filter' => ['flags' => ZBX_FLAG_DISCOVERY_NORMAL]]); if ($hostApps) { $applicationsList = []; foreach ($hostApps as $hostAppId => $hostApp) { $applicationsList[$hostAppId] = $hostApp['name']; } order_result($applicationsList);
} // disable node selection if we show objects from only one host or LLD rule if (hasRequest('only_hostid') || hasRequest('parent_discoveryid')) { $nodeComboBox->setEnabled('disabled'); } $frmTitle->addItem(array(SPACE, _('Node'), SPACE, $nodeComboBox, SPACE)); } /* * Only host id */ if (isset($onlyHostid)) { $only_hosts = API::Host()->get(array('hostids' => $hostid, 'templated_hosts' => true, 'output' => array('hostid', 'host'), 'limit' => 1)); $host = reset($only_hosts); $cmbHosts = new CComboBox('hostid', $hostid); $cmbHosts->addItem($hostid, $host['host']); $cmbHosts->setEnabled('disabled'); $cmbHosts->setAttribute('title', _('You can not switch hosts for current selection.')); $frmTitle->addItem(array(SPACE, _('Host'), SPACE, $cmbHosts)); } else { if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs', 'templates', 'hosts', 'host_templates'))) { $frmTitle->addItem(array(_('Group'), SPACE, $pageFilter->getGroupsCB())); } if (str_in_array($srctbl, array('help_items'))) { $itemtype = get_request('itemtype', 0); $cmbTypes = new CComboBox('itemtype', $itemtype, 'javascript: submit();'); foreach ($allowed_item_types as $type) { $cmbTypes->addItem($type, item_type2str($type)); } $frmTitle->addItem(array(_('Type'), SPACE, $cmbTypes)); } if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs'))) {
function insert_copy_elements_to_forms($elements_array_name) { $copy_type = get_request("copy_type", 0); $copy_mode = get_request("copy_mode", 0); $filter_groupid = get_request("filter_groupid", 0); $group_itemid = get_request($elements_array_name, array()); $copy_targetid = get_request("copy_targetid", array()); if (!is_array($group_itemid) || is_array($group_itemid) && count($group_itemid) < 1) { error("Incorrect list of items."); return; } $frmCopy = new CFormTable(count($group_itemid) . ' ' . S_X_ELEMENTS_COPY_TO_DOT_DOT_DOT, null, 'post', null, 'go'); $frmCopy->SetHelp('web.items.copyto.php'); $frmCopy->addVar($elements_array_name, $group_itemid); $cmbCopyType = new CComboBox('copy_type', $copy_type, 'submit()'); $cmbCopyType->addItem(0, S_HOSTS); $cmbCopyType->addItem(1, S_HOST_GROUPS); $frmCopy->addRow(S_TARGET_TYPE, $cmbCopyType); $target_list = array(); $groups = CHostGroup::get(array('extendoutput' => 1, 'order' => 'name')); if (0 == $copy_type) { $cmbGroup = new CComboBox('filter_groupid', $filter_groupid, 'submit()'); foreach ($groups as $groupid => $group) { if (empty($filter_groupid)) { $filter_groupid = $groupid; } $cmbGroup->addItem($groupid, $group['name']); } $frmCopy->addRow('Group', $cmbGroup); $options = array('extendoutput' => 1, 'order' => 'host', 'groupids' => $filter_groupid); $hosts = CHost::get($options); foreach ($hosts as $hostid => $host) { array_push($target_list, array(new CCheckBox('copy_targetid[' . $hostid . ']', uint_in_array($hostid, $copy_targetid), null, $hostid), SPACE, $host['host'], BR())); } } else { foreach ($groups as $groupid => $group) { array_push($target_list, array(new CCheckBox('copy_targetid[' . $groupid . ']', uint_in_array($groupid, $copy_targetid), null, $groupid), SPACE, $group['name'], BR())); } } $frmCopy->addRow(S_TARGET, $target_list); $cmbCopyMode = new CComboBox('copy_mode', $copy_mode); $cmbCopyMode->addItem(0, S_UPDATE_EXISTING_NON_LINKED_ITEMS); $cmbCopyMode->addItem(1, S_SKIP_EXISTING_ITEMS); $cmbCopyMode->setEnabled(false); $frmCopy->addRow(S_MODE, $cmbCopyMode); $frmCopy->addItemToBottomRow(new CButton("copy", S_COPY)); $frmCopy->addItemToBottomRow(array(SPACE, new CButtonCancel(url_param('groupid') . url_param("hostid") . url_param("config")))); $frmCopy->show(); }
function insert_map_form() { $frm_title = 'New system map'; if (isset($_REQUEST['sysmapid'])) { $options = array('sysmapids' => $_REQUEST['sysmapid'], 'output' => API_OUTPUT_EXTEND); $sysmaps = CMap::get($options); $row = reset($sysmaps); $frm_title = 'System map: "' . $row['name'] . '"'; } if (isset($_REQUEST['sysmapid']) && !isset($_REQUEST['form_refresh'])) { $name = $row['name']; $width = $row['width']; $height = $row['height']; $backgroundid = $row['backgroundid']; $label_type = $row['label_type']; $label_location = $row['label_location']; $highlight = $row['highlight']; $markelements = $row['markelements']; $expandproblem = $row['expandproblem']; $show_unack = $row['show_unack']; } else { $name = get_request('name', ''); $width = get_request('width', 800); $height = get_request('height', 600); $backgroundid = get_request('backgroundid', 0); $label_type = get_request('label_type', 0); $label_location = get_request('label_location', 0); $highlight = get_request('highlight', 0); $markelements = get_request('markelements', 0); $expandproblem = get_request('expandproblem', 0); $show_unack = get_request('show_unack', 0); } $frmMap = new CFormTable($frm_title, 'sysmaps.php'); $frmMap->setHelp('web.sysmaps.map.php'); if (isset($_REQUEST['sysmapid'])) { $frmMap->addVar('sysmapid', $_REQUEST['sysmapid']); } $frmMap->addRow(S_NAME, new CTextBox('name', $name, 32)); $frmMap->addRow(S_WIDTH, new CNumericBox('width', $width, 5)); $frmMap->addRow(S_HEIGHT, new CNumericBox('height', $height, 5)); $cmbImg = new CComboBox('backgroundid', $backgroundid); $cmbImg->addItem(0, S_NO_IMAGE . '...'); $result = DBselect('SELECT * FROM images WHERE imagetype=2 AND ' . DBin_node('imageid') . ' order by name'); while ($row = DBfetch($result)) { $cmbImg->addItem($row['imageid'], get_node_name_by_elid($row['imageid'], null, ': ') . $row['name']); } $frmMap->addRow(S_BACKGROUND_IMAGE, $cmbImg); $frmMap->addRow(S_ICON_HIGHLIGHTING, new CCheckBox('highlight', $highlight, null, 1)); $frmMap->addRow(S_MARK_ELEMENTS_ON_TRIGGER_STATUS_CHANGE, new CCheckBox('markelements', $markelements, null, 1)); $frmMap->addRow(S_EXPAND_SINGLE_PROBLEM, new CCheckBox('expandproblem', $expandproblem, null, 1)); $cmbLabel = new CComboBox('label_type', $label_type); $cmbLabel->addItem(0, S_LABEL); $cmbLabel->addItem(1, S_IP_ADDRESS); $cmbLabel->addItem(2, S_ELEMENT_NAME); $cmbLabel->addItem(3, S_STATUS_ONLY); $cmbLabel->addItem(4, S_NOTHING); $frmMap->addRow(S_ICON_LABEL_TYPE, $cmbLabel); $cmbLocation = new CComboBox('label_location', $label_location); $cmbLocation->addItem(0, S_BOTTOM); $cmbLocation->addItem(1, S_LEFT); $cmbLocation->addItem(2, S_RIGHT); $cmbLocation->addItem(3, S_TOP); $frmMap->addRow(S_ICON_LABEL_LOCATION, $cmbLocation); $config = select_config(); $cb = new CComboBox('show_unack', $show_unack); $cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY)); $cb->setEnabled($config['event_ack_enable']); if (!$config['event_ack_enable']) { $cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED); } $frmMap->addRow(S_PROBLEM_DISPLAY, $cb); $frmMap->addItemToBottomRow(new CButton('save', S_SAVE)); if (isset($_REQUEST['sysmapid'])) { $frmMap->addItemToBottomRow(SPACE); $frmMap->addItemToBottomRow(new CButtonDelete(S_DELETE_SYSTEM_MAP_Q, url_param('form') . url_param('sysmapid'))); } $frmMap->addItemToBottomRow(SPACE); $frmMap->addItemToBottomRow(new CButtonCancel()); return $frmMap; }
$userTab = new CTabView(); if (!$this->data['form_refresh']) { $userTab->setSelected(0); } $userTab->addTab('userTab', _('User'), $userFormList); if (isset($userMediaFormList)) { $userTab->addTab('mediaTab', _('Media'), $userMediaFormList); } if (!$this->data['is_profile']) { /* * Permissions tab */ $permissionsFormList = new CFormList('permissionsFormList'); $userTypeComboBox = new CComboBox('user_type', $this->data['user_type'], 'submit();', [USER_TYPE_ZABBIX_USER => user_type2str(USER_TYPE_ZABBIX_USER), USER_TYPE_ZABBIX_ADMIN => user_type2str(USER_TYPE_ZABBIX_ADMIN), USER_TYPE_SUPER_ADMIN => user_type2str(USER_TYPE_SUPER_ADMIN)]); if ($data['userid'] != 0 && bccomp(CWebUser::$data['userid'], $data['userid']) == 0) { $userTypeComboBox->setEnabled(false); $permissionsFormList->addRow(_('User type'), [$userTypeComboBox, SPACE, new CSpan(_('User can\'t change type for himself'))]); $userForm->addVar('user_type', $this->data['user_type']); } else { $permissionsFormList->addRow(_('User type'), $userTypeComboBox); } $permissionsFormList = getPermissionsFormList($this->data['user_rights'], $this->data['user_type'], $permissionsFormList); $permissionsFormList->addInfo(_('Permissions can be assigned for user groups only.')); $userTab->addTab('permissionsTab', _('Permissions'), $permissionsFormList); } if (isset($userMessagingFormList)) { $userTab->addTab('messagingTab', _('Messaging'), $userMessagingFormList); } // append buttons to form if ($data['userid'] != 0) { $buttons = [new CButtonCancel()];
for ($i = 1; $i <= $dstfldCount; $i++) { $frmTitle->addVar('dstfld' . $i, getRequest('dstfld' . $i)); } for ($i = 1; $i <= $srcfldCount; $i++) { $frmTitle->addVar('srcfld' . $i, getRequest('srcfld' . $i)); } /* * Only host id */ $controls = []; if (isset($onlyHostid)) { $only_hosts = API::Host()->get(['hostids' => $hostid, 'templated_hosts' => true, 'output' => ['hostid', 'host', 'name'], 'limit' => 1]); $host = reset($only_hosts); $cmbHosts = new CComboBox('hostid', $hostid); $cmbHosts->addItem($hostid, $host['name']); $cmbHosts->setEnabled(false); $cmbHosts->setAttribute('title', _('You can not switch hosts for current selection.')); $controls[] = [SPACE, _('Host'), SPACE, $cmbHosts]; } else { // show Group dropdown in header for these specified sources $showGroupCmbBox = ['triggers', 'items', 'applications', 'graphs', 'graph_prototypes', 'item_prototypes', 'templates', 'hosts', 'host_templates']; if (str_in_array($srctbl, $showGroupCmbBox) && ($srctbl !== 'item_prototypes' || !$parentDiscoveryId)) { $controls[] = [_('Group'), SPACE, $pageFilter->getGroupsCB()]; } // show Type dropdown in header for help items if ($srctbl === 'help_items') { $itemType = getRequest('itemtype', 0); $cmbTypes = new CComboBox('itemtype', $itemType, 'javascript: submit();'); foreach ($allowedItemTypes as $type) { $cmbTypes->addItem($type, item_type2str($type)); }
$customLabelImage = new CTextarea('label_string_image', $this->data['label_string_image']); if ($this->data['label_type_image'] != MAP_LABEL_TYPE_CUSTOM) { $customLabelImage->addClass('hidden'); } $sysmapList->addRow(_('Image label type'), array($labelTypeImage, BR(), $customLabelImage)); // append icon label to sysmap unset($labelTypes[MAP_LABEL_TYPE_CUSTOM]); $sysmapList->addRow(_('Icon label type'), new CComboBox('label_type', $this->data['label_type'], null, $labelTypes)); // append icon label location to sysmap $cmbLocation = new CComboBox('label_location', $this->data['label_location']); $cmbLocation->addItems(array(0 => _('Bottom'), 1 => _('Left'), 2 => _('Right'), 3 => _('Top'))); $sysmapList->addRow(_('Icon label location'), $cmbLocation); // append show unack to sysmap $selectShowUnack = new CComboBox('show_unack', $this->data['show_unack']); $selectShowUnack->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only'))); $selectShowUnack->setEnabled($config['event_ack_enable']); if (!$config['event_ack_enable']) { $selectShowUnack->setAttribute('title', _('Acknowledging disabled')); } $sysmapList->addRow(_('Problem display'), $selectShowUnack); // create url table $urlTable = new CTable(_('No URLs defined.'), 'formElementTable'); $urlTable->setAttribute('style', 'min-width: 500px;'); $urlTable->setHeader(array(_('Name'), _('URL'), _('Element'), SPACE)); if (empty($this->data['urls'])) { $this->data['urls'][] = array('name' => '', 'url' => '', 'elementtype' => 0); } $i = 0; foreach ($this->data['urls'] as $url) { $urlLabel = new CTextBox('urls[' . $i . '][name]', $url['name'], 32); $urlLink = new CTextBox('urls[' . $i . '][url]', $url['url'], 32);