本文整理汇总了PHP中CFormTable::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormTable::getName方法的具体用法?PHP CFormTable::getName怎么用?PHP CFormTable::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormTable
的用法示例。
在下文中一共展示了CFormTable::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
$url = is_null($request) ? $USER_DETAILS['url'] : $request;
redirect($url);
exit;
}
}
include_once 'include/page_header.php';
if (isset($_REQUEST['message'])) {
show_error_message($_REQUEST['message']);
}
if (!isset($sessionid) || $USER_DETAILS['alias'] == ZBX_GUEST_USER) {
switch ($authentication_type) {
case ZBX_AUTH_HTTP:
break;
case ZBX_AUTH_LDAP:
case ZBX_AUTH_INTERNAL:
default:
// konqueror bug #138024; adding useless param(login=1) to the form's action path to avoid bug!!
$frmLogin = new CFormTable('Login', 'index.php?login=1', 'post', 'multipart/form-data');
$frmLogin->setHelp('web.index.login');
$frmLogin->addVar('request', $request);
$frmLogin->addRow('Login name', new CTextBox('name'));
$frmLogin->addRow('Password', new CPassBox('password'));
$frmLogin->addItemToBottomRow(new CButton('enter', 'Enter'));
$frmLogin->show(false);
setFocus($frmLogin->getName(), 'name');
$frmLogin->destroy();
}
} else {
echo '<div align="center" class="textcolorstyles">Welcome to ZABBIX! You are connected as <b>' . $USER_DETAILS['alias'] . '</b>.</div>';
}
include_once 'include/page_footer.php';
示例2: CComboBox
$filterForm->addRow(_('Minimum trigger severity'), new CComboBox('show_severity', $filter['showSeverity'], null, array(TRIGGER_SEVERITY_NOT_CLASSIFIED => getSeverityCaption(TRIGGER_SEVERITY_NOT_CLASSIFIED), TRIGGER_SEVERITY_INFORMATION => getSeverityCaption(TRIGGER_SEVERITY_INFORMATION), TRIGGER_SEVERITY_WARNING => getSeverityCaption(TRIGGER_SEVERITY_WARNING), TRIGGER_SEVERITY_AVERAGE => getSeverityCaption(TRIGGER_SEVERITY_AVERAGE), TRIGGER_SEVERITY_HIGH => getSeverityCaption(TRIGGER_SEVERITY_HIGH), TRIGGER_SEVERITY_DISASTER => getSeverityCaption(TRIGGER_SEVERITY_DISASTER))));
// age less than
$statusChangeDays = new CNumericBox('status_change_days', $filter['statusChangeDays'], 3, false, false, false);
if (!$filter['statusChange']) {
$statusChangeDays->setAttribute('disabled', 'disabled');
}
$statusChangeDays->addStyle('vertical-align: middle;');
$statusChangeCheckBox = new CCheckBox('status_change', $filter['statusChange'], 'javascript: this.checked ? $("status_change_days").enable() : $("status_change_days").disable()', 1);
$statusChangeCheckBox->addStyle('vertical-align: middle;');
$daysSpan = new CSpan(_('days'));
$daysSpan->addStyle('vertical-align: middle;');
$filterForm->addRow(_('Age less than'), array($statusChangeCheckBox, $statusChangeDays, SPACE, $daysSpan));
// name
$filterForm->addRow(_('Filter by name'), new CTextBox('txt_select', $filter['txtSelect'], 40));
// application
$filterForm->addRow(_('Filter by application'), array(new CTextBox('application', $filter['application'], 40), new CButton('application_name', _('Select'), 'return PopUp("popup.php?srctbl=applications&srcfld1=name&real_hosts=1&dstfld1=application&with_applications=1' . '&dstfrm=' . $filterForm->getName() . '");', 'filter-button')));
// inventory filter
$inventoryFilters = $filter['inventory'];
if (!$inventoryFilters) {
$inventoryFilters = array(array('field' => '', 'value' => ''));
}
$inventoryFields = array();
foreach (getHostInventories() as $inventory) {
$inventoryFields[$inventory['db_field']] = $inventory['title'];
}
$inventoryFilterTable = new CTable();
$inventoryFilterTable->setAttribute('id', 'inventory-filter');
$i = 0;
foreach ($inventoryFilters as $field) {
$inventoryFilterTable->addRow(array(new CComboBox('inventory[' . $i . '][field]', $field['field'], null, $inventoryFields), new CTextBox('inventory[' . $i . '][value]', $field['value'], 20), new CButton('inventory[' . $i . '][remove]', _('Remove'), null, 'link_menu element-table-remove')), 'form_row');
$i++;
示例3: insert_graph_form
//.........这里部分代码省略.........
$pr_left_input = new CTextBox('percent_left', $percent_left, '5');
$pr_left_chkbx = new CCheckBox('visible[percent_left]', 1, "javascript: ShowHide('percent_left');", 1);
if ($percent_left == 0) {
$pr_left_input->addOption('style', 'display: none;');
$pr_left_chkbx->SetChecked(0);
}
$pr_right_input = new CTextBox('percent_right', $percent_right, '5');
$pr_right_chkbx = new CCheckBox('visible[percent_right]', 1, "javascript: ShowHide('percent_right');", 1);
if ($percent_right == 0) {
$pr_right_input->addOption('style', 'display: none;');
$pr_right_chkbx->SetChecked(0);
}
$frmGraph->addRow(S_PERCENTILE_LINE . ' (' . S_LEFT . ')', array($pr_left_chkbx, $pr_left_input));
$frmGraph->addRow(S_PERCENTILE_LINE . ' (' . S_RIGHT . ')', array($pr_right_chkbx, $pr_right_input));
}
$yaxis_min = array();
$cmbYType = new CComboBox('ymin_type', $ymin_type, 'javascript: submit();');
$cmbYType->addItem(GRAPH_YAXIS_TYPE_CALCULATED, S_CALCULATED);
$cmbYType->addItem(GRAPH_YAXIS_TYPE_FIXED, S_FIXED);
$cmbYType->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE, S_ITEM);
$yaxis_min[] = $cmbYType;
if ($ymin_type == GRAPH_YAXIS_TYPE_FIXED) {
$yaxis_min[] = new CTextBox("yaxismin", $yaxismin, 9);
} else {
if ($ymin_type == GRAPH_YAXIS_TYPE_ITEM_VALUE) {
$frmGraph->addVar('yaxismin', $yaxismin);
$ymin_name = '';
if ($ymin_itemid > 0) {
$min_host = get_host_by_itemid($ymin_itemid);
$min_item = get_item_by_itemid($ymin_itemid);
$ymin_name = $min_host['host'] . ':' . item_description($min_item);
}
$yaxis_min[] = new CTextBox("ymin_name", $ymin_name, 80, 'yes');
$yaxis_min[] = new CButton('yaxis_min', S_SELECT, 'javascript: ' . "return PopUp('popup.php?dstfrm=" . $frmGraph->getName() . "&dstfld1=ymin_itemid" . "&dstfld2=ymin_name" . "&srctbl=items" . "&srcfld1=itemid" . "&srcfld2=description',0,0,'zbx_popup_item');");
} else {
$frmGraph->addVar('yaxismin', $yaxismin);
}
}
$frmGraph->addRow(S_YAXIS_MIN_VALUE, $yaxis_min);
$yaxis_max = array();
$cmbYType = new CComboBox("ymax_type", $ymax_type, "submit()");
$cmbYType->addItem(GRAPH_YAXIS_TYPE_CALCULATED, S_CALCULATED);
$cmbYType->addItem(GRAPH_YAXIS_TYPE_FIXED, S_FIXED);
$cmbYType->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE, S_ITEM);
$yaxis_max[] = $cmbYType;
if ($ymax_type == GRAPH_YAXIS_TYPE_FIXED) {
$yaxis_max[] = new CTextBox("yaxismax", $yaxismax, 9);
} else {
if ($ymax_type == GRAPH_YAXIS_TYPE_ITEM_VALUE) {
$frmGraph->addVar('yaxismax', $yaxismax);
$ymax_name = '';
if ($ymax_itemid > 0) {
$max_host = get_host_by_itemid($ymax_itemid);
$max_item = get_item_by_itemid($ymax_itemid);
$ymax_name = $max_host['host'] . ':' . item_description($max_item);
}
$yaxis_max[] = new CTextBox("ymax_name", $ymax_name, 80, 'yes');
$yaxis_max[] = new CButton('yaxis_max', S_SELECT, 'javascript: ' . "return PopUp('popup.php?dstfrm=" . $frmGraph->getName() . "&dstfld1=ymax_itemid" . "&dstfld2=ymax_name" . "&srctbl=items" . "&srcfld1=itemid" . "&srcfld2=description',0,0,'zbx_popup_item');");
} else {
$frmGraph->addVar('yaxismax', $yaxismax);
}
}
$frmGraph->addRow(S_YAXIS_MAX_VALUE, $yaxis_max);
} else {
$frmGraph->addRow(S_3D_VIEW, new CCheckBox('graph3d', $graph3d, 'javascript: graphs.submit(this);', 1));
$frmGraph->addRow(S_LEGEND, new CCheckBox('legend', $legend, 'javascript: graphs.submit(this);', 1));
示例4: bar_report_form2
function bar_report_form2()
{
global $USER_DETAILS;
$config = get_request('config', 1);
$title = get_request('title', S_REPORT . ' 2');
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$sorttype = get_request('sorttype', 0);
$captions = get_request('captions', array());
$items = get_request('items', array());
$periods = get_request('periods', array());
$showlegend = get_request('showlegend', 0);
$reportForm = new CFormTable(null, null, 'get');
//,'events.php?report_set=1','POST',null,'sform');
$reportForm->setAttribute('name', 'zbx_report');
$reportForm->setAttribute('id', 'zbx_report');
// $reportForm->setMethod('post');
if (isset($_REQUEST['report_show']) && !empty($items)) {
$reportForm->addVar('report_show', 'show');
}
$reportForm->addVar('config', $config);
$reportForm->addVar('items', $items);
// periods add later
$reportForm->addRow(S_TITLE, new CTextBox('title', $title, 40));
$reportForm->addRow(S_X . SPACE . S_LABEL, new CTextBox('xlabel', $xlabel, 40));
$reportForm->addRow(S_Y . SPACE . S_LABEL, new CTextBox('ylabel', $ylabel, 40));
$reportForm->addRow(S_LEGEND, new CCheckBox('showlegend', $showlegend, null, 1));
if (count($periods) < 2) {
$sortCmb = new CComboBox('sorttype', $sorttype);
$sortCmb->addItem(0, S_NAME);
$sortCmb->addItem(1, S_VALUE);
$reportForm->addRow(S_SORT_BY, $sortCmb);
} else {
$reportForm->addVar('sortorder', 0);
}
//*/
// PERIODS
if (count($periods)) {
$periods_table = new CTableInfo();
foreach ($periods as $pid => $period) {
$color = new CColorCell(null, $period['color']);
$edit_link = 'popup_period.php?period_id=' . $pid . '&config=2' . '&dstfrm=' . $reportForm->getName() . '&caption=' . $period['caption'] . '&report_timesince=' . $period['report_timesince'] . '&report_timetill=' . $period['report_timetill'] . '&color=' . $period['color'];
$caption = new CSpan($period['caption'], 'link');
$caption->addAction('onclick', "return PopUp('" . $edit_link . "',840,340,'period_form');");
$periods_table->addRow(array(new CCheckBox('group_pid[' . $pid . ']'), $caption, zbx_date2str(S_REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timesince']), zbx_date2str(S_REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timetill']), $color));
}
$delete_button = new CButton('delete_period', S_DELETE_SELECTED);
} else {
$periods_table = $delete_button = null;
}
$reportForm->addVar('periods', $periods);
$reportForm->addRow(S_PERIOD, array($periods_table, new CButton('add_period', S_ADD, "return PopUp('popup_period.php?config=2&dstfrm=" . $reportForm->getName() . "',840,340,'period_form');"), $delete_button));
unset($periods_table, $delete_button);
//-----------
// ITEMS
if (count($items)) {
$items_table = new CTableInfo();
foreach ($items as $gid => $gitem) {
$host = get_host_by_itemid($gitem['itemid']);
$item = get_item_by_itemid($gitem['itemid']);
if ($host['status'] == HOST_STATUS_TEMPLATE) {
$only_hostid = $host['hostid'];
} else {
$monitored_hosts = 1;
}
$caption = new CSpan($gitem['caption'], 'link');
$caption->onClick('return PopUp("popup_bitem.php?config=2&list_name=items&dstfrm=' . $reportForm->GetName() . url_param($gitem, false) . url_param($gid, false, 'gid') . '",550,400,"graph_item_form");');
$description = $host['host'] . ': ' . item_description($item);
$items_table->addRow(array(new CCheckBox('group_gid[' . $gid . ']', isset($group_gid[$gid])), $caption, $description, graph_item_calc_fnc2str($gitem['calc_fnc'], 0)));
}
$delete_button = new CButton('delete_item', S_DELETE_SELECTED);
} else {
$items_table = $delete_button = null;
}
$reportForm->addRow(S_ITEMS, array($items_table, new CButton('add_item', S_ADD, "return PopUp('popup_bitem.php?config=2&dstfrm=" . $reportForm->getName() . "',550,400,'graph_item_form');"), $delete_button));
unset($items_table, $delete_button);
//--------------
$reportForm->addItemToBottomRow(new CButton('report_show', S_SHOW));
$reset = new CButton('reset', S_RESET);
$reset->setType('reset');
$reportForm->addItemToBottomRow($reset);
return $reportForm;
}
示例5: valueDistributionFormForMultipleItems
/**
* Create bar report form for "Distribution of values for multiple items".
*
* @param array $items
* @param array $periods
*
* @return object $reportForm
*/
function valueDistributionFormForMultipleItems($items = array(), $periods = array())
{
$config = get_request('config', 1);
$title = get_request('title', _('Report 2'));
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$sorttype = get_request('sorttype', 0);
$showlegend = get_request('showlegend', 0);
$reportForm = new CFormTable(null, null, 'get');
$reportForm->setAttribute('name', 'zbx_report');
$reportForm->setAttribute('id', 'zbx_report');
if (isset($_REQUEST['report_show']) && is_array($items) && $items && is_array($periods) && $periods) {
$reportForm->addVar('report_show', 'show');
}
$reportForm->addVar('config', $config);
$reportForm->addRow(_('Title'), new CTextBox('title', $title, 40));
$reportForm->addRow(_('X label'), new CTextBox('xlabel', $xlabel, 40));
$reportForm->addRow(_('Y label'), new CTextBox('ylabel', $ylabel, 40));
$reportForm->addRow(_('Legend'), new CCheckBox('showlegend', $showlegend, null, 1));
if (count($periods) < 2) {
$sortCmb = new CComboBox('sorttype', $sorttype);
$sortCmb->addItem(0, _('Name'));
$sortCmb->addItem(1, _('Value'));
$reportForm->addRow(_('Sort by'), $sortCmb);
} else {
$reportForm->addVar('sortorder', 0);
}
if (is_array($periods) && $periods) {
$periods_table = new CTableInfo();
foreach ($periods as $pid => $period) {
$color = new CColorCell(null, $period['color']);
$edit_link = 'popup_period.php?' . 'period_id=' . $pid . '&config=2' . '&dstfrm=' . $reportForm->getName() . '&caption=' . $period['caption'] . '&report_timesince=' . $period['report_timesince'] . '&report_timetill=' . $period['report_timetill'] . '&color=' . $period['color'];
$caption = new CSpan($period['caption'], 'link');
$caption->addAction('onclick', "return PopUp('" . $edit_link . "',840,340,'period_form');");
$periods_table->addRow(array(new CCheckBox('group_pid[' . $pid . ']'), $caption, zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timesince']), zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timetill']), $color));
}
$reportForm->addVar('periods', $periods);
$delete_button = new CSubmit('delete_period', _('Delete selected'));
} else {
$periods_table = $delete_button = null;
}
$reportForm->addRow(_('Period'), array($periods_table, new CButton('add_period', _('Add'), 'return PopUp("popup_period.php?config=2&dstfrm=' . $reportForm->getName() . '", 840, 340, "period_form");'), $delete_button));
unset($periods_table, $delete_button);
if (is_array($items) && $items) {
$items_table = new CTableInfo();
foreach ($items as $id => &$item) {
$caption = new CSpan($item['caption'], 'link');
$caption->onClick('return PopUp("popup_bitem.php?' . 'config=2' . '&list_name=items' . '&dstfrm=' . $reportForm->GetName() . url_param($item, false) . url_param($id, false, 'gid') . '", 550, 400, "graph_item_form");');
$description = $item['host']['name'] . NAME_DELIMITER . itemName($item);
$items_table->addRow(array(new CCheckBox('group_gid[' . $id . ']', isset($group_gid[$id])), $caption, $description, graph_item_calc_fnc2str($item['calc_fnc'], 0)));
// once used, unset unnecessary fields so they don't pass to URL. "color" goes in "periods" parameter.
unset($item['value_type'], $item['host'], $item['name'], $item['color']);
}
unset($item);
$reportForm->addVar('items', $items);
$delete_button = new CSubmit('delete_item', _('Delete selected'));
} else {
$items_table = $delete_button = null;
}
$reportForm->addRow(_('Items'), array($items_table, new CButton('add_item', _('Add'), "return PopUp('popup_bitem.php?config=2&dstfrm=" . $reportForm->getName() . "', 550, 400, 'graph_item_form');"), $delete_button));
unset($items_table, $delete_button);
$reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show')));
$reset = new CButton('reset', _('Reset'));
$reset->setType('reset');
$reportForm->addItemToBottomRow($reset);
return $reportForm;
}
示例6: redirect
$cmbConf->setAttribute('onchange', 'javascript: redirect(this.options[this.selectedIndex].value);');
$cmbConf->addItem('auditlogs.php', S_LOGS);
$cmbConf->addItem('auditacts.php', S_ACTIONS);
$frmForm->addItem($cmbConf);
$alerts_wdgt->addPageHeader(S_AUDIT_ACTIONS_BIG, $frmForm);
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$alerts_wdgt->addHeader(S_ACTIONS_BIG);
$alerts_wdgt->addHeader($numrows);
//--------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$row = new CRow(array(new CCol(S_RECIPIENT, 'form_row_l'), new CCol(array(new CTextBox('alias', $_REQUEST['alias'], 32), new CButton('btn1', S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->getName() . "&dstfld1=alias&srctbl=users&srcfld1=alias&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->addRow($row);
$reset = new CButton('filter_rst', S_RESET);
$reset->setType('button');
$reset->setAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
$filterForm->addItemToBottomRow(new CButton("filter_set", S_FILTER));
$filterForm->addItemToBottomRow($reset);
$alerts_wdgt->addFlicker($filterForm, CProfile::get('web.auditacts.filter.state', 1));
$scroll_div = new CDiv();
$scroll_div->setAttribute('id', 'scrollbar_cntr');
$alerts_wdgt->addFlicker($scroll_div, CProfile::get('web.auditacts.filter.state', 1));
//-------
$table = new CTableInfo(S_NO_ACTIONS_FOUND);
$table->setHeader(array(is_show_all_nodes() ? S_NODES : null, S_TIME, S_TYPE, S_STATUS, S_RETRIES_LEFT, S_RECIPIENTS, S_MESSAGE, S_ERROR));
$effectiveperiod = navigation_bar_calc('web.auditacts.timeline', 0, true);
$bstime = $_REQUEST['stime'];
示例7: get_screen_item_form
function get_screen_item_form()
{
global $USER_DETAILS;
$form = new CFormTable(S_SCREEN_CELL_CONFIGURATION, 'screenedit.php?screenid=' . $_REQUEST['screenid']);
$form->SetHelp('web.screenedit.cell.php');
if (isset($_REQUEST['screenitemid'])) {
$sql = 'SELECT * ' . ' FROM screens_items' . ' WHERE screenid=' . $_REQUEST['screenid'] . ' AND screenitemid=' . $_REQUEST['screenitemid'];
$iresult = DBSelect($sql);
$form->addVar('screenitemid', $_REQUEST['screenitemid']);
} else {
$form->addVar('x', $_REQUEST['x']);
$form->addVar('y', $_REQUEST['y']);
}
if (isset($_REQUEST['screenitemid']) && !isset($_REQUEST['form_refresh'])) {
$irow = DBfetch($iresult);
$resourcetype = $irow['resourcetype'];
$resourceid = $irow['resourceid'];
$width = $irow['width'];
$height = $irow['height'];
$colspan = $irow['colspan'];
$rowspan = $irow['rowspan'];
$elements = $irow['elements'];
$valign = $irow['valign'];
$halign = $irow['halign'];
$style = $irow['style'];
$url = $irow['url'];
$dynamic = $irow['dynamic'];
} else {
$resourcetype = get_request('resourcetype', 0);
$resourceid = get_request('resourceid', 0);
$width = get_request('width', 500);
$height = get_request('height', 100);
$colspan = get_request('colspan', 0);
$rowspan = get_request('rowspan', 0);
$elements = get_request('elements', 25);
$valign = get_request('valign', VALIGN_DEFAULT);
$halign = get_request('halign', HALIGN_DEFAULT);
$style = get_request('style', 0);
$url = get_request('url', '');
$dynamic = get_request('dynamic', SCREEN_SIMPLE_ITEM);
}
$form->addVar('screenid', $_REQUEST['screenid']);
// a-z order!!!
$cmbRes = new CCombobox('resourcetype', $resourcetype, 'submit()');
$cmbRes->addItem(SCREEN_RESOURCE_CLOCK, S_CLOCK);
$cmbRes->addItem(SCREEN_RESOURCE_DATA_OVERVIEW, S_DATA_OVERVIEW);
$cmbRes->addItem(SCREEN_RESOURCE_GRAPH, S_GRAPH);
$cmbRes->addItem(SCREEN_RESOURCE_ACTIONS, S_HISTORY_OF_ACTIONS);
$cmbRes->addItem(SCREEN_RESOURCE_EVENTS, S_HISTORY_OF_EVENTS);
$cmbRes->addItem(SCREEN_RESOURCE_HOSTS_INFO, S_HOSTS_INFO);
$cmbRes->addItem(SCREEN_RESOURCE_MAP, S_MAP);
$cmbRes->addItem(SCREEN_RESOURCE_PLAIN_TEXT, S_PLAIN_TEXT);
$cmbRes->addItem(SCREEN_RESOURCE_SCREEN, S_SCREEN);
$cmbRes->addItem(SCREEN_RESOURCE_SERVER_INFO, S_SERVER_INFO);
$cmbRes->addItem(SCREEN_RESOURCE_SIMPLE_GRAPH, S_SIMPLE_GRAPH);
$cmbRes->addItem(SCREEN_RESOURCE_HOSTGROUP_TRIGGERS, S_STATUS_OF_HOSTGROUP_TRIGGERS);
$cmbRes->addItem(SCREEN_RESOURCE_HOST_TRIGGERS, S_STATUS_OF_HOST_TRIGGERS);
$cmbRes->addItem(SCREEN_RESOURCE_SYSTEM_STATUS, S_SYSTEM_STATUS);
$cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_INFO, S_TRIGGERS_INFO);
$cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_OVERVIEW, S_TRIGGERS_OVERVIEW);
$cmbRes->addItem(SCREEN_RESOURCE_URL, S_URL);
$form->addRow(S_RESOURCE, $cmbRes);
if ($resourcetype == SCREEN_RESOURCE_GRAPH) {
// User-defined graph
$options = array('graphids' => $resourceid, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND);
$graphs = CGraph::get($options);
$caption = '';
$id = 0;
if (!empty($graphs)) {
$id = $resourceid;
$graph = reset($graphs);
order_result($graph['hosts'], 'host');
$graph['host'] = reset($graph['hosts']);
$caption = $graph['host']['host'] . ':' . $graph['name'];
$nodeName = get_node_name_by_elid($graph['host']['hostid']);
if (!zbx_empty($nodeName)) {
$caption = '(' . $nodeName . ') ' . $caption;
}
}
$form->addVar('resourceid', $id);
$textfield = new CTextbox('caption', $caption, 75, 'yes');
$selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&real_hosts=1&dstfld1=resourceid&dstfld2=caption&srctbl=graphs&srcfld1=graphid&srcfld2=name',800,450);");
$selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$form->addRow(S_GRAPH_NAME, array($textfield, SPACE, $selectbtn));
} else {
if ($resourcetype == SCREEN_RESOURCE_SIMPLE_GRAPH) {
// Simple graph
$options = array('itemids' => $resourceid, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND);
$items = CItem::get($options);
$caption = '';
$id = 0;
if (!empty($items)) {
$id = $resourceid;
$item = reset($items);
$item['host'] = reset($item['hosts']);
$caption = item_description($item);
$nodeName = get_node_name_by_elid($item['itemid']);
if (!zbx_empty($nodeName)) {
$caption = '(' . $nodeName . ') ' . $caption;
}
//.........这里部分代码省略.........
示例8: insert_mass_update_host_form
function insert_mass_update_host_form()
{
//$elements_array_name){
global $USER_DETAILS;
$visible = get_request('visible', array());
$groups = get_request('groups', array());
$newgroup = get_request('newgroup', '');
$host = get_request('host', '');
$port = get_request('port', CProfile::get('HOST_PORT', 10050));
$status = get_request('status', HOST_STATUS_MONITORED);
$useip = get_request('useip', 1);
$dns = get_request('dns', '');
$ip = get_request('ip', '0.0.0.0');
$proxy_hostid = get_request('proxy_hostid', '');
$useipmi = get_request('useipmi', 'no');
$ipmi_ip = get_request('ipmi_ip', '');
$ipmi_port = get_request('ipmi_port', 623);
$ipmi_authtype = get_request('ipmi_authtype', -1);
$ipmi_privilege = get_request('ipmi_privilege', 2);
$ipmi_username = get_request('ipmi_username', '');
$ipmi_password = get_request('ipmi_password', '');
$useprofile = get_request('useprofile', 'no');
$host_profile = get_request('host_profile', array());
$profile_fields = array('devicetype' => S_DEVICE_TYPE, 'name' => S_NAME, 'os' => S_OS, 'serialno' => S_SERIALNO, 'tag' => S_TAG, 'macaddress' => S_MACADDRESS, 'hardware' => S_HARDWARE, 'software' => S_SOFTWARE, 'contact' => S_CONTACT, 'location' => S_LOCATION, 'notes' => S_NOTES);
foreach ($profile_fields as $field => $caption) {
if (!isset($host_profile[$field])) {
$host_profile[$field] = '';
}
}
// BEGIN: HOSTS PROFILE EXTENDED Section
$useprofile_ext = get_request('useprofile_ext', 'no');
$ext_host_profiles = get_request('ext_host_profiles', array());
$ext_profiles_fields = array('device_alias' => S_DEVICE_ALIAS, 'device_type' => S_DEVICE_TYPE, 'device_chassis' => S_DEVICE_CHASSIS, 'device_os' => S_DEVICE_OS, 'device_os_short' => S_DEVICE_OS_SHORT, 'device_hw_arch' => S_DEVICE_HW_ARCH, 'device_serial' => S_DEVICE_SERIAL, 'device_model' => S_DEVICE_MODEL, 'device_tag' => S_DEVICE_TAG, 'device_vendor' => S_DEVICE_VENDOR, 'device_contract' => S_DEVICE_CONTRACT, 'device_who' => S_DEVICE_WHO, 'device_status' => S_DEVICE_STATUS, 'device_app_01' => S_DEVICE_APP_01, 'device_app_02' => S_DEVICE_APP_02, 'device_app_03' => S_DEVICE_APP_03, 'device_app_04' => S_DEVICE_APP_04, 'device_app_05' => S_DEVICE_APP_05, 'device_url_1' => S_DEVICE_URL_1, 'device_url_2' => S_DEVICE_URL_2, 'device_url_3' => S_DEVICE_URL_3, 'device_networks' => S_DEVICE_NETWORKS, 'device_notes' => S_DEVICE_NOTES, 'device_hardware' => S_DEVICE_HARDWARE, 'device_software' => S_DEVICE_SOFTWARE, 'ip_subnet_mask' => S_IP_SUBNET_MASK, 'ip_router' => S_IP_ROUTER, 'ip_macaddress' => S_IP_MACADDRESS, 'oob_ip' => S_OOB_IP, 'oob_subnet_mask' => S_OOB_SUBNET_MASK, 'oob_router' => S_OOB_ROUTER, 'date_hw_buy' => S_DATE_HW_BUY, 'date_hw_install' => S_DATE_HW_INSTALL, 'date_hw_expiry' => S_DATE_HW_EXPIRY, 'date_hw_decomm' => S_DATE_HW_DECOMM, 'site_street_1' => S_SITE_STREET_1, 'site_street_2' => S_SITE_STREET_2, 'site_street_3' => S_SITE_STREET_3, 'site_city' => S_SITE_CITY, 'site_state' => S_SITE_STATE, 'site_country' => S_SITE_COUNTRY, 'site_zip' => S_SITE_ZIP, 'site_rack' => S_SITE_RACK, 'site_notes' => S_SITE_NOTES, 'poc_1_name' => S_POC_1_NAME, 'poc_1_email' => S_POC_1_EMAIL, 'poc_1_phone_1' => S_POC_1_PHONE_1, 'poc_1_phone_2' => S_POC_1_PHONE_2, 'poc_1_cell' => S_POC_1_CELL, 'poc_1_screen' => S_POC_1_SCREEN, 'poc_1_notes' => S_POC_1_NOTES, 'poc_2_name' => S_POC_2_NAME, 'poc_2_email' => S_POC_2_EMAIL, 'poc_2_phone_1' => S_POC_2_PHONE_1, 'poc_2_phone_2' => S_POC_2_PHONE_2, 'poc_2_cell' => S_POC_2_CELL, 'poc_2_screen' => S_POC_2_SCREEN, 'poc_2_notes' => S_POC_2_NOTES);
foreach ($ext_profiles_fields as $field => $caption) {
if (!isset($ext_host_profiles[$field])) {
$ext_host_profiles[$field] = '';
}
}
// END: HOSTS PROFILE EXTENDED Section
$templates = get_request('templates', array());
natsort($templates);
$frm_title = S_HOST . SPACE . S_MASS_UPDATE;
$frmHost = new CFormTable($frm_title, 'hosts.php');
$frmHost->setHelp('web.hosts.host.php');
$frmHost->addVar('go', 'massupdate');
$hosts = $_REQUEST['hosts'];
foreach ($hosts as $id => $hostid) {
$frmHost->addVar('hosts[' . $hostid . ']', $hostid);
}
// $frmItem->addRow(array( new CVisibilityBox('visible[type]', isset($visible['type']), 'type', S_ORIGINAL),S_TYPE), $cmbType);
$frmHost->addRow(S_NAME, S_ORIGINAL);
$grp_tb = new CTweenBox($frmHost, 'groups', $groups, 6);
$options = array('output' => API_OUTPUT_EXTEND, 'editable' => 1);
$all_groups = CHostGroup::get($options);
order_result($all_groups, 'name');
foreach ($all_groups as $grp) {
$grp_tb->addItem($grp['groupid'], $grp['name']);
}
$frmHost->addRow(array(new CVisibilityBox('visible[groups]', isset($visible['groups']), $grp_tb->getName(), S_ORIGINAL), S_GROUPS), $grp_tb->get(S_IN . SPACE . S_GROUPS, S_OTHER . SPACE . S_GROUPS));
$frmHost->addRow(array(new CVisibilityBox('visible[newgroup]', isset($visible['newgroup']), 'newgroup', S_ORIGINAL), S_NEW_GROUP), new CTextBox('newgroup', $newgroup), 'new');
// onchange does not work on some browsers: MacOS, KDE browser
$frmHost->addRow(array(new CVisibilityBox('visible[dns]', isset($visible['dns']), 'dns', S_ORIGINAL), S_DNS_NAME), new CTextBox('dns', $dns, '40'));
$frmHost->addRow(array(new CVisibilityBox('visible[ip]', isset($visible['ip']), 'ip', S_ORIGINAL), S_IP_ADDRESS), new CTextBox('ip', $ip, defined('ZBX_HAVE_IPV6') ? 39 : 15));
$cmbConnectBy = new CComboBox('useip', $useip);
$cmbConnectBy->addItem(0, S_DNS_NAME);
$cmbConnectBy->addItem(1, S_IP_ADDRESS);
$frmHost->addRow(array(new CVisibilityBox('visible[useip]', isset($visible['useip']), 'useip', S_ORIGINAL), S_CONNECT_TO), $cmbConnectBy);
$frmHost->addRow(array(new CVisibilityBox('visible[port]', isset($visible['port']), 'port', S_ORIGINAL), S_AGENT_PORT), new CNumericBox('port', $port, 5));
//Proxy
$cmbProxy = new CComboBox('proxy_hostid', $proxy_hostid);
$cmbProxy->addItem(0, S_NO_PROXY);
$sql = 'SELECT hostid,host ' . ' FROM hosts ' . ' WHERE status IN (' . HOST_STATUS_PROXY_ACTIVE . ',' . HOST_STATUS_PROXY_PASSIVE . ') ' . ' AND ' . DBin_node('hostid') . ' ORDER BY host';
$db_proxies = DBselect($sql);
while ($db_proxy = DBfetch($db_proxies)) {
$cmbProxy->addItem($db_proxy['hostid'], $db_proxy['host']);
}
$frmHost->addRow(array(new CVisibilityBox('visible[proxy_hostid]', isset($visible['proxy_hostid']), 'proxy_hostid', S_ORIGINAL), S_MONITORED_BY_PROXY), $cmbProxy);
//----------
$cmbStatus = new CComboBox('status', $status);
$cmbStatus->addItem(HOST_STATUS_MONITORED, S_MONITORED);
$cmbStatus->addItem(HOST_STATUS_NOT_MONITORED, S_NOT_MONITORED);
$frmHost->addRow(array(new CVisibilityBox('visible[status]', isset($visible['status']), 'status', S_ORIGINAL), S_STATUS), $cmbStatus);
// LINK TEMPLATES {{{
$template_table = new CTable();
$template_table->setAttribute('name', 'template_table');
$template_table->setAttribute('id', 'template_table');
$template_table->setCellPadding(0);
$template_table->setCellSpacing(0);
foreach ($templates as $id => $temp_name) {
$frmHost->addVar('templates[' . $id . ']', $temp_name);
$template_table->addRow(array(new CCheckBox('templates_rem[' . $id . ']', 'no', null, $id), $temp_name));
}
$template_table->addRow(array(new CButton('add_template', S_ADD, "return PopUp('popup.php?dstfrm=" . $frmHost->getName() . "&dstfld1=new_template&srctbl=templates&srcfld1=hostid&srcfld2=host" . url_param($templates, false, 'existed_templates') . "',450,450)"), new CButton('unlink', S_REMOVE)));
$vbox = new CVisibilityBox('visible[template_table]', isset($visible['template_table']), 'template_table', S_ORIGINAL);
$vbox->setAttribute('id', 'cb_tpladd');
if (isset($visible['template_table_r'])) {
$vbox->setAttribute('disabled', 'disabled');
}
$action = $vbox->getAttribute('onclick');
$action .= 'if($("cb_tplrplc").disabled) $("cb_tplrplc").enable(); else $("cb_tplrplc").disable();';
//.........这里部分代码省略.........
示例9: array
$filterForm->addVar('stime', get_request('stime'));
$filterForm->addVar('period', get_request('period'));
if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
$dbTrigger = API::Trigger()->get(array('triggerids' => $_REQUEST['triggerid'], 'output' => array('description', 'expression'), 'selectHosts' => array('name'), 'preservekeys' => true, 'expandDescription' => true));
if ($dbTrigger) {
$dbTrigger = reset($dbTrigger);
$host = reset($dbTrigger['hosts']);
$trigger = $host['name'] . NAME_DELIMITER . $dbTrigger['description'];
} else {
$_REQUEST['triggerid'] = 0;
}
}
if (!isset($trigger)) {
$trigger = '';
}
$filterForm->addRow(new CRow(array(new CCol(_('Trigger'), 'form_row_l'), new CCol(array(new CTextBox('trigger', $trigger, 96, 'yes'), new CButton('btn1', _('Select'), 'return PopUp("popup.php?' . 'dstfrm=' . $filterForm->getName() . '&dstfld1=triggerid' . '&dstfld2=trigger' . '&srctbl=triggers' . '&srcfld1=triggerid' . '&srcfld2=description' . '&real_hosts=1' . '&monitored_hosts=1' . '&with_monitored_triggers=1");', 'T')), 'form_row_r'))));
$filterForm->addItemToBottomRow(new CSubmit('filter_set', _('Filter')));
$filterForm->addItemToBottomRow(new CButton('filter_rst', _('Reset'), 'javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst", 1); location.href = uri.getUrl();'));
}
$eventsWidget->addFlicker($filterForm, CProfile::get('web.events.filter.state', 0));
$scroll = new CDiv();
$scroll->setAttribute('id', 'scrollbar_cntr');
$eventsWidget->addFlicker($scroll, CProfile::get('web.events.filter.state', 0));
/*
* Display
*/
$table = new CTableInfo(_('No events found.'));
// trigger events
if ($source == EVENT_OBJECT_TRIGGER) {
$sourceName = 'trigger';
$firstEvent = API::Event()->get(array('source' => EVENT_SOURCE_TRIGGERS, 'object' => EVENT_OBJECT_TRIGGER, 'output' => API_OUTPUT_EXTEND, 'objectids' => !empty($_REQUEST['triggerid']) ? $_REQUEST['triggerid'] : null, 'sortfield' => array('clock'), 'sortorder' => ZBX_SORT_UP, 'limit' => 1));
示例10: array
$keys = get_request('keys', array());
$frmTRLog->addRow(_('Description'), new CTextBox('description', $description, 80));
$itemName = '';
$dbItems = DBfetchArray(DBselect('SELECT itemid,hostid,name,key_,templateid' . ' FROM items' . ' WHERE itemid=' . zbx_dbstr($itemid)));
$dbItems = CMacrosResolverHelper::resolveItemNames($dbItems);
$dbItem = reset($dbItems);
if ($dbItem['templateid']) {
$template = get_realhost_by_itemid($dbItem['templateid']);
$itemName = $template['host'] . NAME_DELIMITER . $dbItem['name_expanded'];
} else {
$itemName = $dbItem['name_expanded'];
}
$ctb = new CTextBox('item', $itemName, 80);
$ctb->setAttribute('id', 'item');
$ctb->setAttribute('disabled', 'disabled');
$script = "javascript: return PopUp('popup.php?dstfrm=" . $frmTRLog->getName() . "&dstfld1=itemid&dstfld2=item&srctbl=items&srcfld1=itemid&srcfld2=name',800,450);";
$cbtn = new CSubmit('select_item', _('Select'), $script);
$frmTRLog->addRow(_('Item'), array($ctb, $cbtn));
$frmTRLog->addVar('itemid', $itemid);
$exp_select = new CComboBox('expr_type');
$exp_select->setAttribute('id', 'expr_type');
$exp_select->addItem(REGEXP_INCLUDE, _('Include'));
$exp_select->addItem(REGEXP_EXCLUDE, _('Exclude'));
$ctb = new CTextBox('expression', '', 80);
$ctb->setAttribute('id', 'logexpr');
$cb = new CButton('add_exp', _('Add'), 'javascript: add_logexpr();');
$cbAdd = new CButton('add_key_and', _('AND'), 'javascript: add_keyword_and();');
$cbOr = new CButton('add_key_or', _('OR'), 'javascript: add_keyword_or();');
$cbIregexp = new CCheckBox('iregexp', 'no', null, 1);
$frmTRLog->addRow(_('Expression'), array($ctb, BR(), $cbIregexp, 'iregexp', SPACE, $cbAdd, SPACE, $cbOr, SPACE, $exp_select, SPACE, $cb));
$keyTable = new CTableInfo(null);
示例11: get_screen_item_form
function get_screen_item_form()
{
global $USER_DETAILS;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid(true));
$form = new CFormTable(S_SCREEN_CELL_CONFIGURATION, 'screenedit.php#form');
$form->SetHelp('web.screenedit.cell.php');
if (isset($_REQUEST['screenitemid'])) {
$iresult = DBSelect('SELECT * FROM screens_items' . ' WHERE screenid=' . $_REQUEST['screenid'] . ' AND screenitemid=' . $_REQUEST['screenitemid']);
$form->AddVar('screenitemid', $_REQUEST['screenitemid']);
} else {
$form->AddVar('x', $_REQUEST['x']);
$form->AddVar('y', $_REQUEST['y']);
}
if (isset($_REQUEST['screenitemid']) && !isset($_REQUEST['form_refresh'])) {
$irow = DBfetch($iresult);
$resourcetype = $irow['resourcetype'];
$resourceid = $irow['resourceid'];
$width = $irow['width'];
$height = $irow['height'];
$colspan = $irow['colspan'];
$rowspan = $irow['rowspan'];
$elements = $irow['elements'];
$valign = $irow['valign'];
$halign = $irow['halign'];
$style = $irow['style'];
$url = $irow['url'];
$dynamic = $irow['dynamic'];
} else {
$resourcetype = get_request('resourcetype', 0);
$resourceid = get_request('resourceid', 0);
$width = get_request('width', 500);
$height = get_request('height', 100);
$colspan = get_request('colspan', 0);
$rowspan = get_request('rowspan', 0);
$elements = get_request('elements', 25);
$valign = get_request('valign', VALIGN_DEFAULT);
$halign = get_request('halign', HALIGN_DEFAULT);
$style = get_request('style', 0);
$url = get_request('url', '');
$dynamic = get_request('dynamic', SCREEN_SIMPLE_ITEM);
}
$form->addVar('screenid', $_REQUEST['screenid']);
$cmbRes = new CCombobox('resourcetype', $resourcetype, 'submit()');
$cmbRes->addItem(SCREEN_RESOURCE_GRAPH, S_GRAPH);
$cmbRes->addItem(SCREEN_RESOURCE_SIMPLE_GRAPH, S_SIMPLE_GRAPH);
$cmbRes->addItem(SCREEN_RESOURCE_PLAIN_TEXT, S_PLAIN_TEXT);
$cmbRes->addItem(SCREEN_RESOURCE_MAP, S_MAP);
$cmbRes->addItem(SCREEN_RESOURCE_SCREEN, S_SCREEN);
$cmbRes->addItem(SCREEN_RESOURCE_SERVER_INFO, S_SERVER_INFO);
$cmbRes->addItem(SCREEN_RESOURCE_HOSTS_INFO, S_HOSTS_INFO);
$cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_INFO, S_TRIGGERS_INFO);
$cmbRes->addItem(SCREEN_RESOURCE_TRIGGERS_OVERVIEW, S_TRIGGERS_OVERVIEW);
$cmbRes->addItem(SCREEN_RESOURCE_STATUS_OF_TRIGGERS, S_STATUS_OF_TRIGGERS);
$cmbRes->addItem(SCREEN_RESOURCE_DATA_OVERVIEW, S_DATA_OVERVIEW);
$cmbRes->addItem(SCREEN_RESOURCE_CLOCK, S_CLOCK);
$cmbRes->addItem(SCREEN_RESOURCE_URL, S_URL);
$cmbRes->addItem(SCREEN_RESOURCE_ACTIONS, S_HISTORY_OF_ACTIONS);
$cmbRes->addItem(SCREEN_RESOURCE_EVENTS, S_HISTORY_OF_EVENTS);
$form->addRow(S_RESOURCE, $cmbRes);
if ($resourcetype == SCREEN_RESOURCE_GRAPH) {
// User-defined graph
$resourceid = graph_accessible($resourceid) ? $resourceid : 0;
$caption = '';
$id = 0;
if ($resourceid > 0) {
$result = DBselect('SELECT DISTINCT g.graphid,g.name,n.name as node_name, h.host' . ' FROM graphs g ' . ' LEFT JOIN graphs_items gi ON g.graphid=gi.graphid ' . ' LEFT JOIN items i ON gi.itemid=i.itemid ' . ' LEFT JOIN hosts h ON h.hostid=i.hostid ' . ' LEFT JOIN nodes n ON n.nodeid=' . DBid2nodeid('g.graphid') . ' WHERE g.graphid=' . $resourceid);
while ($row = DBfetch($result)) {
$row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : '';
$caption = $row['node_name'] . $row['host'] . ':' . $row['name'];
$id = $resourceid;
}
}
$form->addVar('resourceid', $id);
$textfield = new Ctextbox('caption', $caption, 75, 'yes');
$selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=graphs&srcfld1=graphid&srcfld2=name',800,450);");
$selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$form->AddRow(S_GRAPH_NAME, array($textfield, SPACE, $selectbtn));
} else {
if ($resourcetype == SCREEN_RESOURCE_SIMPLE_GRAPH) {
// Simple graph
$caption = '';
$id = 0;
if ($resourceid > 0) {
$result = DBselect('SELECT n.name as node_name,h.host,i.description,i.itemid,i.key_ ' . ' FROM hosts h,items i ' . ' LEFT JOIN nodes n on n.nodeid=' . DBid2nodeid('i.itemid') . ' WHERE h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('i.hostid', $available_hosts) . ' AND i.itemid=' . $resourceid);
while ($row = DBfetch($result)) {
$description_ = item_description($row);
$row["node_name"] = isset($row["node_name"]) ? "(" . $row["node_name"] . ") " : '';
$caption = $row['node_name'] . $row['host'] . ': ' . $description_;
$id = $resourceid;
}
}
$form->AddVar('resourceid', $id);
$textfield = new Ctextbox('caption', $caption, 75, 'yes');
$selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=simple_graph&srcfld1=itemid&srcfld2=description',800,450);");
$selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$form->AddRow(S_PARAMETER, array($textfield, SPACE, $selectbtn));
} else {
if ($resourcetype == SCREEN_RESOURCE_MAP) {
// Map
$caption = '';
//.........这里部分代码省略.........
示例12: insert_map_link_form
function insert_map_link_form()
{
$frmCnct = new CFormTable('New connector', 'sysmap.php');
$frmCnct->setHelp('web.sysmap.connector.php');
$frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']);
if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
$db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']);
$db_link = DBfetch($db_links);
$selementid1 = $db_link['selementid1'];
$selementid2 = $db_link['selementid2'];
$triggers = array();
$drawtype = $db_link['drawtype'];
$color = $db_link['color'];
$res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']);
while ($rows = DBfetch($res)) {
$triggers[] = $rows;
}
} else {
if (isset($_REQUEST['linkid'])) {
$frmCnct->addVar('linkid', $_REQUEST['linkid']);
}
$selementid1 = get_request('selementid1', 0);
$selementid2 = get_request('selementid2', 0);
$triggers = get_request('triggers', array());
$drawtype = get_request('drawtype', 0);
$color = get_request('color', 0);
}
/* START comboboxes preparations */
$cmbElements1 = new CComboBox('selementid1', $selementid1);
$cmbElements2 = new CComboBox('selementid2', $selementid2);
$map_elements = array();
$sql = 'SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid'];
$db_elements = DBselect($sql);
while ($db_element = DBfetch($db_elements)) {
$map_elements[$db_element['selementid']] = $db_element;
}
order_result($map_elements, 'label');
foreach ($map_elements as $selementid => $db_selement) {
$label = $db_selement['label'];
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
$db_host = get_host_by_hostid($db_selement['elementid']);
$label .= ':' . $db_host['host'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) {
$db_map = get_sysmap_by_sysmapid($db_selement['elementid']);
$label .= ':' . $db_map['name'];
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) {
if ($db_selement['elementid'] > 0) {
$label .= ':' . expand_trigger_description($db_selement['elementid']);
}
} else {
if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) {
if ($db_selement['elementid'] > 0) {
$db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid']));
$label .= ':' . $db_group['name'];
}
}
}
}
}
$cmbElements1->addItem($db_selement['selementid'], $label);
$cmbElements2->addItem($db_selement['selementid'], $label);
}
$cmbType = new CComboBox('drawtype', $drawtype);
foreach (map_link_drawtypes() as $i) {
$value = map_link_drawtype2str($i);
$cmbType->addItem($i, $value);
}
/* END preparation */
$frmCnct->addRow(S_ELEMENT_1, $cmbElements1);
$frmCnct->addRow(S_ELEMENT_2, $cmbElements2);
//trigger links
foreach ($triggers as $id => $trigger) {
if (isset($trigger['triggerid'])) {
$triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']);
}
}
$table = new CTable();
$table->SetClass('tableinfo');
$table->setOddRowClass('even_row');
$table->setEvenRowClass('even_row');
$table->attributes['cellpadding'] = 3;
$table->attributes['cellspacing'] = 1;
$table->headerClass = 'header';
$table->footerClass = 'footer';
$table->setHeader(array(new CCheckBox('all_triggers', null, "checkAll('" . $frmCnct->getName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR));
$table->setAttribute('id', 'link_triggers');
foreach ($triggers as $id => $trigger) {
if (!isset($trigger['triggerid'])) {
continue;
}
$colorbox = new CSpan(SPACE . SPACE . SPACE);
$colorbox->setAttribute('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';');
$link_desc = new CSpan($trigger['description'], 'link');
$link_desc->setAttribute('onclick', "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');");
$table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array($link_desc, new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color']))));
}
$btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T');
//.........这里部分代码省略.........
示例13: bar_report_form2
function bar_report_form2()
{
$config = get_request('config', 1);
$title = get_request('title', _('Report 2'));
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$sorttype = get_request('sorttype', 0);
$items = get_request('items', array());
$periods = get_request('periods', array());
$showlegend = get_request('showlegend', 0);
$reportForm = new CFormTable(null, null, 'get');
//,'events.php?report_set=1','POST',null,'sform');
$reportForm->setAttribute('name', 'zbx_report');
$reportForm->setAttribute('id', 'zbx_report');
// $reportForm->setMethod('post');
if (isset($_REQUEST['report_show']) && !empty($items)) {
$reportForm->addVar('report_show', 'show');
}
$reportForm->addVar('config', $config);
$reportForm->addVar('items', $items);
// periods add later
$reportForm->addRow(_('Title'), new CTextBox('title', $title, 40));
$reportForm->addRow(_('X label'), new CTextBox('xlabel', $xlabel, 40));
$reportForm->addRow(_('Y label'), new CTextBox('ylabel', $ylabel, 40));
$reportForm->addRow(_('Legend'), new CCheckBox('showlegend', $showlegend, null, 1));
if (count($periods) < 2) {
$sortCmb = new CComboBox('sorttype', $sorttype);
$sortCmb->addItem(0, _('Name'));
$sortCmb->addItem(1, _('Value'));
$reportForm->addRow(_('Sort by'), $sortCmb);
} else {
$reportForm->addVar('sortorder', 0);
}
//*/
// PERIODS
if (count($periods)) {
$periods_table = new CTableInfo();
foreach ($periods as $pid => $period) {
$color = new CColorCell(null, $period['color']);
$edit_link = 'popup_period.php?period_id=' . $pid . '&config=2' . '&dstfrm=' . $reportForm->getName() . '&caption=' . $period['caption'] . '&report_timesince=' . $period['report_timesince'] . '&report_timetill=' . $period['report_timetill'] . '&color=' . $period['color'];
$caption = new CSpan($period['caption'], 'link');
$caption->addAction('onclick', "return PopUp('" . $edit_link . "',840,340,'period_form');");
$periods_table->addRow(array(new CCheckBox('group_pid[' . $pid . ']'), $caption, zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timesince']), zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timetill']), $color));
}
$delete_button = new CSubmit('delete_period', _('Delete selected'));
} else {
$periods_table = $delete_button = null;
}
$reportForm->addVar('periods', $periods);
$reportForm->addRow(_('Period'), array($periods_table, new CButton('add_period', _('Add'), "return PopUp('popup_period.php?config=2&dstfrm=" . $reportForm->getName() . "',840,340,'period_form');"), $delete_button));
unset($periods_table, $delete_button);
//-----------
// ITEMS
if (count($items)) {
$items_table = new CTableInfo();
foreach ($items as $gid => $gitem) {
$host = get_host_by_itemid($gitem['itemid']);
$item = get_item_by_itemid($gitem['itemid']);
$caption = new CSpan($gitem['caption'], 'link');
$caption->onClick('return PopUp("popup_bitem.php?config=2&list_name=items&dstfrm=' . $reportForm->GetName() . url_param($gitem, false) . url_param($gid, false, 'gid') . '",550,400,"graph_item_form");');
$description = $host['name'] . ': ' . itemName($item);
$items_table->addRow(array(new CCheckBox('group_gid[' . $gid . ']', isset($group_gid[$gid])), $caption, $description, graph_item_calc_fnc2str($gitem['calc_fnc'], 0)));
}
$delete_button = new CSubmit('delete_item', _('Delete selected'));
} else {
$items_table = $delete_button = null;
}
$reportForm->addRow(_('Items'), array($items_table, new CButton('add_item', _('Add'), "return PopUp('popup_bitem.php?config=2&dstfrm=" . $reportForm->getName() . "',550,400,'graph_item_form');"), $delete_button));
unset($items_table, $delete_button);
//--------------
$reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show')));
$reset = new CButton('reset', _('Reset'));
$reset->setType('reset');
$reportForm->addItemToBottomRow($reset);
return $reportForm;
}
示例14: CFormTable
// FILTER {{{
$filterForm = null;
if (EVENT_SOURCE_TRIGGERS == $source) {
$filterForm = new CFormTable(null, null, 'get');
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addVar('triggerid', get_request('triggerid'));
$filterForm->addVar('stime', get_request('stime'));
$filterForm->addVar('period', get_request('period'));
if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
$trigger = expand_trigger_description($_REQUEST['triggerid']);
} else {
$trigger = '';
}
$row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox('trigger', $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->getName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->addRow($row);
$filterForm->addVar('hide_unknown', $_REQUEST['hide_unknown']);
$unkcbx = new CCheckBox('hide_unk', $_REQUEST['hide_unknown'], null, '1');
$unkcbx->setAction('javascript: create_var("' . $filterForm->GetName() . '", "hide_unknown", (this.checked?1:0), 0); ');
$filterForm->addRow(S_HIDE_UNKNOWN, $unkcbx);
$reset = new CButton('filter_rst', S_RESET);
$reset->setType('button');
$reset->setAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
$filterForm->addItemToBottomRow(new CButton('filter_set', S_FILTER));
$filterForm->addItemToBottomRow($reset);
}
$events_wdgt->addFlicker($filterForm, CProfile::get('web.events.filter.state', 0));
$scroll_div = new CDiv();
$scroll_div->setAttribute('id', 'scrollbar_cntr');
$events_wdgt->addFlicker($scroll_div, CProfile::get('web.events.filter.state', 0));
示例15: CFormTable
if ($db_host) {
$apphost = $db_host["host"];
} else {
$apphost = '';
$apphostid = 0;
}
$frmApp = new CFormTable($frm_title);
$frmApp->setHelp("web.applications.php");
if (isset($_REQUEST["applicationid"])) {
$frmApp->addVar("applicationid", $_REQUEST["applicationid"]);
}
$frmApp->addRow(S_NAME, new CTextBox("appname", $appname, 32));
$frmApp->addVar("apphostid", $apphostid);
if (!isset($_REQUEST["applicationid"])) {
// any new application can SELECT host
$frmApp->addRow(S_HOST, array(new CTextBox("apphost", $apphost, 32, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?dstfrm=" . $frmApp->getName() . "&dstfld1=apphostid&dstfld2=apphost&srctbl=hosts_and_templates&srcfld1=hostid&srcfld2=host',450,450);", 'T')));
}
$frmApp->addItemToBottomRow(new CButton('save', S_SAVE));
if (isset($_REQUEST['applicationid'])) {
$frmApp->addItemToBottomRow(SPACE);
$frmApp->addItemToBottomRow(new CButtonDelete(S_DELETE_APPLICATION, url_param('config') . url_param('hostid') . url_param('groupid') . url_param('form') . url_param('applicationid')));
}
$frmApp->addItemToBottomRow(SPACE);
$frmApp->addItemToBottomRow(new CButtonCancel(url_param("config") . url_param("hostid") . url_param('groupid')));
$app_wdgt->addItem($frmApp);
} else {
$form = new CForm(null, 'get');
$form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB()));
$form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB()));
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');