$exactComboBox->addItem('1', _('exactly')); $filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories'); $filter = new CSubmit('filter_set', _('Filter')); $filter->useJQueryStyle('main'); $reset = new CSubmit('filter_rst', _('Reset')); $reset->useJQueryStyle(); $divButtons = new CDiv(array($filter, SPACE, $reset)); $divButtons->setAttribute('style', 'padding: 4px 0px;'); $footerCol = new CCol($divButtons, 'controls'); $filterTable->addRow($footerCol); $filterForm = new CForm('get'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addItem($filterTable); $hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0)); $hostInventoryWidget->addHeaderRowNumber(); $table = new CTableInfo(_('No hosts found.')); $table->setHeader(array(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 = array(); foreach ($host['groups'] as $group) { $hostGroups[] = $group['name']; } natsort($hostGroups); $hostGroups = implode(', ', $hostGroups); $row = array(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid'), $host['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''), $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 = array($this->data['paging'], $table, $this->data['paging']); $hostInventoryWidget->addItem($table); return $hostInventoryWidget;
$controls = (new CList())->addItem([_('Group') . SPACE, $pageFilter->getGroupsCB()])->addItem([_('Grouping by') . SPACE, $inventoryFieldsComboBox]); $hostinvent_wdgt->setControls((new CForm('get'))->addItem($controls)); $table = (new CTableInfo())->setHeader([make_sorting_header($groupFieldTitle === '' ? _('Field') : $groupFieldTitle, 'inventory_field', $sortField, $sortOrder), make_sorting_header(_('Host count'), 'host_count', $sortField, $sortOrder)]); // to show a report, we will need a host group and a field to aggregate if ($pageFilter->groupsSelected && $groupFieldTitle !== '') { $options = ['output' => ['hostid', 'name'], 'selectInventory' => [$_REQUEST['groupby']], 'withInventory' => true]; if ($pageFilter->groupid > 0) { $options['groupids'] = $pageFilter->groupid; } $hosts = API::Host()->get($options); // aggregating data by chosen field value $report = []; foreach ($hosts as $host) { if ($host['inventory'][$_REQUEST['groupby']] !== '') { // same names with different letter casing are considered the same $lowerValue = mb_strtolower($host['inventory'][$_REQUEST['groupby']]); if (!isset($report[$lowerValue])) { $report[$lowerValue] = ['inventory_field' => $host['inventory'][$_REQUEST['groupby']], 'host_count' => 1]; } else { $report[$lowerValue]['host_count'] += 1; } } } order_result($report, $sortField, $sortOrder); foreach ($report as $rep) { $table->addRow([zbx_str2links($rep['inventory_field']), new CLink($rep['host_count'], 'hostinventories.php?filter_field=' . $_REQUEST['groupby'] . '&filter_field_value=' . urlencode($rep['inventory_field']) . '&filter_set=1&filter_exact=1' . url_param('groupid'))]); } } $hostinvent_wdgt->addItem($table); $hostinvent_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$table = new CTableInfo(_('No hosts found.')); $table->setHeader(array(make_sorting_header($groupFieldTitle === '' ? _('Field') : $groupFieldTitle, 'inventory_field', $sortField, $sortOrder), make_sorting_header(_('Host count'), 'host_count', $sortField, $sortOrder))); // to show a report, we will need a host group and a field to aggregate if ($pageFilter->groupsSelected && $groupFieldTitle !== '') { $options = array('output' => array('hostid', 'name'), 'selectInventory' => array($_REQUEST['groupby']), 'withInventory' => true); if ($pageFilter->groupid > 0) { $options['groupids'] = $pageFilter->groupid; } $hosts = API::Host()->get($options); // aggregating data by chosen field value $report = array(); foreach ($hosts as $host) { if ($host['inventory'][$_REQUEST['groupby']] !== '') { // same names with different letter casing are considered the same $lowerValue = mb_strtolower($host['inventory'][$_REQUEST['groupby']]); if (!isset($report[$lowerValue])) { $report[$lowerValue] = array('inventory_field' => $host['inventory'][$_REQUEST['groupby']], 'host_count' => 1); } else { $report[$lowerValue]['host_count'] += 1; } } } order_result($report, $sortField, $sortOrder); foreach ($report as $rep) { $row = array(new CSpan(zbx_str2links($rep['inventory_field']), 'pre'), new CLink($rep['host_count'], 'hostinventories.php?filter_field=' . $_REQUEST['groupby'] . '&filter_field_value=' . urlencode($rep['inventory_field']) . '&filter_set=1&filter_exact=1' . url_param('groupid'))); $table->addRow($row); } } $hostinvent_wdgt->addItem($table); $hostinvent_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$graphsLink = _('Graphs'); $discoveryLink = _('Discovery'); $webLink = _('Web'); } $configurationArray = array($hostLink, new CSpan(array($applicationsLink, SPACE, '(' . $this->data['host']['applications'] . ')'), 'overview-link'), new CSpan(array($itemsLink, SPACE, '(' . $this->data['host']['items'] . ')'), 'overview-link'), new CSpan(array($triggersLink, SPACE, '(' . $this->data['host']['triggers'] . ')'), 'overview-link'), new CSpan(array($graphsLink, SPACE, '(' . $this->data['host']['graphs'] . ')'), 'overview-link'), new CSpan(array($discoveryLink, SPACE, '(' . $this->data['host']['discoveries'] . ')'), 'overview-link'), new CSpan(array($webLink, SPACE, '(' . $this->data['host']['httpTests'] . ')'), 'overview-link')); $overviewFormList->addRow(_('Configuration'), $configurationArray); $hostInventoriesTab = new CTabView(array('remember' => true)); $hostInventoriesTab->setSelected(0); $hostInventoriesTab->addTab('overviewTab', _('Overview'), $overviewFormList); /* * Details tab */ $detailsFormList = new CFormList(); $inventoryValues = false; if ($this->data['host']['inventory']) { foreach ($this->data['host']['inventory'] as $key => $value) { if (!zbx_empty($value)) { $detailsFormList->addRow($this->data['tableTitles'][$key]['title'], new CSpan(zbx_str2links($value), 'text-field')); $inventoryValues = true; } } } if (!$inventoryValues) { $hostInventoriesTab->setDisabled(array(1)); } $hostInventoriesTab->addTab('detailsTab', _('Details'), $detailsFormList); // append tabs and form $hostInventoriesForm->addItem($hostInventoriesTab); $hostInventoriesForm->addItem(makeFormFooter(null, new CButtonCancel(url_param('groupid')))); $hostInventoryWidget->addItem($hostInventoriesForm); return $hostInventoryWidget;
$hosts[$num]['pr_serialno_a'] = $host['inventory']['serialno_a']; $hosts[$num]['pr_tag'] = $host['inventory']['tag']; $hosts[$num]['pr_macaddress_a'] = $host['inventory']['macaddress_a']; // if we are filtering by inventory field if (!empty($_REQUEST['filter_field']) && !empty($_REQUEST['filter_field_value'])) { // must we filter exactly or using a substring (both are case insensitive) $match = $_REQUEST['filter_exact'] ? zbx_strtolower($hosts[$num]['inventory'][$_REQUEST['filter_field']]) === zbx_strtolower($_REQUEST['filter_field_value']) : zbx_strpos(zbx_strtolower($hosts[$num]['inventory'][$_REQUEST['filter_field']]), zbx_strtolower($_REQUEST['filter_field_value'])) !== false; if (!$match) { unset($hosts[$num]); } } } order_result($hosts, getPageSortField('name'), getPageSortOrder()); $paging = getPagingLine($hosts); foreach ($hosts as $host) { $host_groups = array(); foreach ($host['groups'] as $group) { $host_groups[] = $group['name']; } natsort($host_groups); $host_groups = implode(', ', $host_groups); $row = array(get_node_name_by_elid($host['hostid']), new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid')), $host_groups, 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 = array($paging, $table, $paging); $hostinvent_wdgt->addItem($table); } $hostinvent_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$graphsLink = _('Graphs'); $discoveryLink = _('Discovery'); $webLink = _('Web'); } $overviewFormList->addRow(_('Configuration'), array($hostLink, new CSpan(array($applicationsLink, SPACE, '(' . $this->data['host']['applications'] . ')'), 'overview-link'), new CSpan(array($itemsLink, SPACE, '(' . $this->data['host']['items'] . ')'), 'overview-link'), new CSpan(array($triggersLink, SPACE, '(' . $this->data['host']['triggers'] . ')'), 'overview-link'), new CSpan(array($graphsLink, SPACE, '(' . $this->data['host']['graphs'] . ')'), 'overview-link'), new CSpan(array($discoveryLink, SPACE, '(' . $this->data['host']['discoveries'] . ')'), 'overview-link'), new CSpan(array($webLink, SPACE, '(' . $this->data['host']['httpTests'] . ')'), 'overview-link'))); $hostInventoriesTab = new CTabView(array('remember' => true)); $hostInventoriesTab->setSelected(0); $hostInventoriesTab->addTab('overviewTab', _('Overview'), $overviewFormList); /* * Details tab */ $detailsFormList = new CFormList(); $inventoryValues = false; if ($this->data['host']['inventory']) { foreach ($this->data['host']['inventory'] as $key => $value) { if (!zbx_empty($value)) { $detailsFormList->addRow($this->data['tableTitles'][$key]['title'], array(new CDiv(new CSpan(zbx_str2links($value), 'inventory-text-field'), 'inventory-text-field-wrap'))); $inventoryValues = true; } } } if (!$inventoryValues) { $hostInventoriesTab->setDisabled(array(1)); } $hostInventoriesTab->addTab('detailsTab', _('Details'), $detailsFormList); // append tabs and form $hostInventoriesForm = new CForm(); $hostInventoriesForm->addItem($hostInventoriesTab); $hostInventoriesForm->addItem(makeFormFooter(null, new CButtonCancel(url_param('groupid')))); $hostInventoryWidget->addItem($hostInventoriesForm); return $hostInventoryWidget;
** 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;
$table->setHeader(array(is_show_all_nodes() ? make_sorting_header(S_NODE, 'hostid') : null, make_sorting_header(S_HOST, 'host'), S_GROUP, make_sorting_header(S_NAME, 'pr_name'), make_sorting_header(S_OS, 'pr_os'), make_sorting_header(S_SERIALNO, 'pr_serialno'), make_sorting_header(S_TAG, 'pr_tag'), make_sorting_header(S_MACADDRESS, 'pr_macaddress'))); } else { $table->setHeader(array(is_show_all_nodes() ? make_sorting_header(S_NODE, 'hostid') : null, make_sorting_header(S_HOST, 'host'), S_GROUP, make_sorting_header(S_DEVICE_OS_SHORT, 'pre_device_os_short'), make_sorting_header(S_DEVICE_HW_ARCH, 'pre_device_hw_arch'), make_sorting_header(S_DEVICE_TYPE, 'pre_device_type'), make_sorting_header(S_DEVICE_STATUS, 'pre_device_status'))); } foreach ($hosts as $host) { $host_groups = array(); foreach ($host['groups'] as $group) { $host_groups[] = $group['name']; } natcasesort($host_groups); $host_groups = implode(', ', $host_groups); $row = array(get_node_name_by_elid($host['hostid']), new CLink($host['host'], '?hostid=' . $host['hostid'] . url_param('groupid') . '&prof_type=' . $_REQUEST['prof_type']), $host_groups); if (0 == $_REQUEST['prof_type']) { $row[] = zbx_str2links($host['profile']['name']); $row[] = zbx_str2links($host['profile']['os']); $row[] = zbx_str2links($host['profile']['serialno']); $row[] = zbx_str2links($host['profile']['tag']); $row[] = zbx_str2links($host['profile']['macaddress']); } else { $row[] = zbx_str2links($host['profile_ext']['device_os_short']); $row[] = zbx_str2links($host['profile_ext']['device_hw_arch']); $row[] = zbx_str2links($host['profile_ext']['device_type']); $row[] = zbx_str2links($host['profile_ext']['device_status']); } $table->addRow($row); } $table = array($paging, $table, $paging); $hostprof_wdgt->addItem($table); } $hostprof_wdgt->show(); include_once 'include/page_footer.php';
$webLink = new CLink(_('Web'), 'httpconf.php?hostid=' . $data['host']['hostid'] . url_param('groupid')); } else { $hostLink = _('Host'); $applicationsLink = _('Application'); $itemsLink = _('Items'); $triggersLink = _('Triggers'); $graphsLink = _('Graphs'); $discoveryLink = _('Discovery'); $webLink = _('Web'); } $overviewFormList->addRow(_('Configuration'), new CHorList([$hostLink, new CSpan([$applicationsLink, CViewHelper::showNum($data['host']['applications'])]), new CSpan([$itemsLink, CViewHelper::showNum($data['host']['items'])]), new CSpan([$triggersLink, CViewHelper::showNum($data['host']['triggers'])]), new CSpan([$graphsLink, CViewHelper::showNum($data['host']['graphs'])]), new CSpan([$discoveryLink, CViewHelper::showNum($data['host']['discoveries'])]), new CSpan([$webLink, CViewHelper::showNum($data['host']['httpTests'])])])); $hostInventoriesTab = (new CTabView(['remember' => true]))->setSelected(0)->addTab('overviewTab', _('Overview'), $overviewFormList); /* * Details tab */ $detailsFormList = new CFormList(); $inventoryValues = false; foreach ($data['host']['inventory'] as $key => $value) { if ($value !== '') { $detailsFormList->addRow($data['tableTitles'][$key]['title'], (new CDiv(zbx_str2links($value)))->setWidth(ZBX_TEXTAREA_BIG_WIDTH)); $inventoryValues = true; } } if (!$inventoryValues) { $hostInventoriesTab->setDisabled([1]); } $hostInventoriesTab->addTab('detailsTab', _('Details'), $detailsFormList); // append tabs and form $hostInventoriesTab->setFooter(makeFormFooter(null, [new CButtonCancel(url_param('groupid'))])); $hostInventoryWidget->addItem((new CForm())->addItem($hostInventoriesTab)); return $hostInventoryWidget;
/** * Create table with trigger description and events. * * @param array $trigger An array of trigger data. * @param string $trigger['triggerid'] Trigger ID to select events. * @param string $trigger['description'] Trigger description. * @param string $trigger['url'] Trigger URL. * @param string $trigger['lastEvent']['eventid'] Last event ID * @param string $backurl URL to return to. * * @return CDiv */ function make_popup_eventlist($trigger, $backurl) { // Show trigger description and URL. $div = new CDiv(); if ($trigger['comments'] !== '') { $div->addItem((new CDiv())->addItem(zbx_str2links($trigger['comments']))->addClass(ZBX_STYLE_OVERLAY_DESCR)); } if ($trigger['url'] !== '') { $div->addItem((new CDiv())->addItem(new CLink($trigger['url'], $trigger['url']))->addClass(ZBX_STYLE_OVERLAY_DESCR_URL)); } // Select and show events. $config = select_config(); $table = new CTableInfo(); // If acknowledges are turned on, we show 'ack' column. if ($config['event_ack_enable']) { $table->setHeader([_('Time'), _('Status'), _('Duration'), _('Age'), _('Ack')]); } else { $table->setHeader([_('Time'), _('Status'), _('Duration'), _('Age')]); } if ($trigger['lastEvent']) { $events = API::Event()->get(['source' => EVENT_SOURCE_TRIGGERS, 'object' => EVENT_OBJECT_TRIGGER, 'output' => API_OUTPUT_EXTEND, 'objectids' => [$trigger['triggerid']], 'eventid_till' => $trigger['lastEvent']['eventid'], 'select_acknowledges' => API_OUTPUT_COUNT, 'sortfield' => ['clock', 'eventid'], 'sortorder' => ZBX_SORT_DOWN, 'limit' => ZBX_WIDGET_ROWS]); $lclock = time(); foreach ($events as $event) { $duration = zbx_date2age($lclock, $event['clock']); $lclock = $event['clock']; $eventStatusSpan = new CSpan(trigger_value2str($event['value'])); // add colors and blinking to span depending on configuration and trigger parameters addTriggerValueStyle($eventStatusSpan, $event['value'], $event['clock'], $event['acknowledged']); $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $event['clock']), $eventStatusSpan, $duration, zbx_date2age($event['clock']), $config['event_ack_enable'] ? getEventAckState($event, $backurl) : null]); } } $div->addItem($table); return $div; }
function insert_host_inventory_form() { $frmHostP = new CFormTable(_('Host Inventory')); $table_titles = getHostInventories(); $table_titles = zbx_toHash($table_titles, 'db_field'); $sql_fields = implode(', ', array_keys($table_titles)); $sql = 'SELECT ' . $sql_fields . ' FROM host_inventory WHERE hostid=' . zbx_dbstr($_REQUEST['hostid']); $result = DBselect($sql); $row = DBfetch($result); foreach ($row as $key => $value) { if (!zbx_empty($value)) { $frmHostP->addRow($table_titles[$key]['title'], new CSpan(zbx_str2links($value), 'pre')); } } $frmHostP->addItemToBottomRow(new CButtonCancel(url_param('groupid'))); return $frmHostP; }
function insert_host_profile_ext_form() { $frmHostPA = new CFormTable(S_EXTENDED_HOST_PROFILE); $table_titles = array('device_alias' => S_DEVICE_ALIAS, 'device_type' => S_DEVICE_TYPE, 'device_chassis' => S_DEVICE_CHASSIS, 'device_os' => S_DEVICE_OS, 'device_os_short' => S_DEVICE_OS_SHORT, 'device_hw_arch' => S_DEVICE_HW_ARCH, 'device_serial' => S_DEVICE_SERIAL, 'device_model' => S_DEVICE_MODEL, 'device_tag' => S_DEVICE_TAG, 'device_vendor' => S_DEVICE_VENDOR, 'device_contract' => S_DEVICE_CONTRACT, 'device_who' => S_DEVICE_WHO, 'device_status' => S_DEVICE_STATUS, 'device_app_01' => S_DEVICE_APP_01, 'device_app_02' => S_DEVICE_APP_02, 'device_app_03' => S_DEVICE_APP_03, 'device_app_04' => S_DEVICE_APP_04, 'device_app_05' => S_DEVICE_APP_05, 'device_url_1' => S_DEVICE_URL_1, 'device_url_2' => S_DEVICE_URL_2, 'device_url_3' => S_DEVICE_URL_3, 'device_networks' => S_DEVICE_NETWORKS, 'device_notes' => S_DEVICE_NOTES, 'device_hardware' => S_DEVICE_HARDWARE, 'device_software' => S_DEVICE_SOFTWARE, 'ip_subnet_mask' => S_IP_SUBNET_MASK, 'ip_router' => S_IP_ROUTER, 'ip_macaddress' => S_IP_MACADDRESS, 'oob_ip' => S_OOB_IP, 'oob_subnet_mask' => S_OOB_SUBNET_MASK, 'oob_router' => S_OOB_ROUTER, 'date_hw_buy' => S_DATE_HW_BUY, 'date_hw_install' => S_DATE_HW_INSTALL, 'date_hw_expiry' => S_DATE_HW_EXPIRY, 'date_hw_decomm' => S_DATE_HW_DECOMM, 'site_street_1' => S_SITE_STREET_1, 'site_street_2' => S_SITE_STREET_2, 'site_street_3' => S_SITE_STREET_3, 'site_city' => S_SITE_CITY, 'site_state' => S_SITE_STATE, 'site_country' => S_SITE_COUNTRY, 'site_zip' => S_SITE_ZIP, 'site_rack' => S_SITE_RACK, 'site_notes' => S_SITE_NOTES, 'poc_1_name' => S_POC_1_NAME, 'poc_1_email' => S_POC_1_EMAIL, 'poc_1_phone_1' => S_POC_1_PHONE_1, 'poc_1_phone_2' => S_POC_1_PHONE_2, 'poc_1_cell' => S_POC_1_CELL, 'poc_1_notes' => S_POC_1_NOTES, 'poc_2_name' => S_POC_2_NAME, 'poc_2_email' => S_POC_2_EMAIL, 'poc_2_phone_1' => S_POC_2_PHONE_1, 'poc_2_phone_2' => S_POC_2_PHONE_2, 'poc_2_cell' => S_POC_2_CELL, 'poc_2_screen' => S_POC_2_SCREEN, 'poc_2_notes' => S_POC_2_NOTES); $sql_fields = implode(', ', array_keys($table_titles)); //generate string of fields to get from DB $result = DBselect('SELECT ' . $sql_fields . ' FROM hosts_profiles_ext WHERE hostid=' . $_REQUEST['hostid']); if ($row = DBfetch($result)) { foreach ($row as $key => $value) { if (!zbx_empty($value)) { $frmHostPA->addRow($table_titles[$key], new CSpan(zbx_str2links($value))); } } } else { $frmHostPA->addSpanRow('Extended Profile for this host is missing', 'form_row_c'); } $frmHostPA->addItemToBottomRow(new CButtonCancel(url_param('groupid') . url_param('prof_type'))); return $frmHostPA; }