public function prepareRow($item, $class = null, $id = null) { if ($item === null) { return null; } if (is_object($item) && strtolower(get_class($item)) === 'ccol') { if (isset($this->header) && !isset($item->attributes['colspan'])) { $item->attributes['colspan'] = $this->colnum; } } if (!is_object($item) || strtolower(get_class($item)) !== 'crow') { $item = new CRow($item); if ($id !== null) { $item->setId($id); } } if ($class !== null) { $item->addClass($class); } return $item; }
public function _getContent($refresh = false) { if (!isset($this->config['sql'])) { return "SQL not set"; } $table = new CTableInfo($this->emptyText); $resultSet = DBselect($this->config['sql']); $result = DbFetchArray($resultSet); if (!empty($this->columns)) { $headers = array(); foreach ($this->columns as $column) { $headers[] = !empty($column['name']) ? $column['name'] : $column['field']; } } else { if (isset($result[0])) { foreach ($result[0] as $key => $value) { $headers[] = $key; $column = array('eval' => false, 'evalClass' => false, 'class' => null, 'width' => null, 'name' => $key, 'value' => $key); $this->columns[] = $column; } } else { $headers[] = "Empty Table"; } } if ($this->headers) { $table->setHeader($headers); } $index = 0; foreach ($result as $row) { $row['index'] = $index++; $crow = new CRow(null, $this->getRowClass($row)); foreach ($this->columns as $column) { $cell = new CCol($this->getValue($column, $row), $this->getClass($column, $row)); $crow->addItem($cell); } $table->addRow($crow); } return $table; }
public function addRow($item1, $item2 = null, $class = null, $id = null) { if (is_object($item1) && zbx_strtolower(get_class($item1)) == 'crow') { } elseif (is_object($item1) && zbx_strtolower(get_class($item1)) == 'ctable') { $td = new CCol($item1, 'form_row_c'); $td->setColSpan(2); $item1 = new CRow($td); } else { if (is_string($item1)) { $item1 = nbsp($item1); } if (empty($item1)) { $item1 = SPACE; } if (empty($item2)) { $item2 = SPACE; } $item1 = new CRow(array(new CCol($item1, 'form_row_l'), new CCol($item2, 'form_row_r')), $class); } if (!is_null($id)) { $item1->attr('id', zbx_formatDomId($id)); } array_push($this->center_items, $item1); return $item1; }
function make_hoststat_summary($filter) { $table = new CTableInfo(_('No host groups found.')); $table->setHeader(array(is_show_all_nodes() ? _('Node') : null, _('Host group'), _('Without problems'), _('With problems'), _('Total'))); // get host groups $groups = API::HostGroup()->get(array('nodeids' => get_current_nodeid(), 'groupids' => $filter['groupids'], 'monitored_hosts' => 1, 'output' => array('groupid', 'name'))); $groups = zbx_toHash($groups, 'groupid'); foreach ($groups as &$group) { $group['nodename'] = get_node_name_by_elid($group['groupid']); } unset($group); CArrayHelper::sort($groups, array(array('field' => 'nodename', 'order' => ZBX_SORT_UP), array('field' => 'name', 'order' => ZBX_SORT_UP))); // get hosts $hosts = API::Host()->get(array('nodeids' => get_current_nodeid(), 'groupids' => zbx_objectValues($groups, 'groupid'), 'hostids' => !empty($filter['hostids']) ? $filter['hostids'] : null, 'monitored_hosts' => true, 'filter' => array('maintenance_status' => $filter['maintenance']), 'output' => array('hostid', 'name'), 'selectGroups' => array('groupid'))); $hosts = zbx_toHash($hosts, 'hostid'); CArrayHelper::sort($hosts, array('name')); // get triggers $triggers = API::Trigger()->get(array('nodeids' => get_current_nodeid(), 'monitored' => true, 'maintenance' => $filter['maintenance'], 'expandData' => true, 'filter' => array('priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE), 'output' => array('triggerid', 'priority'), 'selectHosts' => array('hostid'))); if ($filter['extAck']) { $triggers_unack = API::Trigger()->get(array('nodeids' => get_current_nodeid(), 'monitored' => true, 'maintenance' => $filter['maintenance'], 'withLastEventUnacknowledged' => true, 'selectHosts' => API_OUTPUT_REFER, 'filter' => array('priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE), 'output' => API_OUTPUT_REFER)); $triggers_unack = zbx_toHash($triggers_unack, 'triggerid'); foreach ($triggers_unack as $tunack) { foreach ($tunack['hosts'] as $unack_host) { $hosts_with_unack_triggers[$unack_host['hostid']] = $unack_host['hostid']; } } } $hosts_data = array(); $problematic_host_list = array(); $lastUnack_host_list = array(); $highest_severity = array(); $highest_severity2 = array(); foreach ($triggers as $trigger) { foreach ($trigger['hosts'] as $trigger_host) { if (!isset($hosts[$trigger_host['hostid']])) { continue; } else { $host = $hosts[$trigger_host['hostid']]; } if ($filter['extAck'] && isset($hosts_with_unack_triggers[$host['hostid']])) { if (!isset($lastUnack_host_list[$host['hostid']])) { $lastUnack_host_list[$host['hostid']] = array(); $lastUnack_host_list[$host['hostid']]['host'] = $host['name']; $lastUnack_host_list[$host['hostid']]['hostid'] = $host['hostid']; $lastUnack_host_list[$host['hostid']]['severities'] = array(); $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_DISASTER] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_HIGH] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_AVERAGE] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_WARNING] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_INFORMATION] = 0; $lastUnack_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0; } if (isset($triggers_unack[$trigger['triggerid']])) { $lastUnack_host_list[$host['hostid']]['severities'][$trigger['priority']]++; } foreach ($host['groups'] as $gnum => $group) { if (!isset($highest_severity2[$group['groupid']])) { $highest_severity2[$group['groupid']] = 0; } if ($trigger['priority'] > $highest_severity2[$group['groupid']]) { $highest_severity2[$group['groupid']] = $trigger['priority']; } if (!isset($hosts_data[$group['groupid']])) { $hosts_data[$group['groupid']] = array('problematic' => 0, 'ok' => 0, 'lastUnack' => 0, 'hostids_all' => array(), 'hostids_unack' => array()); } if (!isset($hosts_data[$group['groupid']]['hostids_unack'][$host['hostid']])) { $hosts_data[$group['groupid']]['hostids_unack'][$host['hostid']] = $host['hostid']; $hosts_data[$group['groupid']]['lastUnack']++; } } } if (!isset($problematic_host_list[$host['hostid']])) { $problematic_host_list[$host['hostid']] = array(); $problematic_host_list[$host['hostid']]['host'] = $host['name']; $problematic_host_list[$host['hostid']]['hostid'] = $host['hostid']; $problematic_host_list[$host['hostid']]['severities'] = array(); $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_DISASTER] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_HIGH] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_AVERAGE] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_WARNING] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_INFORMATION] = 0; $problematic_host_list[$host['hostid']]['severities'][TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0; } $problematic_host_list[$host['hostid']]['severities'][$trigger['priority']]++; foreach ($host['groups'] as $gnum => $group) { if (!isset($highest_severity[$group['groupid']])) { $highest_severity[$group['groupid']] = 0; } if ($trigger['priority'] > $highest_severity[$group['groupid']]) { $highest_severity[$group['groupid']] = $trigger['priority']; } if (!isset($hosts_data[$group['groupid']])) { $hosts_data[$group['groupid']] = array('problematic' => 0, 'ok' => 0, 'lastUnack' => 0, 'hostids_all' => array(), 'hostids_unack' => array()); } if (!isset($hosts_data[$group['groupid']]['hostids_all'][$host['hostid']])) { $hosts_data[$group['groupid']]['hostids_all'][$host['hostid']] = $host['hostid']; $hosts_data[$group['groupid']]['problematic']++; } } } } foreach ($hosts as $host) { foreach ($host['groups'] as $group) { if (!isset($groups[$group['groupid']])) { continue; } if (!isset($groups[$group['groupid']]['hosts'])) { $groups[$group['groupid']]['hosts'] = array(); } $groups[$group['groupid']]['hosts'][$host['hostid']] = array('hostid' => $host['hostid']); if (!isset($highest_severity[$group['groupid']])) { $highest_severity[$group['groupid']] = 0; } if (!isset($hosts_data[$group['groupid']])) { $hosts_data[$group['groupid']] = array('problematic' => 0, 'ok' => 0, 'lastUnack' => 0); } if (!isset($problematic_host_list[$host['hostid']])) { $hosts_data[$group['groupid']]['ok']++; } } } foreach ($groups as $group) { if (!isset($hosts_data[$group['groupid']])) { continue; } $group_row = new CRow(); if (is_show_all_nodes()) { $group_row->addItem($group['nodename']); } $name = new CLink($group['name'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=0&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE); $group_row->addItem($name); $group_row->addItem(new CCol($hosts_data[$group['groupid']]['ok'], 'normal')); if ($filter['extAck']) { if ($hosts_data[$group['groupid']]['lastUnack']) { $table_inf = new CTableInfo(); $table_inf->setAttribute('style', 'width: 400px;'); $table_inf->setHeader(array(_('Host'), is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_DISASTER]) ? getSeverityCaption(TRIGGER_SEVERITY_DISASTER) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_HIGH]) ? getSeverityCaption(TRIGGER_SEVERITY_HIGH) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_AVERAGE]) ? getSeverityCaption(TRIGGER_SEVERITY_AVERAGE) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_WARNING]) ? getSeverityCaption(TRIGGER_SEVERITY_WARNING) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_INFORMATION]) ? getSeverityCaption(TRIGGER_SEVERITY_INFORMATION) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_NOT_CLASSIFIED]) ? getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED) : null)); $popup_rows = 0; foreach ($group['hosts'] as $host) { $hostid = $host['hostid']; if (!isset($lastUnack_host_list[$hostid])) { continue; } if ($popup_rows >= ZBX_WIDGET_ROWS) { break; } $popup_rows++; $host_data = $lastUnack_host_list[$hostid]; $r = new CRow(); $r->addItem(new CLink($host_data['host'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=' . $hostid . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE)); foreach ($lastUnack_host_list[$host['hostid']]['severities'] as $severity => $trigger_count) { if (!is_null($filter['severity']) && !isset($filter['severity'][$severity])) { continue; } $r->addItem(new CCol($trigger_count, getSeverityStyle($severity, $trigger_count))); } $table_inf->addRow($r); } $lastUnack_count = new CSpan($hosts_data[$group['groupid']]['lastUnack'], 'pointer red bold'); $lastUnack_count->setHint($table_inf); } else { $lastUnack_count = 0; } } // if hostgroup contains problematic hosts, hint should be built if ($hosts_data[$group['groupid']]['problematic']) { $table_inf = new CTableInfo(); $table_inf->setAttribute('style', 'width: 400px;'); $table_inf->setHeader(array(_('Host'), is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_DISASTER]) ? getSeverityCaption(TRIGGER_SEVERITY_DISASTER) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_HIGH]) ? getSeverityCaption(TRIGGER_SEVERITY_HIGH) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_AVERAGE]) ? getSeverityCaption(TRIGGER_SEVERITY_AVERAGE) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_WARNING]) ? getSeverityCaption(TRIGGER_SEVERITY_WARNING) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_INFORMATION]) ? getSeverityCaption(TRIGGER_SEVERITY_INFORMATION) : null, is_null($filter['severity']) || isset($filter['severity'][TRIGGER_SEVERITY_NOT_CLASSIFIED]) ? getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED) : null)); $popup_rows = 0; foreach ($group['hosts'] as $host) { $hostid = $host['hostid']; if (!isset($problematic_host_list[$hostid])) { continue; } if ($popup_rows >= ZBX_WIDGET_ROWS) { break; } $popup_rows++; $host_data = $problematic_host_list[$hostid]; $r = new CRow(); $r->addItem(new CLink($host_data['host'], 'tr_status.php?groupid=' . $group['groupid'] . '&hostid=' . $hostid . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE)); foreach ($problematic_host_list[$host['hostid']]['severities'] as $severity => $trigger_count) { if (!is_null($filter['severity']) && !isset($filter['severity'][$severity])) { continue; } $r->addItem(new CCol($trigger_count, getSeverityStyle($severity, $trigger_count))); } $table_inf->addRow($r); } $problematic_count = new CSpan($hosts_data[$group['groupid']]['problematic'], 'pointer'); $problematic_count->setHint($table_inf); } else { $problematic_count = 0; } switch ($filter['extAck']) { case EXTACK_OPTION_ALL: $group_row->addItem(new CCol($problematic_count, getSeverityStyle($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic']))); $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']); break; case EXTACK_OPTION_UNACK: $group_row->addItem(new CCol($lastUnack_count, getSeverityStyle(isset($highest_severity2[$group['groupid']]) ? $highest_severity2[$group['groupid']] : 0, $hosts_data[$group['groupid']]['lastUnack']))); $group_row->addItem($hosts_data[$group['groupid']]['lastUnack'] + $hosts_data[$group['groupid']]['ok']); break; case EXTACK_OPTION_BOTH: $unackspan = $lastUnack_count ? new CSpan(array($lastUnack_count, SPACE . _('of') . SPACE)) : null; $group_row->addItem(new CCol(array($unackspan, $problematic_count), getSeverityStyle($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic']))); $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']); break; } $table->addRow($group_row); } $script = new CJSScript(get_js("jQuery('#hat_hoststat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')")); return new CDiv(array($table, $script)); }
$type = new CSpan(_('Uptime'), 'enabled'); $from = dowHrMinToStr($serviceTime['ts_from']); $to = dowHrMinToStr($serviceTime['ts_to'], true); break; case SERVICE_TIME_TYPE_DOWNTIME: $type = new CSpan(_('Downtime'), 'disabled'); $from = dowHrMinToStr($serviceTime['ts_from']); $to = dowHrMinToStr($serviceTime['ts_to'], true); break; case SERVICE_TIME_TYPE_ONETIME_DOWNTIME: $type = new CSpan(_('One-time downtime'), 'disabled'); $from = zbx_date2str(DATE_TIME_FORMAT, $serviceTime['ts_from']); $to = zbx_date2str(DATE_TIME_FORMAT, $serviceTime['ts_to']); break; } $row = new CRow(array(array($type, new CVar('times[' . $i . '][type]', $serviceTime['type']), new CVar('times[' . $i . '][ts_from]', $serviceTime['ts_from']), new CVar('times[' . $i . '][ts_to]', $serviceTime['ts_to']), new CVar('times[' . $i . '][note]', $serviceTime['note'])), $from . ' - ' . $to, htmlspecialchars($serviceTime['note']), new CButton('remove', _('Remove'), 'javascript: removeTime(\'' . $i . '\');', 'link_menu'))); $row->setAttribute('id', 'times_' . $i); $servicesTimeTable->addRow($row); $i++; } $servicesTimeFormList->addRow(_('Service times'), new CDiv($servicesTimeTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // create service time table $serviceTimeTable = new CTable(null, 'formElementTable'); if ($this->data['new_service_time']['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME) { // downtime since if (isset($_REQUEST['new_service_time']['from'])) { $fromYear = getRequest('new_service_time_from_year'); $fromMonth = getRequest('new_service_time_from_month'); $fromDay = getRequest('new_service_time_from_day'); $fromHours = getRequest('new_service_time_from_hour'); $fromMinutes = getRequest('new_service_time_from_minute');
} else { $ack = SPACE; } } if ($row_event['acknowledged'] == 0 && $row_event['value'] == TRIGGER_VALUE_TRUE) { $ack_cb = new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']); } else { $ack_cb = SPACE; } $clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $trigger['triggerid'] . '&eventid=' . $row_event['eventid']); $next_clock = isset($trigger['events'][$enum - 1]) ? $trigger['events'][$enum - 1]['clock'] : time(); $empty_col = new CCol(SPACE); $empty_col->setColSpan(3); $ack_cb_col = new CCol($ack_cb); $ack_cb_col->setColSpan(2); $row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ack_cb_col : null, $status, $clock, zbx_date2age($row_event['clock']), zbx_date2age($next_clock, $row_event['clock']), $config['event_ack_enable'] ? $ack : NULL, is_show_all_nodes() ? SPACE : null, $empty_col), 'odd_row'); $row->setAttribute('data-parentid', $trigger['triggerid']); $row->addStyle('display: none;'); $table->addRow($row); if ($i > $config['event_show_max']) { break; } } } } //----- GO ------ $footer = null; if ($config['event_ack_enable']) { $goBox = new CComboBox('go'); $goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE); // goButton name is necessary!!!
$dependenciesTable->setHeader(array(_('Name'), _('Action'))); foreach ($this->data['dependencies'] as $dependency) { $triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']); $hostNames = array(); foreach ($dependency['hosts'] as $host) { $hostNames[] = CHtml::encode($host['name']); $hostNames[] = ', '; } array_pop($hostNames); if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) { $description = new CLink(array($hostNames, NAME_DELIMITER, CHtml::encode($dependency['description'])), 'triggers.php?form=update&hostid=' . $dependency['hostid'] . '&triggerid=' . $dependency['triggerid']); $description->setAttribute('target', '_blank'); } else { $description = array($hostNames, NAME_DELIMITER, $dependency['description']); } $row = new CRow(array($description, new CButton('remove', _('Remove'), 'javascript: removeDependency(\'' . $dependency['triggerid'] . '\');', 'link_menu'))); $row->setAttribute('id', 'dependency_' . $dependency['triggerid']); $dependenciesTable->addRow($row); } $dependenciesDiv = new CDiv(array($dependenciesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?' . 'dstfrm=massupdate' . '&dstact=add_dependency' . '&reference=deptrigger' . '&dstfld1=new_dependency' . '&srctbl=triggers' . '&objname=triggers' . '&srcfld1=triggerid' . '&multiselect=1' . '&with_triggers=1", 1000, 700);', 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all'); $dependenciesDiv->setAttribute('id', 'dependencies_div'); $triggersFormList->addRow(array(_('Replace dependencies'), SPACE, new CVisibilityBox('visible[dependencies]', isset($this->data['visible']['dependencies']), 'dependencies_div', _('Original'))), $dependenciesDiv); } // append tabs to form $triggersTab = new CTabView(); $triggersTab->addTab('triggersTab', _('Mass update'), $triggersFormList); $triggersForm->addItem($triggersTab); // append buttons to form $triggersForm->addItem(makeFormFooter(new CSubmit('massupdate', _('Update')), new CButtonCancel(url_params(array('groupid', 'hostid', 'parent_discoveryid'))))); $triggersWidget->addItem($triggersForm); return $triggersWidget;
<!DOCTYPE html> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <html> <body> <?php echo "Test for PHP-DAO insert method"; $db = new Counter(); $db->open(); $row = new CRow(); echo "<br> PASSED: new CRow"; $row->addColumn("name", "test"); echo "<br> PASSED: row->addColumn"; $db->insert("person", $row); echo "<br> PASSED: row->insert"; $rows = new CRows(); echo "<br> PASSED: CRows"; echo "<br> size:"; print $rows->size(); echo "<br> PASSED: rows->size()"; $rows->pushBack($row); echo "<br> PASSED: rows->pushBack()"; echo "<br> size:"; print $rows->size(); $db->read($rows); echo "<br> PASSED: data accessor read"; $it = $rows->createIterator(); echo "<br> PASSED: createIterator"; for ($it->first(); !$it->isDone(); $it->next()) { $row_it = $it->currentItem(); echo "<br> ";
function getPermissionsFormList($rights = array(), $user_type = USER_TYPE_ZABBIX_USER, $rightsFormList = null) { // group $lists['group']['label'] = _('Host groups'); $lists['group']['read_write'] = new CListBox('groups_write', null, 15); $lists['group']['read_only'] = new CListBox('groups_read', null, 15); $lists['group']['deny'] = new CListBox('groups_deny', null, 15); $groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY); foreach ($groups as $group) { switch ($group['permission']) { case PERM_READ: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } $lists['group'][$list_name]->addItem($group['groupid'], $group['name']); } unset($groups); // host $lists['host']['label'] = _('Hosts'); $lists['host']['read_write'] = new CListBox('hosts_write', null, 15); $lists['host']['read_only'] = new CListBox('hosts_read', null, 15); $lists['host']['deny'] = new CListBox('hosts_deny', null, 15); $hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY); foreach ($hosts as $host) { switch ($host['permission']) { case PERM_READ: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } if (HOST_STATUS_PROXY_ACTIVE == $host['status'] || HOST_STATUS_PROXY_PASSIVE == $host['status']) { $host['host_name'] = $host['host']; } $lists['host'][$list_name]->addItem($host['hostid'], $host['host_name']); } unset($hosts); // display if (empty($rightsFormList)) { $rightsFormList = new CFormList('rightsFormList'); } $isHeaderDisplayed = false; foreach ($lists as $list) { $sLabel = ''; $row = new CRow(); foreach ($list as $class => $item) { if (is_string($item)) { $sLabel = $item; } else { $row->addItem(new CCol($item, $class)); } } $table = new CTable(_('No accessible resources'), 'right_table calculated'); if (!$isHeaderDisplayed) { $table->setHeader(array(_('Read-write'), _('Read only'), _('Deny')), 'header'); $isHeaderDisplayed = true; } $table->addRow($row); $rightsFormList->addRow($sLabel, $table); } return $rightsFormList; }
function make_system_status($filter, $backurl) { $config = select_config(); $table = new CTableInfo(); // set trigger severities as table header starting from highest severity $header = []; for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) { $header[] = $filter['severity'] === null || isset($filter['severity'][$severity]) ? getSeverityName($severity, $config) : null; } krsort($header); array_unshift($header, _('Host group')); $table->setHeader($header); // get host groups $groups = API::HostGroup()->get(['groupids' => $filter['groupids'], 'hostids' => isset($filter['hostids']) ? $filter['hostids'] : null, 'monitored_hosts' => true, 'output' => ['groupid', 'name'], 'preservekeys' => true]); CArrayHelper::sort($groups, [['field' => 'name', 'order' => ZBX_SORT_UP]]); $groupIds = []; foreach ($groups as $group) { $groupIds[$group['groupid']] = $group['groupid']; $group['tab_priority'] = [TRIGGER_SEVERITY_DISASTER => ['count' => 0, 'triggers' => [], 'count_unack' => 0, 'triggers_unack' => []], TRIGGER_SEVERITY_HIGH => ['count' => 0, 'triggers' => [], 'count_unack' => 0, 'triggers_unack' => []], TRIGGER_SEVERITY_AVERAGE => ['count' => 0, 'triggers' => [], 'count_unack' => 0, 'triggers_unack' => []], TRIGGER_SEVERITY_WARNING => ['count' => 0, 'triggers' => [], 'count_unack' => 0, 'triggers_unack' => []], TRIGGER_SEVERITY_INFORMATION => ['count' => 0, 'triggers' => [], 'count_unack' => 0, 'triggers_unack' => []], TRIGGER_SEVERITY_NOT_CLASSIFIED => ['count' => 0, 'triggers' => [], 'count_unack' => 0, 'triggers_unack' => []]]; $groups[$group['groupid']] = $group; } // get triggers $triggers = API::Trigger()->get(['output' => ['triggerid', 'priority', 'state', 'description', 'error', 'value', 'lastchange', 'expression'], 'selectGroups' => ['groupid'], 'selectHosts' => ['name'], 'selectLastEvent' => ['eventid', 'acknowledged', 'objectid', 'clock', 'ns'], 'withLastEventUnacknowledged' => $filter['extAck'] == EXTACK_OPTION_UNACK ? true : null, 'skipDependent' => true, 'groupids' => $groupIds, 'hostids' => isset($filter['hostids']) ? $filter['hostids'] : null, 'monitored' => true, 'maintenance' => $filter['maintenance'], 'search' => $filter['trigger_name'] !== '' ? ['description' => $filter['trigger_name']] : null, 'filter' => ['priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE], 'sortfield' => 'lastchange', 'sortorder' => ZBX_SORT_DOWN, 'preservekeys' => true]); $eventIds = []; foreach ($triggers as $triggerId => $trigger) { if ($trigger['lastEvent']) { $eventIds[$trigger['lastEvent']['eventid']] = $trigger['lastEvent']['eventid']; } $triggers[$triggerId]['event'] = $trigger['lastEvent']; unset($triggers[$triggerId]['lastEvent']); } // get acknowledges if ($eventIds) { $eventAcknowledges = API::Event()->get(['output' => ['eventid'], 'eventids' => $eventIds, 'select_acknowledges' => ['eventid', 'clock', 'message', 'alias', 'name', 'surname'], 'preservekeys' => true]); } // actions $actions = makeEventsActions($eventIds); // triggers foreach ($triggers as $trigger) { // event if ($trigger['event']) { $trigger['event']['acknowledges'] = isset($eventAcknowledges[$trigger['event']['eventid']]) ? $eventAcknowledges[$trigger['event']['eventid']]['acknowledges'] : 0; } else { $trigger['event'] = ['acknowledged' => false, 'clock' => $trigger['lastchange'], 'ns' => '999999999', 'value' => $trigger['value']]; } // groups foreach ($trigger['groups'] as $group) { if (!isset($groups[$group['groupid']])) { continue; } if (in_array($filter['extAck'], [EXTACK_OPTION_ALL, EXTACK_OPTION_BOTH])) { if ($groups[$group['groupid']]['tab_priority'][$trigger['priority']]['count'] < ZBX_WIDGET_ROWS) { $groups[$group['groupid']]['tab_priority'][$trigger['priority']]['triggers'][] = $trigger; } $groups[$group['groupid']]['tab_priority'][$trigger['priority']]['count']++; } if (in_array($filter['extAck'], [EXTACK_OPTION_UNACK, EXTACK_OPTION_BOTH]) && isset($trigger['event']) && !$trigger['event']['acknowledged']) { if ($groups[$group['groupid']]['tab_priority'][$trigger['priority']]['count_unack'] < ZBX_WIDGET_ROWS) { $groups[$group['groupid']]['tab_priority'][$trigger['priority']]['triggers_unack'][] = $trigger; } $groups[$group['groupid']]['tab_priority'][$trigger['priority']]['count_unack']++; } } } unset($triggers); foreach ($groups as $group) { $groupRow = new CRow(); $name = new CLink($group['name'], 'tr_status.php?filter_set=1&groupid=' . $group['groupid'] . '&hostid=0' . '&show_triggers=' . TRIGGERS_OPTION_RECENT_PROBLEM); $groupRow->addItem($name); foreach ($group['tab_priority'] as $severity => $data) { if (!is_null($filter['severity']) && !isset($filter['severity'][$severity])) { continue; } $allTriggersNum = $data['count']; if ($allTriggersNum) { $allTriggersNum = (new CSpan($allTriggersNum))->addClass(ZBX_STYLE_LINK_ACTION)->setHint(makeTriggersPopup($data['triggers'], $backurl, $actions, $config)); } $unackTriggersNum = $data['count_unack']; if ($unackTriggersNum) { $unackTriggersNum = (new CSpan($unackTriggersNum))->addClass(ZBX_STYLE_LINK_ACTION)->setHint(makeTriggersPopup($data['triggers_unack'], $backurl, $actions, $config)); } switch ($filter['extAck']) { case EXTACK_OPTION_ALL: $groupRow->addItem(getSeverityCell($severity, $config, $allTriggersNum, $data['count'] == 0)); break; case EXTACK_OPTION_UNACK: $groupRow->addItem(getSeverityCell($severity, $config, $unackTriggersNum, $data['count_unack'] == 0)); break; case EXTACK_OPTION_BOTH: if ($data['count_unack'] != 0) { $groupRow->addItem(getSeverityCell($severity, $config, [$unackTriggersNum, ' ' . _('of') . ' ', $allTriggersNum])); } else { $groupRow->addItem(getSeverityCell($severity, $config, $allTriggersNum, $data['count'] == 0)); } break; } } $table->addRow($groupRow); } return $table; }
$form->addVar('new_check_snmpv3_privpassphrase', ''); break; case SVC_SNMPv3: $form->addVar('new_check_snmp_community', ''); $external_param->addRow(array(S_SNMP_OID, new CTextBox('new_check_key', $new_check_key))); $external_param->addRow(array(S_SNMPV3_SECURITY_NAME, new CTextBox('new_check_snmpv3_securityname', $new_check_snmpv3_securityname))); $cmbSecLevel = new CComboBox('new_check_snmpv3_securitylevel', $new_check_snmpv3_securitylevel); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV, 'noAuthNoPriv'); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, 'authNoPriv'); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, 'authPriv'); $external_param->addRow(array(S_SNMPV3_SECURITY_LEVEL, $cmbSecLevel)); // adding id to <tr> elements so they could be then hidden by cviewswitcher.js $row = new CRow(array(S_SNMPV3_AUTH_PASSPHRASE, new CTextBox('new_check_snmpv3_authpassphrase', $new_check_snmpv3_authpassphrase))); $row->setAttribute('id', 'row_snmpv3_authpassphrase'); $external_param->addRow($row); $row = new CRow(array(S_SNMPV3_PRIV_PASSPHRASE, new CTextBox('new_check_snmpv3_privpassphrase', $new_check_snmpv3_privpassphrase))); $row->setAttribute('id', 'row_snmpv3_privpassphrase'); $external_param->addRow($row); break; case SVC_AGENT: $form->addVar('new_check_snmp_community', ''); $form->addVar('new_check_snmpv3_securitylevel', ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV); $form->addVar('new_check_snmpv3_securityname', ''); $form->addVar('new_check_snmpv3_authpassphrase', ''); $form->addVar('new_check_snmpv3_privpassphrase', ''); $external_param->addRow(array(S_KEY, new CTextBox('new_check_key', $new_check_key), BR())); break; case SVC_ICMPPING: $form->addVar('new_check_ports', '0'); default: $form->addVar('new_check_snmp_community', '');
private function makeSImgStr($id) { $tr = new CRow(); $count = isset($this->tree[$id]['nodeimg']) ? strlen($this->tree[$id]['nodeimg']) : 0; for ($i = 0; $i < $count; $i++) { $td = new CCol(); $img = null; switch ($this->tree[$id]['nodeimg'][$i]) { case 'O': $img = new CImg('images/general/tree/zero.gif', 'o', '22', '14'); break; case 'I': $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);'); $img = new CImg('images/general/tree/zero.gif', 'i', '22', '14'); break; case 'L': $td->setAttribute('valign', 'top'); $div = new CTag('div', 'yes'); $div->setAttribute('style', 'height: 10px; background-image: url(images/general/tree/pointc.gif);'); if ($this->tree[$id]['nodetype'] == 2) { $img = new CImg('images/general/tree/plus.gif', 'y', '22', '14'); $img->setAttribute('onclick', $this->treename . '.closeSNodeX("' . $id . '", this);'); $img->setAttribute('id', 'idi_' . $id); $img->setAttribute('class', 'pointer'); } else { $img = new CImg('images/general/tree/pointl.gif', 'y', '22', '14'); } $div->addItem($img); $img = $div; break; case 'T': $td->setAttribute('valign', 'top'); if ($this->tree[$id]['nodetype'] == 2) { $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);'); $img = new CImg('images/general/tree/plus.gif', 't', '22', '14'); $img->setAttribute('onclick', $this->treename . '.closeSNodeX("' . $id . '", this);'); $img->setAttribute('id', 'idi_' . $id); $img->setAttribute('class', 'pointer'); $img->setAttribute('style', 'top: 1px; position: relative;'); } else { $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);'); $img = new CImg('images/general/tree/pointl.gif', 't', '22', '14'); } break; } $td->addItem($img); $tr->addItem($td); } return $tr; }
// info if ($item['status'] == ITEM_STATUS_ACTIVE && $item['error'] !== '') { $info = new CDiv(null, 'status_icon iconerror'); $info->setHint($item['error'], 'on'); } else { $info = ''; } // trend value if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $item['value_type'] == ITEM_VALUE_TYPE_UINT64) { $trendValue = $config['hk_trends_global'] ? $config['hk_trends'] : $item['trends']; } else { $trendValue = UNKNOWN_VALUE; } $row = new CRow(array('', $checkbox, $hostColumn, new CCol(new CDiv(array($item['name_expanded'], BR(), $itemKey), $stateCss . ' item')), new CCol(new CSpan($item['type'] == ITEM_TYPE_SNMPTRAP || $item['type'] == ITEM_TYPE_TRAPPER ? UNKNOWN_VALUE : $item['delay'], $stateCss)), new CCol(new CSpan($config['hk_history_global'] ? $config['hk_history'] : $item['history'], $stateCss)), new CCol(new CSpan($trendValue, $stateCss)), new CCol(new CSpan(item_type2str($item['type']), $stateCss)), new CCol(new CSpan($lastClock, $stateCss)), new CCol(new CSpan($lastValue, $stateCss)), new CCol(new CSpan($change, $stateCss)), new CCol($actions, $stateCss), $info)); } else { $row = new CRow(array('', $checkbox, $hostColumn, new CCol(new CSpan($item['name_expanded'], $stateCss . ' item')), new CCol(new CSpan($lastClock, $stateCss)), new CCol(new CSpan($lastValue, $stateCss)), new CCol(new CSpan($change, $stateCss)), new CCol($actions, $stateCss))); } $hosts[$item['hostid']]['item_cnt']++; $tab_rows[$item['hostid']][] = $row; } foreach ($hosts as $hostId => $dbHost) { $host = $hosts[$dbHost['hostid']]; if (!isset($tab_rows[$hostId])) { continue; } $appRows = $tab_rows[$hostId]; $openState = CProfile::get('web.latest.toggle_other', null, $host['hostid']); $toggle = new CDiv(null, 'app-list-toggle icon-plus-9x9'); if ($openState) { $toggle->addClass('icon-minus-9x9'); }
$numSpan = new CSpan($i++ . ':'); $numSpan->addClass('rowNum'); $numSpan->setAttribute('id', 'current_step_' . $stepid); $name = new CSpan($step['name'], 'link'); $name->setAttribute('id', 'name_' . $stepid); $name->setAttribute('name_step', $stepid); $name->onClick('return PopUp("popup_httpstep.php?dstfrm=' . $httpForm->getName() . '&list_name=steps&stepid="+jQuery(this).attr("name_step")+"' . url_param($step['name'], false, 'name') . url_param($step['timeout'], false, 'timeout') . url_param($step['url'], false, 'url') . url_param($step['posts'], false, 'posts') . url_param($step['required'], false, 'required') . url_param($step['status_codes'], false, 'status_codes') . '", 600, 410);'); if (zbx_strlen($step['url']) > 70) { $url = new CSpan(substr($step['url'], 0, 35) . SPACE . '...' . SPACE . substr($step['url'], zbx_strlen($step['url']) - 25, 25)); $url->setHint($step['url']); } else { $url = $step['url']; } $removeButton = new CButton('remove_' . $stepid, _('Remove'), 'javascript: removeStep(this);', 'link_menu'); $removeButton->setAttribute('remove_step', $stepid); $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $name, $step['timeout'] . SPACE . _('sec'), $url, htmlspecialchars($step['required']), $step['status_codes'], $removeButton), 'sortable'); $row->setAttribute('id', 'steps_' . $stepid); $stepsTable->addRow($row); } $tmpColumn = new CCol(new CButton('add_step', _('Add'), 'return PopUp("popup_httpstep.php?dstfrm=' . $httpForm->getName() . '", 600, 410);', 'link_menu'), null, 8); $tmpColumn->setAttribute('style', 'vertical-align: middle;'); $stepsTable->addRow(new CRow($tmpColumn)); $httpStepFormList->addRow(_('Steps'), new CDiv($stepsTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append tabs to form $httpTab = new CTabView(array('remember' => true)); if (!$this->data['form_refresh']) { $httpTab->setSelected(0); } $httpTab->addTab('scenarioTab', _('Scenario'), $httpFormList); $httpTab->addTab('stepTab', _('Steps'), $httpStepFormList); $httpForm->addItem($httpTab);
$proxyComboBox->addItem($proxie['hostid'], $proxie['host']); } $hostFormList->addRow(array(_('Monitored by proxy'), SPACE, new CVisibilityBox('visible[proxy_hostid]', isset($this->data['visible']['proxy_hostid']), 'proxy_hostid', _('Original'))), $proxyComboBox); // append status to form list $statusComboBox = new CComboBox('status', $this->data['status']); $statusComboBox->addItem(HOST_STATUS_MONITORED, _('Monitored')); $statusComboBox->addItem(HOST_STATUS_NOT_MONITORED, _('Not monitored')); $hostFormList->addRow(array(_('Status'), SPACE, new CVisibilityBox('visible[status]', isset($this->data['visible']['status']), 'status', _('Original'))), $statusComboBox); // append templates table to from list $templatesTable = new CTable(_('No templates defined.'), 'formElementTable'); $templatesTable->setAttribute('style', 'min-width: 500px;'); $templatesTable->setAttribute('id', 'template_table'); $templatesTable->setHeader(array(_('Name'), _('Action'))); foreach ($this->data['templates'] as $templateid => $templateName) { $hostForm->addVar('templates[' . $templateid . ']', $templateName); $row = new CRow(array($templateName, new CButton('remove', _('Remove'), 'javascript: removeTemplate("' . $templateid . '");', 'link_menu'))); $row->setAttribute('id', 'template_row_' . $templateid); $templatesTable->addRow($row); } $templatesDiv = new CDiv(array($templatesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?srctbl=templates&srcfld1=hostid&srcfld2=host' . '&dstfrm=' . $hostForm->getName() . '&dstfld1=new_template&templated_hosts=1' . url_param($this->data['templates'], false, 'existed_templates') . '", 450, 450)', 'link_menu'), BR(), BR(), new CCheckBox('mass_replace_tpls', $this->data['mass_replace_tpls']), SPACE, _('Replace'), BR(), new CCheckBox('mass_clear_tpls', $this->data['mass_clear_tpls']), SPACE, _('Clear when unlinking')), 'objectgroup inlineblock border_dotted ui-corner-all'); $templatesDiv->setAttribute('id', 'templates_div'); $hostFormList->addRow(array(_('Link templates'), SPACE, new CVisibilityBox('visible[template_table]', !empty($this->data['visible']['template_table']) ? 'yes' : 'no', 'templates_div', _('Original'))), $templatesDiv); // append ipmi to form list $ipmiAuthtypeComboBox = new CComboBox('ipmi_authtype', $this->data['ipmi_authtype']); $ipmiAuthtypeComboBox->addItems(ipmiAuthTypes()); $hostFormList->addRow(array(_('IPMI authentication algorithm'), SPACE, new CVisibilityBox('visible[ipmi_authtype]', isset($this->data['visible']['ipmi_authtype']), 'ipmi_authtype', _('Original'))), $ipmiAuthtypeComboBox); $ipmiPrivilegeComboBox = new CComboBox('ipmi_privilege', $this->data['ipmi_privilege']); $ipmiPrivilegeComboBox->addItems(ipmiPrivileges()); $hostFormList->addRow(array(_('IPMI privilege level'), SPACE, new CVisibilityBox('visible[ipmi_privilege]', isset($this->data['visible']['ipmi_privilege']), 'ipmi_privilege', _('Original'))), $ipmiPrivilegeComboBox); $hostFormList->addRow(array(_('IPMI username'), SPACE, new CVisibilityBox('visible[ipmi_username]', isset($this->data['visible']['ipmi_username']), 'ipmi_username', _('Original'))), new CTextBox('ipmi_username', $this->data['ipmi_username'], ZBX_TEXTBOX_SMALL_SIZE)); $hostFormList->addRow(array(_('IPMI password'), SPACE, new CVisibilityBox('visible[ipmi_password]', isset($this->data['visible']['ipmi_password']), 'ipmi_password', _('Original'))), new CTextBox('ipmi_password', $this->data['ipmi_password'], ZBX_TEXTBOX_SMALL_SIZE));
function show_history($itemid, $from, $stime, $period) { //$till=date(S_DATE_FORMAT_YMDHMS,time(NULL)-$from*3600); //show_table_header(S_TILL.SPACE.$till.' ( '.zbx_date2age($stime,$stime+$period).' )'); $td = new CCol(get_js_sizeable_graph('graph', 'chart.php?itemid=' . $itemid . url_param($from, false, 'from') . url_param($stime, false, 'stime') . url_param($period, false, 'period'))); $td->setAttribute('align', 'center'); $tr = new CRow($td); $tr->setAttribute('bgcolor', '#dddddd'); $table = new CTable(); $table->setAttribute('width', '100%'); $table->setAttribute('bgcolor', '#cccccc'); $table->setAttribute('cellspacing', '1'); $table->setAttribute('cellpadding', '3'); $table->addRow($tr); $table->show(); }
// table for JMX interfaces with footer $ifTab = new CTable(null, 'formElementTable'); $ifTab->setAttribute('id', 'JMXInterfaces'); $ifTab->setAttribute('data-type', 'jmx'); $row = new CRow(null, null, 'JMXIterfacesFooter'); if (!isset($existingInterfaceTypes[INTERFACE_TYPE_JMX])) { $row->addItem(new CCol(null, 'interface-drag-control')); $row->addItem(new CCol(_('No JMX interfaces found.'), null, 5)); } $ifTab->addRow($row); $hostList->addRow(_('JMX interfaces'), new CDiv($ifTab, 'border_dotted objectgroup interface-group'), false, null, 'interface-row'); // table for IPMI interfaces with footer $ifTab = new CTable(null, 'formElementTable'); $ifTab->setAttribute('id', 'IPMIInterfaces'); $ifTab->setAttribute('data-type', 'ipmi'); $row = new CRow(null, null, 'IPMIIterfacesFooter'); if (!isset($existingInterfaceTypes[INTERFACE_TYPE_IPMI])) { $row->addItem(new CCol(null, 'interface-drag-control')); $row->addItem(new CCol(_('No IPMI interfaces found.'), null, 5)); } $ifTab->addRow($row); $hostList->addRow(_('IPMI interfaces'), new CDiv($ifTab, 'border_dotted objectgroup interface-group'), false, null, 'interface-row interface-row-last'); } // Proxy if (!$isDiscovered) { $proxyControl = new CComboBox('proxy_hostid', $proxy_hostid); $proxyControl->addItem(0, _('(no proxy)')); $db_proxies = API::Proxy()->get(array('output' => API_OUTPUT_EXTEND)); order_result($db_proxies, 'host'); foreach ($db_proxies as $proxy) { $proxyControl->addItem($proxy['proxyid'], $proxy['host']);
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $output = array(); $stime = zbxDateToTime($this->timeline['stime']); $iv_string = array(ITEM_VALUE_TYPE_LOG => 1, ITEM_VALUE_TYPE_TEXT => 1); $iv_numeric = array(ITEM_VALUE_TYPE_FLOAT => 1, ITEM_VALUE_TYPE_UINT64 => 1); if ($this->action == 'showvalues' || $this->action == 'showlatest') { $options = array('history' => $this->item['value_type'], 'itemids' => array_keys($this->items), 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN); if ($this->action == 'showlatest') { $options['limit'] = 500; } elseif ($this->action == 'showvalues') { $config = select_config(); $options['time_from'] = $stime - 10; // some seconds to allow script to execute $options['time_till'] = $stime + $this->timeline['period']; $options['limit'] = $config['search_limit']; } // text log if (isset($iv_string[$this->item['value_type']])) { $isManyItems = count($this->items) > 1; $useLogItem = $this->item['value_type'] == ITEM_VALUE_TYPE_LOG; $useEventLogItem = strpos($this->item['key_'], 'eventlog[') === 0; if (empty($this->plaintext)) { $historyTable = new CTableInfo(_('No values found.')); $historyTable->setHeader(array(_('Timestamp'), $isManyItems ? _('Item') : null, $useLogItem ? _('Local time') : null, $useEventLogItem && $useLogItem ? _('Source') : null, $useEventLogItem && $useLogItem ? _('Severity') : null, $useEventLogItem && $useLogItem ? _('Event ID') : null, _('Value')), 'header'); } if (!zbx_empty($this->filter) && in_array($this->filterTask, array(FILTER_TASK_SHOW, FILTER_TASK_HIDE))) { $options['search'] = array('value' => $this->filter); if ($this->filterTask == FILTER_TASK_HIDE) { $options['excludeSearch'] = 1; } } $options['sortfield'] = 'id'; $historyData = API::History()->get($options); foreach ($historyData as $data) { $data['value'] = encode_log(trim($data['value'], "\r\n")); if (empty($this->plaintext)) { $item = $this->items[$data['itemid']]; $host = reset($item['hosts']); $color = null; if (isset($this->filter) && !zbx_empty($this->filter)) { $contain = zbx_stristr($data['value'], $this->filter); if ($contain && $this->filterTask == FILTER_TASK_MARK) { $color = $this->markColor; } if (!$contain && $this->filterTask == FILTER_TASK_INVERT_MARK) { $color = $this->markColor; } switch ($color) { case MARK_COLOR_RED: $color = 'red'; break; case MARK_COLOR_GREEN: $color = 'green'; break; case MARK_COLOR_BLUE: $color = 'blue'; break; } } $row = array(nbsp(zbx_date2str(_('Y.M.d H:i:s'), $data['clock']))); if ($isManyItems) { $row[] = $host['name'] . NAME_DELIMITER . $item['name_expanded']; } if ($useLogItem) { $row[] = $data['timestamp'] == 0 ? '-' : zbx_date2str(HISTORY_LOG_LOCALTIME_DATE_FORMAT, $data['timestamp']); // if this is a eventLog item, showing additional info if ($useEventLogItem) { $row[] = zbx_empty($data['source']) ? '-' : $data['source']; $row[] = $data['severity'] == 0 ? '-' : new CCol(get_item_logtype_description($data['severity']), get_item_logtype_style($data['severity'])); $row[] = $data['logeventid'] == 0 ? '-' : $data['logeventid']; } } $row[] = new CCol($data['value'], 'pre'); $newRow = new CRow($row); if (!is_null($color)) { $newRow->setAttribute('class', $color); } $historyTable->addRow($newRow); } else { $output[] = zbx_date2str(HISTORY_LOG_ITEM_PLAINTEXT, $data['clock']); $output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($data['value']) . "\n"; } } if (empty($this->plaintext)) { $output[] = $historyTable; } } else { if (empty($this->plaintext)) { $historyTable = new CTableInfo(_('No values found.')); $historyTable->setHeader(array(_('Timestamp'), _('Value'))); } $options['sortfield'] = array('itemid', 'clock'); $historyData = API::History()->get($options); foreach ($historyData as $data) { $item = $this->items[$data['itemid']]; $value = $data['value']; // format the value as float if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT) { sscanf($data['value'], '%f', $value); } // html table if (empty($this->plaintext)) { if ($item['valuemapid']) { $value = applyValueMap($value, $item['valuemapid']); } $historyTable->addRow(array(zbx_date2str(HISTORY_ITEM_DATE_FORMAT, $data['clock']), zbx_nl2br($value))); } else { $output[] = zbx_date2str(HISTORY_PLAINTEXT_DATE_FORMAT, $data['clock']); $output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($value) . "\n"; } } if (empty($this->plaintext)) { $output[] = $historyTable; } } } if ($this->action == 'showgraph' && !isset($iv_string[$this->item['value_type']])) { $this->dataId = 'historyGraph'; $containerId = 'graph_cont1'; $src = 'chart.php?itemid=' . $this->item['itemid'] . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stime'] . $this->getProfileUrlParams(); $output[] = new CDiv(null, 'center', $containerId); } // time control if (!$this->plaintext && str_in_array($this->action, array('showvalues', 'showgraph'))) { $graphDims = getGraphDims(); $this->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($this->item['itemid'])); $timeControlData = array('periodFixed' => CProfile::get('web.history.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD); if (!empty($this->dataId)) { $timeControlData['id'] = $this->getDataId(); $timeControlData['containerid'] = $containerId; $timeControlData['src'] = $src; $timeControlData['objDims'] = $graphDims; $timeControlData['loadSBox'] = 1; $timeControlData['loadImage'] = 1; $timeControlData['dynamic'] = 1; } else { $this->dataId = 'historyGraph'; $timeControlData['id'] = $this->getDataId(); $timeControlData['mainObject'] = 1; } if ($this->mode == SCREEN_MODE_JS) { $timeControlData['dynamic'] = 0; return 'timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'; } else { zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'); } } if (!empty($this->plaintext)) { return $output; } else { if ($this->mode != SCREEN_MODE_JS) { $flickerfreeData = array('itemids' => $this->itemids, 'action' => $this->action, 'filter' => $this->filter, 'filterTask' => $this->filterTask, 'markColor' => $this->markColor); return $this->getOutput($output, true, $flickerfreeData); } } }
} $itemFormList->addRow(_('Update interval (in sec)'), new CNumericBox('delay', $this->data['delay'], 5), false, 'row_delay'); // append delay flex to form list $delayFlexTable = new CTable(_('No flexible intervals defined.'), 'formElementTable'); $delayFlexTable->setAttribute('style', 'min-width: 310px;'); $delayFlexTable->setAttribute('id', 'delayFlexTable'); $delayFlexTable->setHeader(array(_('Interval'), _('Period'), _('Action'))); $i = 0; $this->data['maxReached'] = false; foreach ($this->data['delay_flex'] as $delayFlex) { if (!isset($delayFlex['delay']) && !isset($delayFlex['period'])) { continue; } $itemForm->addVar('delay_flex[' . $i . '][delay]', $delayFlex['delay']); $itemForm->addVar('delay_flex[' . $i . '][period]', $delayFlex['period']); $row = new CRow(array($delayFlex['delay'], $delayFlex['period'], new CButton('remove', _('Remove'), 'javascript: removeDelayFlex(' . $i . ');', 'link_menu'))); $row->setAttribute('id', 'delayFlex_' . $i); $delayFlexTable->addRow($row); // limit count of intervals, 7 intervals by 30 symbols = 210 characters, db storage field is 256 $i++; if ($i == 7) { $this->data['maxReached'] = true; break; } } $itemFormList->addRow(_('Flexible intervals'), new CDiv($delayFlexTable, 'objectgroup inlineblock border_dotted ui-corner-all'), false, 'row_flex_intervals'); // append new flexible interval to form list $newFlexInt = new CSpan(array(_('Interval (in sec)'), SPACE, new CNumericBox('new_delay_flex[delay]', $this->data['new_delay_flex']['delay'], 5, 'no', false, false), SPACE, _('Period'), SPACE, new CTextBox('new_delay_flex[period]', $this->data['new_delay_flex']['period'], 20), SPACE, new CButton('add_delay_flex', _('Add'), null, 'formlist'))); $newFlexInt->setAttribute('id', 'row-new-delay-flex-fields'); $maxFlexMsg = new CSpan(_('Maximum number of flexible intervals added'), 'red'); $maxFlexMsg->setAttribute('id', 'row-new-delay-flex-max-reached');
switch ($config) { default: case 1: $rep_form = valueDistributionFormForMultiplePeriods($validItems); break; case 2: $rep_form = valueDistributionFormForMultipleItems($validItems, $validPeriods); break; case 3: $rep_form = valueComparisonFormForMultiplePeriods(); break; } $rep6_wdgt->addFlicker($rep_form, CProfile::get('web.report6.filter.state', 1)); if (isset($_REQUEST['report_show'])) { $items = $config == 3 ? array(array('itemid' => get_request('itemid'))) : get_request('items'); if ($isValid && ($config != 3 ? $validItems : true) && ($config == 2 ? $validPeriods : true)) { $src = 'chart_bar.php?' . 'config=' . $config . url_param('title') . url_param('xlabel') . url_param('ylabel') . url_param('scaletype') . url_param('avgperiod') . url_param('showlegend') . url_param('sorttype') . url_param('report_timesince') . url_param('report_timetill') . url_param('periods') . url_param($items, false, 'items') . url_param('hostids') . url_param('groupids') . url_param('palette') . url_param('palettetype'); $rep_tab->addRow(new CImg($src, 'report')); } } $outer_table = new CTable(); $outer_table->setAttribute('border', 0); $outer_table->setAttribute('width', '100%'); $outer_table->setCellPadding(1); $outer_table->setCellSpacing(1); $tmp_row = new CRow($rep_tab); $tmp_row->setAttribute('align', 'center'); $outer_table->addRow($tmp_row); $rep6_wdgt->addItem($outer_table); $rep6_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
if (!isset($highest_severity[$group['groupid']])) { $highest_severity[$group['groupid']] = 0; } if (!isset($hosts_data[$group['groupid']])) { $hosts_data[$group['groupid']] = ['problematic' => 0, 'ok' => 0, 'lastUnack' => 0]; } if (!isset($problematic_host_list[$host['hostid']])) { $hosts_data[$group['groupid']]['ok']++; } } } foreach ($groups as $group) { if (!isset($hosts_data[$group['groupid']])) { continue; } $group_row = new CRow(); $name = new CLink($group['name'], 'tr_status.php?filter_set=1&groupid=' . $group['groupid'] . '&hostid=0' . '&show_triggers=' . TRIGGERS_OPTION_RECENT_PROBLEM); $group_row->addItem($name); $group_row->addItem((new CCol($hosts_data[$group['groupid']]['ok']))->addClass(ZBX_STYLE_NORMAL_BG)); if ($data['filter']['extAck']) { if ($hosts_data[$group['groupid']]['lastUnack']) { $table_inf = new CTableInfo(); // set trigger severities as table header starting from highest severity $header = []; for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) { $header[] = $data['filter']['severity'] === null || isset($data['filter']['severity'][$severity]) ? getSeverityName($severity, $data['config']) : null; } krsort($header); array_unshift($header, _('Host')); $table_inf->setHeader($header); $popup_rows = 0;
function get_test_result(&$result, $test_name, $test_value, $condition, $fail_message) { $result &= $condition; $row = new CRow(array($test_name, $test_value, $condition ? new CSpan(S_OK, 'ok') : new CSpan(S_FAIL, 'fail')), !$condition ? 'fail' : null); if (!$condition && isset($fail_message)) { $row->setHint($fail_message); } return $row; }
$this->data['widget']->addHeader(_('Images'), $imageComboBoxForm); // form $imageForm = new CForm(); $imageForm->setName('imageForm'); $imageForm->addItem(BR()); $imageTable = new CTable(_('No images found.'), 'header_wide padding_standard'); $count = 0; $imageRow = new CRow(); foreach ($this->data['images'] as $image) { $img = $image['imagetype'] == IMAGE_TYPE_BACKGROUND ? new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $image['imageid'], 'no image'), 'image.php?imageid=' . $image['imageid']) : new CImg('imgstore.php?iconid=' . $image['imageid'], 'no image'); $nodeName = $this->data['displayNodes'] ? new CSpan($image['nodename'], 'unknown') : null; $name = new CLink($image['name'], 'adm.images.php?form=update&imageid=' . $image['imageid']); $imgColumn = new CCol(); $imgColumn->setAttribute('align', 'center'); $imgColumn->addItem(array($img, BR(), $nodeName, $name), 'center'); $imageRow->addItem($imgColumn); $count++; if ($count % 4 == 0) { $imageTable->addRow($imageRow); $imageRow = new CRow(); } } if ($count > 0) { while ($count % 4 != 0) { $imageRow->addItem(SPACE); $count++; } $imageTable->addRow($imageRow); } $imageForm->addItem($imageTable); return $imageForm;
// groups $groupList = new CFormList('grouplist'); // existing groups $groups = array(); foreach ($data['groups'] as $group) { $groups[] = array('id' => $group['groupid'], 'name' => $group['name']); } $groupList->addRow(_('Groups'), new CMultiSelect(array('name' => 'group_links[]', 'objectName' => 'hostGroup', 'objectOptions' => array('editable' => true, 'filter' => array('flags' => ZBX_FLAG_DISCOVERY_NORMAL)), 'data' => $groups, 'disabled' => (bool) $hostPrototype['templateid']))); // new group prototypes $customGroupTable = new CTable(SPACE, 'formElementTable'); $customGroupTable->setAttribute('id', 'tbl_group_prototypes'); // buttons $addButton = new CButton('group_prototype_add', _('Add'), null, 'link_menu'); $buttonColumn = new CCol($addButton); $buttonColumn->setAttribute('colspan', 5); $buttonRow = new CRow(); $buttonRow->setAttribute('id', 'row_new_group_prototype'); $buttonRow->addItem($buttonColumn); $customGroupTable->addRow($buttonRow); $groupDiv = new CDiv($customGroupTable, 'objectgroup border_dotted ui-corner-all group-prototypes'); $groupList->addRow(_('Group prototypes'), $groupDiv); $divTabs->addTab('groupTab', _('Groups'), $groupList); // templates $tmplList = new CFormList('tmpllist'); // create linked template table $linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable'); $linkedTemplateTable->attr('id', 'linkedTemplateTable'); $linkedTemplateTable->attr('style', 'min-width: 400px;'); $linkedTemplateTable->setHeader(array(_('Name'), _('Action'))); $ignoreTemplates = array(); if ($hostPrototype['templates']) {
function make_system_summary($args = array()) { global $USER_DETAILS; $config = select_config(); $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY); if (isset($args['hosts']) && !empty($args['hosts'])) { $available_hosts = zbx_uint_array_intersect($args['hosts'], $available_hosts); } if (isset($args['groups']) && !empty($args['groups'])) { $available_groups = zbx_uint_array_intersect($args['groups'], $available_groups); } $sql_where = ''; if (isset($args['severity']) && ctype_digit($args['severity'])) { $sql_where = ' AND t.priority>=' . $args['severity']; } $table = new CTableInfo(); $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST_GROUP, S_DISASTER, S_HIGH, S_AVERAGE, S_WARNING, S_INFORMATION, S_NOT_CLASSIFIED)); $sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g, hosts_groups hg, hosts h, items i, functions f, triggers t ' . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBcondition('g.groupid', $available_groups) . ' AND hg.groupid=g.groupid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' ORDER BY g.name'; $gr_result = DBselect($sql); while ($group = DBFetch($gr_result)) { $group_row = new CRow(); if (is_show_all_nodes()) { $group_row->addItem(get_node_name_by_elid($group['groupid'])); } $name = new CLink($group['name'], 'tr_status.php?groupid=' . $group['groupid'] . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE); $name->setTarget('blank'); $group_row->addItem($name); $tab_priority[TRIGGER_SEVERITY_DISASTER] = 0; $tab_priority[TRIGGER_SEVERITY_HIGH] = 0; $tab_priority[TRIGGER_SEVERITY_AVERAGE] = 0; $tab_priority[TRIGGER_SEVERITY_WARNING] = 0; $tab_priority[TRIGGER_SEVERITY_INFORMATION] = 0; $tab_priority[TRIGGER_SEVERITY_NOT_CLASSIFIED] = 0; $sql = 'SELECT count(DISTINCT t.triggerid) as tr_cnt,t.priority ' . ' FROM hosts h,items i,hosts_groups hg, functions f, triggers t ' . ' WHERE h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND hg.groupid=' . $group['groupid'] . ' AND hg.hostid=h.hostid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.value=' . TRIGGER_VALUE_TRUE . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' GROUP BY t.priority'; //SDI($sql); $tr_result = DBSelect($sql); while ($group_stat = DBFetch($tr_result)) { $tab_priority[$group_stat['priority']] = $group_stat['tr_cnt']; } foreach ($tab_priority as $key => $value) { $tr_count = 0; if ($value) { //* trigger list $table_inf = new CTableInfo(); $table_inf->setAttribute('style', 'width: 400px;'); $table_inf->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST, S_ISSUE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS)); $sql = 'SELECT DISTINCT t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.value,h.host,h.hostid ' . ' FROM triggers t,hosts h,items i,functions f, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND hg.groupid=' . $group['groupid'] . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND t.value=' . TRIGGER_VALUE_TRUE . ' AND t.priority=' . $key . ' ORDER BY t.lastchange DESC'; $result = DBselect($sql); while ($row_inf = DBfetch($result)) { // Check for dependencies if (trigger_dependent($row_inf["triggerid"])) { continue; } $tr_count++; if ($tr_count > 30) { continue; } $host = new CSpan($row_inf['host']); $event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type ' . ' FROM events e, triggers t ' . ' WHERE e.object=' . EVENT_SOURCE_TRIGGERS . ' AND e.objectid=' . $row_inf['triggerid'] . ' AND t.triggerid=e.objectid ' . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC'; if ($row_inf_event = DBfetch(DBselect($event_sql, 1))) { if ($config['event_ack_enable']) { if ($row_inf_event['acknowledged'] == 1) { $ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_inf_event['eventid'], 'action'); } else { $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_inf_event['eventid'], 'on'); } } $description = expand_trigger_description_by_data(array_merge($row_inf, array('clock' => $row_inf_event['clock'])), ZBX_FLAG_EVENT); //actions $actions = get_event_actions_status($row_inf_event['eventid']); //-------- } else { $description = expand_trigger_description_by_data($row_inf, ZBX_FLAG_EVENT); $ack = '-'; $actions = S_NO_DATA_SMALL; $row_inf_event['clock'] = $row_inf['clock']; } $table_inf->addRow(array(get_node_name_by_elid($row_inf['triggerid']), $host, new CCol($description, get_severity_style($row_inf['priority'])), zbx_date2age($row_inf_event['clock']), $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, $actions)); unset($row_inf, $description, $actions); } $value = new CSpan($tr_count, 'pointer'); $value->setHint($table_inf); //-------------*/ } $group_row->AddItem(new CCol($value, get_severity_style($key, $tr_count))); unset($table_inf); } $table->addRow($group_row); } $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time()))); return $table; }
function get_rights_of_elements_table($rights = array(), $user_type = USER_TYPE_ZABBIX_USER) { global $ZBX_LOCALNODEID; $table = new CTable('S_NO_ACCESSIBLE_RESOURCES', 'right_table'); $table->SetHeader(array(SPACE, S_READ_WRITE, S_READ_ONLY, S_DENY), 'header'); if (ZBX_DISTRIBUTED) { $lst['node']['label'] = S_NODES; $lst['node']['read_write'] = new CListBox('nodes_write', null, 10); $lst['node']['read_only'] = new CListBox('nodes_read', null, 10); $lst['node']['deny'] = new CListBox('nodes_deny', null, 10); $nodes = get_accessible_nodes_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY); foreach ($nodes as $node) { switch ($node['permission']) { case PERM_READ_ONLY: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; break; } $lst['node'][$list_name]->addItem($node['nodeid'], $node['name']); } unset($nodes); } $lst['group']['label'] = S_HOST_GROUPS; $lst['group']['read_write'] = new CListBox('groups_write', null, 15); $lst['group']['read_only'] = new CListBox('groups_read', null, 15); $lst['group']['deny'] = new CListBox('groups_deny', null, 15); $groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true)); foreach ($groups as $group) { switch ($group['permission']) { case PERM_READ_ONLY: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } $lst['group'][$list_name]->addItem($group['groupid'], $group['node_name'] . ':' . $group['name']); } unset($groups); $lst['host']['label'] = S_HOSTS; $lst['host']['read_write'] = new CListBox('hosts_write', null, 15); $lst['host']['read_only'] = new CListBox('hosts_read', null, 15); $lst['host']['deny'] = new CListBox('hosts_deny', null, 15); $hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true)); foreach ($hosts as $host) { switch ($host['permission']) { case PERM_READ_ONLY: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; break; } $lst['host'][$list_name]->addItem($host['hostid'], $host['node_name'] . ':' . $host['host']); } unset($hosts); foreach ($lst as $name => $lists) { $row = new CRow(); foreach ($lists as $class => $list_obj) { $row->addItem(new CCol($list_obj, $class)); } $table->addRow($row); } unset($lst); return $table; }
$headerForm->addItem(array(SPACE, _('Application'), SPACE, $this->data['pageFilter']->getApplicationsCB(true))); $headerForm->addItem(array(SPACE, _('Type'), SPACE, $typeComboBox)); $overviewWidget->addHeader(_('Overview'), $headerForm); $hintTable = new CTableInfo(); $hintTable->setAttribute('style', 'width: 200px'); if ($this->data['type'] == SHOW_TRIGGERS) { $hintTable->addRow(array(new CCol(SPACE, 'normal'), _('OK'))); } for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) { $hintTable->addRow(array(getSeverityCell($i), _('PROBLEM'))); } $config = select_config(); if ($this->data['type'] == SHOW_TRIGGERS) { // blinking preview in help popup (only if blinking is enabled) if ($config['blink_period'] > 0) { $row = new CRow(null); $row->addItem(new CCol(SPACE, 'normal')); for ($i = 0; $i < TRIGGER_SEVERITY_COUNT; $i++) { $row->addItem(new CCol(SPACE, getSeverityStyle($i))); } $col = new CTable('', 'blink overview-mon-severities'); $col->addRow($row); // double div necassary for FireFox $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');
$text2 = new CTextBox('macros[' . $i . '][value]', $macro['value'], 40, $readonly, 255); $text2->setAttribute('placeholder', _('value')); $span = new CSpan('⇒'); $span->addStyle('vertical-align:top;'); $deleteButtonCell = null; if (!$readonly) { $deleteButtonCell = array(new CButton('macros_' . $i . '_remove', _('Remove'), null, 'link_menu element-table-remove')); if (isset($macro['globalmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][globalmacroid]', $macro['globalmacroid'], 'macros_' . $i . '_id'); } if (isset($macro['hostmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][hostmacroid]', $macro['hostmacroid'], 'macros_' . $i . '_id'); } } $row = array($text1, $span, $text2, $deleteButtonCell); $macrosTable->addRow($row, 'form_row'); } // buttons if (!$readonly) { $addButton = new CButton('macro_add', _('Add'), null, 'link_menu element-table-add'); $buttonColumn = new CCol($addButton); $buttonColumn->setAttribute('colspan', 5); $buttonRow = new CRow(); $buttonRow->setAttribute('id', 'row_new_macro'); $buttonRow->addItem($buttonColumn); $macrosTable->addRow($buttonRow); } // form list $macrosFormList = new CFormList('macrosFormList'); $macrosFormList->addRow($macrosTable); return $macrosFormList;
$search_div = new CDiv($search_form); $search_div->setAttribute('id','zbx_search'); $search_div->setAttribute('class','zbx_search'); $page_menu->addItem($search_div); //*/ $page_menu->show(); } //------------------------------------- <HISTORY> --------------------------------------- if (isset($page['hist_arg']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) { $table = new CTable(); $table->setClass('history'); $table->setCellSpacing(0); $table->setCellPadding(0); $history = get_user_history(); $tr = new CRow(new CCol('History:', 'caption')); $tr->addItem($history); $table->addRow($tr); $table->Show(); } else { if ($page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) { echo SBR; } } //------------------------------------ </HISTORY> --------------------------------------- unset($ZBX_MENU); unset($table, $top_page_row, $menu_table, $node_form); unset($main_menu_row); unset($db_nodes, $node_data); unset($sub_menu_table, $sub_menu_rows); if ($denyed_page_requested) {
$urlRow = new CRow(array($urlLabel, $urlLink, $urlEtype, $removeButton)); $urlRow->setAttribute('id', 'urlEntry_' . $i); $urlTable->addRow($urlRow); $i++; } // append empty template row to url table $templateUrlLabel = new CTextBox('urls[#{id}][name]', '', 32); $templateUrlLabel->setAttribute('disabled', 'disabled'); $templateUrlLink = new CTextBox('urls[#{id}][url]', '', 32); $templateUrlLink->setAttribute('disabled', 'disabled'); $templateUrlEtype = new CComboBox('urls[#{id}][elementtype]'); $templateUrlEtype->setAttribute('disabled', 'disabled'); $templateUrlEtype->addItems(sysmap_element_types()); $templateRemoveButton = new CSpan(_('Remove'), 'link_menu'); $templateRemoveButton->addAction('onclick', '$("entry_#{id}").remove();'); $templateUrlRow = new CRow(array($templateUrlLabel, $templateUrlLink, $templateUrlEtype, $templateRemoveButton)); $templateUrlRow->addStyle('display: none'); $templateUrlRow->setAttribute('id', 'urlEntryTpl'); $urlTable->addRow($templateUrlRow); // append "add" button to url table $addButton = new CSpan(_('Add'), 'link_menu'); $addButton->addAction('onclick', 'cloneRow("urlEntryTpl", ' . $i . ')'); $addButtonColumn = new CCol($addButton); $addButtonColumn->setColSpan(4); $urlTable->addRow($addButtonColumn); // append url table to form list $sysmapList->addRow(_('URLs'), new CDiv($urlTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append sysmap to form $sysmapTab = new CTabView(); $sysmapTab->addTab('sysmapTab', _('Map'), $sysmapList); $sysmapForm->addItem($sysmapTab);