本文整理汇总了PHP中CRow类的典型用法代码示例。如果您正苦于以下问题:PHP CRow类的具体用法?PHP CRow怎么用?PHP CRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRow
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;
}
示例2: _getContent
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;
}
示例3: addRow
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;
}
示例4: make_hoststat_summary
//.........这里部分代码省略.........
$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);
}
示例5: CSpan
$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');
示例6: CCheckBox
} 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!!!
示例7: _
$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;
示例8: Counter
<!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> ";
示例9: getPermissionsFormList
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;
}
示例10: make_system_status
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;
//.........这里部分代码省略.........
示例11: CTextBox
$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', '');
示例12: makeSImgStr
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;
}
示例13: CDiv
// 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');
}
示例14: CSpan
$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);
示例15: CVisibilityBox
$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));