本文整理汇总了PHP中CForm::setMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::setMethod方法的具体用法?PHP CForm::setMethod怎么用?PHP CForm::setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::setMethod方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_report2_header
function show_report2_header($config, &$PAGE_GROUPS, &$PAGE_HOSTS)
{
global $USER_DETAILS;
$available_groups = $PAGE_GROUPS['groupids'];
$available_hosts = $PAGE_HOSTS['hostids'];
// $available_groups = $PAGE_GROUPS['groupids'];
// $available_hosts = $PAGE_HOSTS['hostids'];
$r_form = new CForm();
$r_form->setMethod('get');
$cmbConf = new CComboBox('config', $config, 'submit()');
$cmbConf->addItem(0, S_BY_HOST);
$cmbConf->addItem(1, S_BY_TRIGGER_TEMPLATE);
$r_form->addItem(array(S_MODE . SPACE, $cmbConf, SPACE));
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
$cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
if (1 == $config) {
$cmbTrigs = new CComboBox('tpl_triggerid', get_request('tpl_triggerid', 0), 'submit()');
$cmbHGrps = new CComboBox('hostgroupid', get_request('hostgroupid', 0), 'submit()');
$cmbTrigs->addItem(0, S_ALL_SMALL);
$cmbHGrps->addItem(0, S_ALL_SMALL);
}
if (0 == $config) {
show_table_header(S_AVAILABILITY_REPORT_BIG, $r_form);
} else {
$sql_cond = ' AND h.hostid=ht.hostid ';
if ($_REQUEST['hostid'] > 0) {
$sql_cond .= ' AND ht.templateid=' . $_REQUEST['hostid'];
}
if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) {
$sql_cond .= ' AND t.templateid=' . $_REQUEST['tpl_triggerid'];
}
$result = DBselect('SELECT DISTINCT g.groupid,g.name ' . ' FROM triggers t,hosts h,items i,functions f, hosts_templates ht, groups g, hosts_groups hg ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond . ' ORDER BY g.name');
while ($row = DBfetch($result)) {
$cmbHGrps->addItem($row['groupid'], get_node_name_by_elid($row['groupid']) . $row['name']);
}
$sql_cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : ' AND ' . DBcondition('h.hostid', $available_hosts);
$sql = 'SELECT DISTINCT t.triggerid,t.description ' . ' FROM triggers t,hosts h,items i,functions f ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND t.triggerid=f.triggerid ' . ' AND h.status=' . HOST_STATUS_TEMPLATE . ' AND ' . DBin_node('t.triggerid') . ' AND i.status=' . ITEM_STATUS_ACTIVE . $sql_cond . ' ORDER BY t.description';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$cmbTrigs->addItem($row['triggerid'], get_node_name_by_elid($row['triggerid']) . expand_trigger_description($row['triggerid']));
}
$rr_form = new CForm();
$rr_form->setMethod('get');
$rr_form->addVar('config', $config);
$rr_form->addVar('groupid', $_REQUEST['groupid']);
$rr_form->addVar('hostid', $_REQUEST['hostid']);
$rr_form->addItem(array(S_TRIGGER . SPACE, $cmbTrigs, BR(), S_FILTER, SPACE, S_HOST_GROUP . SPACE, $cmbHGrps));
show_table_header(S_AVAILABILITY_REPORT_BIG, array($r_form, $rr_form));
}
}
示例2: CDiv
$sub_menu_div->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
if (isset($page['menu']) && $page['menu'] == $label) {
$menu_selected = true;
$sub_menu_div->setAttribute('style', 'display: block;');
insert_js('MMenu.def_label = ' . zbx_jsvalue($label));
} else {
$sub_menu_div->setAttribute('style', 'display: none;');
}
$menu_divs[] = $sub_menu_div;
}
$sub_menu_div = new CDiv(SPACE);
$sub_menu_div->setAttribute('id', 'sub_empty');
$sub_menu_div->setAttribute('style', 'display: ' . ($menu_selected ? 'none;' : 'block;'));
$menu_divs[] = $sub_menu_div;
$search_form = new CForm('search.php');
$search_form->setMethod('get');
$search_form->setAttribute('class', 'thin');
$search_form->addItem(new CDiv(array(S_SEARCH_BIG . ': ', new CTextBox('search', '', 15))));
$search_div = new CDiv($search_form);
$search_div->setAttribute('id', 'zbx_search');
$search_div->setAttribute('class', 'zbx_search');
$sub_menu_table->addRow(array($menu_divs, $search_div));
$page_menu->addItem($sub_menu_table);
//---
/* SEARCH form
$search_form = new CForm('search.php');
$search_form->addItem(new CDiv(array(S_SEARCH_BIG.': ', new CTextBox('search','',20))));
$search_div = new CDiv($search_form);
$search_div->setAttribute('id','zbx_search');
$search_div->setAttribute('class','zbx_search');
示例3: foreach
// expand problem trigger descriptions
foreach ($slaData as &$serviceSla) {
foreach ($serviceSla['problems'] as &$problemTrigger) {
$problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description'];
}
unset($problemTrigger);
}
unset($serviceSla);
$treeData = array();
createServiceMonitoringTree($services, $slaData, $period, $treeData);
$tree = new CServiceTree('service_status_tree', $treeData, array('caption' => _('Service'), 'status' => _('Status'), 'reason' => _('Reason'), 'sla' => _('Problem time'), 'sla2' => nbsp(_('SLA') . ' / ' . _('Acceptable SLA'))));
if ($tree) {
// creates form for choosing a preset interval
$r_form = new CForm();
$r_form->setAttribute('class', 'nowrap');
$r_form->setMethod('get');
$r_form->setAttribute('name', 'period_choice');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$period_combo = new CComboBox('period', $period, 'javascript: submit();');
foreach ($periods as $key => $val) {
$period_combo->addItem($key, $val);
}
$r_form->addItem(array(_('Period') . SPACE, $period_combo));
$srv_wdgt = new CWidget('hat_services', 'service-list service-mon');
$srv_wdgt->addPageHeader(_('IT SERVICES'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$srv_wdgt->addHeader(_('IT services'), $r_form);
$srv_wdgt->addItem(BR());
$srv_wdgt->addItem($tree->getHTML());
$srv_wdgt->show();
} else {
error(_('Cannot format Tree. Check logic structure in service links.'));
示例4: DBend
$host = get_host_by_hostid($db_host['hostid']);
$result &= update_host_status($db_host['hostid'], $status);
/* add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_HOST,
'Old status ['.$host['status'].'] '.'New status ['.$status.']');*/
}
$result = DBend($result);
show_messages($result, S_HOST_STATUS_UPDATED, S_CANNOT_UPDATE_HOST);
unset($_REQUEST['activate']);
}
}
}
}
}
/*** --->>> ACTIONS <<<--- ***/
$frmForm = new CForm();
$frmForm->setMethod('get');
if (!isset($_REQUEST['form'])) {
$frmForm->addItem(new CButton('form', S_CREATE_GROUP));
}
show_table_header(S_CONFIGURATION_OF_GROUPS, $frmForm);
if (isset($_REQUEST['form'])) {
echo SBR;
global $USER_DETAILS;
$groupid = get_request('groupid', 0);
$hosts = get_request('hosts', array());
SDII($hosts);
$frm_title = S_HOST_GROUP;
if ($groupid > 0) {
$group = get_hostgroup_by_groupid($_REQUEST['groupid']);
$name = $group['name'];
$frm_title .= ' [' . $group['name'] . ']';
示例5: CCol
}
} else {
$details = $row['details'];
}
$table->addRow(array(date('Y.M.d H:i:s', $row['clock']), $row['alias'], $row['ip'], $row['resourcetype'], $row['action'], $row['resourceid'], $row['resourcename'], new CCol($details, 'wraptext')));
}
} else {
if (1 == $config) {
$table = get_history_of_actions($limit, $last_clock, $sql_cond);
$count = $table->getNumRows();
}
}
// Navigation
$next_clock = $last_clock;
$navForm = new CForm('audit.php');
$navForm->setMethod('get');
$navForm->addVar('config', $_REQUEST['config']);
$navForm->addVar('prev_clock', $prev_clock);
$navForm->addVar('curr_clock', $curr_clock);
$navForm->addVar('next_clock', $next_clock);
/*
$prev_page = new CDiv(SPACE,'arrowleft');
$prev_page->setAttribute('title','Previous page');
$prev_page->addAction('onclick',new CScript("javascript: alert('left');"));
$next_page = new CDiv(SPACE,'arrowright');
$next_page->setAttribute('title','Next page');
$next_page->addAction('onclick',new CScript("javascript: alert('right');"));
//*/
//*
$prev_page = new CButton('prev_page', '« ' . S_BACK);
示例6: array
$filter_table->setAttribute('border', 0);
$filter_table->setAttribute('width', '100%');
$cmbGroups = $pageFilter->getGroupsCB(true);
$cmbHosts = $pageFilter->getHostsCB(true);
$filter_table->addRow(array(array(bold(_('Group')), ': ', $cmbGroups), array(bold(_('Host')), ': ', $cmbHosts), array()));
$groupids = checkAccessGroup('groupid');
$hostids = checkAccessHost('hostid');
// --------------------------- Fim Filtro ---------------------------------------------------------------------
$options = array();
$options['templated_hosts'] = 1;
$hosts = API::Host()->get($options);
$filtroSegHosts = " hos.status <> 1 AND " . dbConditionInt('hos.hostid', zbx_objectValues($hosts, 'hostid'));
$rep2_wdgt = new CWidget();
$rep2_wdgt->addPageHeader(_zeT('Not Supported Items Report'));
$filter_form = new CForm();
$filter_form->setMethod('get');
$filter_form->setAttribute('name', 'zbx_filter');
$filter_form->setAttribute('id', 'zbx_filter');
$filter = new CButton('filter', _("Filter"));
$filter->onClick("javascript: submit();");
$reset = new CButton('reset', _('Reset'));
$reset->onClick("javascript: clearAllForm('zbx_filter');");
$footer_col = new CCol(array($filter, SPACE, $reset), 'center');
$footer_col->setColSpan(4);
$filter_table->addRow($footer_col);
$filter_form->addItem($filter_table);
// $filterForm = get_report2_filter($config, $PAGE_GROUPS, $PAGE_HOSTS);
$rep2_wdgt->addFlicker($filter_form, true);
if (isset($hostid)) {
$sql_from = '';
$sql_where = '';
示例7: DBend
show_messages($result, _('Item added'), _('Cannot add item'));
$result = DBend($result);
$itemids = array();
if ($result) {
$itemids = $result['itemids'];
}
// Create graphs
if ($graph_create) {
createGraph($itemids, $graph_name, $graph_width, $graph_height, $graph_type, $graph_func, $draw_type, $yaxisside);
}
} else {
// Build widget
//Header
$form = new CForm();
$form->cleanItems();
$form->setMethod('post');
if (isset($_REQUEST['form'])) {
// MIB file import
$import_wdgt = new CWidget();
$import_wdgt->addPageHeader(_('SNMP Builder'), $form);
$data = array();
$data['form'] = get_request('form');
$data['widget'] = $import_wdgt;
$importForm = new CView('administration.snmp_builder', $data);
$import_wdgt->addItem($importForm->render());
$import_wdgt->show();
} else {
$snmp_wdgt = new CWidget();
$message_div = new CDiv();
$message_div->setAttribute("id", "message");
$snmp_wdgt->addItem($message_div);
示例8: get_item_filter_form
function get_item_filter_form(&$items)
{
$filter_group = $_REQUEST['filter_group'];
$filter_host = $_REQUEST['filter_host'];
$filter_application = $_REQUEST['filter_application'];
$filter_description = $_REQUEST['filter_description'];
$filter_type = $_REQUEST['filter_type'];
$filter_key = $_REQUEST['filter_key'];
$filter_snmp_community = $_REQUEST['filter_snmp_community'];
$filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname'];
$filter_snmp_oid = $_REQUEST['filter_snmp_oid'];
$filter_snmp_port = $_REQUEST['filter_snmp_port'];
$filter_value_type = $_REQUEST['filter_value_type'];
$filter_data_type = $_REQUEST['filter_data_type'];
$filter_delay = $_REQUEST['filter_delay'];
$filter_history = $_REQUEST['filter_history'];
$filter_trends = $_REQUEST['filter_trends'];
$filter_status = $_REQUEST['filter_status'];
$filter_templated_items = $_REQUEST['filter_templated_items'];
$filter_with_triggers = $_REQUEST['filter_with_triggers'];
// subfilter
$subfilter_hosts = $_REQUEST['subfilter_hosts'];
$subfilter_apps = $_REQUEST['subfilter_apps'];
$subfilter_types = $_REQUEST['subfilter_types'];
$subfilter_value_types = $_REQUEST['subfilter_value_types'];
$subfilter_status = $_REQUEST['subfilter_status'];
$subfilter_templated_items = $_REQUEST['subfilter_templated_items'];
$subfilter_with_triggers = $_REQUEST['subfilter_with_triggers'];
$subfilter_history = $_REQUEST['subfilter_history'];
$subfilter_trends = $_REQUEST['subfilter_trends'];
$subfilter_interval = $_REQUEST['subfilter_interval'];
$form = new CForm();
$form->setAttribute('name', 'zbx_filter');
$form->setAttribute('id', 'zbx_filter');
$form->setMethod('get');
$form->addVar('filter_hostid', get_request('filter_hostid', get_request('hostid')));
$form->addVar('subfilter_hosts', $subfilter_hosts);
$form->addVar('subfilter_apps', $subfilter_apps);
$form->addVar('subfilter_types', $subfilter_types);
$form->addVar('subfilter_value_types', $subfilter_value_types);
$form->addVar('subfilter_status', $subfilter_status);
$form->addVar('subfilter_templated_items', $subfilter_templated_items);
$form->addVar('subfilter_with_triggers', $subfilter_with_triggers);
$form->addVar('subfilter_history', $subfilter_history);
$form->addVar('subfilter_trends', $subfilter_trends);
$form->addVar('subfilter_interval', $subfilter_interval);
// FORM FOR FILTER DISPLAY {
$table = new CTable('', 'itemfilter');
$table->setCellPadding(0);
$table->setCellSpacing(0);
// 1st col
$col_table1 = new CTable();
$col_table1->setClass('filter');
$col_table1->addRow(array(bold(S_HOST_GROUP . ': '), array(new CTextBox('filter_group', $filter_group, 20), new CButton('btn_group', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->getName() . '&dstfld1=filter_group&srctbl=host_group&srcfld1=name",450,450);', 'G'))));
$col_table1->addRow(array(bold(S_HOST . ': '), array(new CTextBox('filter_host', $filter_host, 20), new CButton('btn_host', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->getName() . '&dstfld1=filter_host&srctbl=hosts_and_templates&srcfld1=host",450,450);', 'H'))));
$col_table1->addRow(array(bold(S_APPLICATION . ': '), array(new CTextBox('filter_application', $filter_application, 20), new CButton('btn_app', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->getName() . '&dstfld1=filter_application&srctbl=applications&srcfld1=name",400,300,"application");', 'A'))));
$col_table1->addRow(array(array(bold(S_DESCRIPTION), SPACE . S_LIKE_SMALL . ': '), new CTextBox("filter_description", $filter_description, 30)));
$col_table1->addRow(array(array(bold(S_KEY), SPACE . S_LIKE_SMALL . ': '), new CTextBox("filter_key", $filter_key, 30)));
// 2nd col
$col_table2 = new CTable();
$col_table2->setClass('filter');
$fTypeVisibility = array();
//first row
$cmbType = new CComboBox("filter_type", $filter_type);
//"javascript: create_var('zbx_filter', 'filter_set', '1', true); ");
$cmbType->setAttribute('id', 'filter_type');
$cmbType->addItem(-1, S_ALL_SMALL);
foreach (array('filter_delay_label', 'filter_delay') as $vItem) {
zbx_subarray_push($fTypeVisibility, -1, $vItem);
}
$itemTypes = item_type2str();
// httptest items are only for internal zabbix logic
unset($itemTypes[ITEM_TYPE_HTTPTEST]);
$cmbType->addItems($itemTypes);
foreach ($itemTypes as $typeNum => $typeLabel) {
if ($typeNum != ITEM_TYPE_TRAPPER) {
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label');
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay');
}
switch ($typeNum) {
case ITEM_TYPE_SNMPV1:
case ITEM_TYPE_SNMPV2C:
$snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_snmp_port_label', 'filter_snmp_port');
foreach ($snmp_types as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
case ITEM_TYPE_SNMPV3:
foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_snmp_port_label', 'filter_snmp_port') as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
}
}
zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ");");
$col21 = new CCol(bold(S_TYPE . ': '));
$col21->setAttribute('style', 'width: 170px');
$col_table2->addRow(array($col21, $cmbType));
//second row
$label221 = new CSpan(bold(S_UPDATE_INTERVAL_IN_SEC . ': '));
//.........这里部分代码省略.........
示例9: mktime
show_history($_REQUEST['itemid'], $_REQUEST['from'], $bstime, $effectiveperiod);
} else {
if ($_REQUEST['action'] == 'showvalues' || $_REQUEST['action'] == 'showlatest') {
if ($_REQUEST['action'] == 'showvalues') {
$time = mktime(substr($bstime, 8, 2), substr($bstime, 10, 2), 0, substr($bstime, 4, 2), substr($bstime, 6, 2), substr($bstime, 0, 4));
$till = $time + $effectiveperiod;
}
$l_header = null;
if (!isset($_REQUEST['plaintext'])) {
if ($item_type == ITEM_VALUE_TYPE_LOG) {
$to_save_request = array('filter_task', 'filter', 'mark_color');
$filter_task = get_request('filter_task', 0);
$filter = get_request('filter', '');
$mark_color = get_request('mark_color', 0);
$r_header = new CForm();
$r_header->setMethod('get');
$r_header->addVar('action', $_REQUEST['action']);
$r_header->addVar('from', $_REQUEST['from']);
$r_header->addVar('period', $_REQUEST['period']);
$r_header->addVar('itemid', $_REQUEST['itemid']);
$cmbFTask = new CComboBox('filter_task', $filter_task, 'submit()');
$cmbFTask->addItem(FILTER_TAST_SHOW, S_SHOW_SELECTED);
$cmbFTask->addItem(FILTER_TAST_HIDE, S_HIDE_SELECTED);
$cmbFTask->addItem(FILTER_TAST_MARK, S_MARK_SELECTED);
$cmbFTask->addItem(FILTER_TAST_INVERT_MARK, S_MARK_OTHERS);
$r_header->addItem(array(S_SELECT_ROWS_WITH_VALUE_LIKE, SPACE, new CTextBox('filter', $filter, 25), $cmbFTask, SPACE));
if (str_in_array($filter_task, array(FILTER_TAST_MARK, FILTER_TAST_INVERT_MARK))) {
$cmbColor = new CComboBox('mark_color', $mark_color);
$cmbColor->addItem(MARK_COLOR_RED, S_AS_RED);
$cmbColor->addItem(MARK_COLOR_GREEN, S_AS_GREEN);
$cmbColor->addItem(MARK_COLOR_BLUE, S_AS_BLUE);