本文整理汇总了PHP中CForm::AddVar方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::AddVar方法的具体用法?PHP CForm::AddVar怎么用?PHP CForm::AddVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::AddVar方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CSpan
}
}
$tr_desc = new CSpan(expand_trigger_description_by_data($row, ZBX_FLAG_EVENT), 'pointer');
$tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $row['triggerid'] . "', 'lastchange': '" . $row['clock'] . "'})," . zbx_jsvalue($row['items']) . ");");
$table->AddRow(array(new CLink(date('Y.M.d H:i:s', $row['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row['eventid'], 'action'), is_show_subnodes() ? get_node_name_by_elid($row['triggerid']) : null, $_REQUEST['hostid'] == 0 ? $row['host'] : null, $tr_desc, $value, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row['value'])), $duration, $config['event_ack_enable'] ? $ack : NULL, $actions));
$col++;
}
}
}
/************************* FILTER **************************/
/***********************************************************/
// Navigation
$nav_time = get_request('nav_time', time());
$navForm = new CForm('events.php');
if (isset($_REQUEST['groupid'])) {
$navForm->AddVar('groupid', $_REQUEST['groupid']);
}
if (isset($_REQUEST['hostid'])) {
$navForm->AddVar('hostid', $_REQUEST['hostid']);
}
$navForm->AddVar('fullscreen', $_REQUEST['fullscreen']);
// $navForm->AddVar('nav_time',$_REQUEST['nav_time']);
$back = new CButton('back', '« ' . S_DAY);
$next = new CButton('next', S_DAY . ' »');
if ($nav_time + 86400 > time()) {
$next->AddOption('disabled', 'disabled');
}
$script = new CScript("javascript: if(CLNDR['nav_time'].clndr.setSDateFromOuterObj()){" . "this.action += '?nav_time='+parseInt(CLNDR['nav_time'].clndr.sdt.getTime()/1000);}");
$navForm->AddAction('onsubmit', $script);
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->AddAction('onclick', "javascript: var pos = getPosition(this); pos.top+=14; pos.left-=174; CLNDR['nav_time'].clndr.clndrshow(pos.top,pos.left);");
示例2: array
$fields = array("serviceid" => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, NULL), "period" => array(T_ZBX_STR, O_OPT, null, IN('"dayly","weekly","monthly","yearly"'), NULL), "year" => array(T_ZBX_INT, O_OPT, null, null, NULL));
check_fields($fields);
$period = get_request("period", "weekly");
$year = get_request("year", date("Y"));
define("YEAR_LEFT_SHIFT", 5);
if (!DBfetch(DBselect('select serviceid from services where serviceid=' . $_REQUEST["serviceid"]))) {
fatal_error(S_NO_IT_SERVICE_DEFINED);
}
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_IDS_ARRAY);
$sql = 'SELECT s.* ' . ' FROM services s ' . ' WHERE s.serviceid=' . $_REQUEST['serviceid'] . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' AND ' . DBin_node('s.serviceid');
if (!($service = DBfetch(DBselect($sql)))) {
access_deny();
}
$form = new CForm();
$form->SetMethod('get');
$form->AddVar("serviceid", $_REQUEST["serviceid"]);
$cmbPeriod = new CComboBox("period", $period, "submit();");
$cmbPeriod->AddItem("dayly", S_DAILY);
$cmbPeriod->AddItem("weekly", S_WEEKLY);
$cmbPeriod->AddItem("monthly", S_MONTHLY);
$cmbPeriod->AddItem("yearly", S_YEARLY);
$form->AddItem(array(SPACE . S_PERIOD . SPACE, $cmbPeriod));
$cmbYear = new CComboBox("year", $year, "submit();");
for ($y = date("Y") - YEAR_LEFT_SHIFT; $y <= date("Y"); $y++) {
$cmbYear->AddItem($y, $y);
}
$form->AddItem(array(SPACE . S_YEAR . SPACE, $cmbYear));
show_table_header(array(S_IT_SERVICES_AVAILABILITY_REPORT_BIG, SPACE . "\"", new CLink($service["name"], "srv_status.php?serviceid=" . $service["serviceid"]), "\""), $form);
$table = new CTableInfo();
$header = array(S_OK, S_PROBLEMS, S_DOWNTIME, S_PERCENTAGE, S_SLA);
switch ($period) {
示例3: array
if (2 != $_REQUEST['fullscreen']) {
update_profile('web.screens.elementid', $_REQUEST['elementid']);
}
$_REQUEST['period'] = get_request('period', get_profile('web.screens.period', ZBX_PERIOD_DEFAULT, null, $_REQUEST['elementid']));
if ($_REQUEST['period'] >= ZBX_MIN_PERIOD) {
update_profile('web.screens.period', $_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['elementid']);
}
$elementid = get_request('elementid', null);
if ($elementid <= 0) {
$elementid = null;
}
$p_elements = array();
$text = null;
$form = new CForm();
$form->SetMethod('get');
$form->AddVar('fullscreen', $_REQUEST['fullscreen']);
if (isset($_REQUEST['period'])) {
$form->AddVar('period', $_REQUEST['period']);
}
if (isset($_REQUEST['stime'])) {
$form->AddVar('stime', $_REQUEST['stime']);
}
$cmbConfig = new CComboBox('config', $config, "javascript: redirect('slides.php?config=1');");
$cmbConfig->addItem(0, S_SCREENS);
$cmbConfig->addItem(1, S_SLIDESHOWS);
$form->AddItem(array(S_SHOW . SPACE, $cmbConfig));
$cmbElements = new CComboBox('elementid', $elementid, 'submit()');
unset($screen_correct);
unset($first_screen);
$result = DBselect('SELECT screenid as elementid, name ' . ' FROM screens ' . ' WHERE ' . DBin_node('screenid') . ' ORDER BY name');
while ($row = DBfetch($result)) {
示例4: CButton
$form->setName('hosts');
$form->addVar("config", $config);
$form->addVar('update', true);
$form->addVar('hosts', $hosts);
$form->addVar('templates', $templates);
$form->addVar('items', $items);
$form->addVar('graphs', $graphs);
$form->addVar('triggers', $triggers);
$form->addItem(array(new CButton('back', S_BACK), new CButton('preview', S_REFRESH), new CButton('export', S_EXPORT)));
$table->setFooter(new CCol($form));
$table->showEnd();
} else {
/* table HOSTS */
$form = new CForm(null, 'post');
$form->SetName('hosts');
$form->AddVar('config', $config);
$form->AddVar('update', true);
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
$header = get_table_header(S_HOSTS_BIG, array(S_GROUP . SPACE, $cmbGroups));
$form->addItem($header);
$table = new CTableInfo(S_NO_HOSTS_DEFINED);
$table->setHeader(array(array(new CCheckBox("all_hosts", true, "CheckAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host')), make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), make_sorting_link(S_STATUS, 'h.status'), array(new CCheckBox("all_templates", true, "CheckAll('" . $form->GetName() . "','all_templates','templates');"), S_TEMPLATES), array(new CCheckBox("all_items", true, "CheckAll('" . $form->GetName() . "','all_items','items');"), S_ITEMS), array(new CCheckBox("all_triggers", true, "CheckAll('" . $form->GetName() . "','all_triggers','triggers');"), S_TRIGGERS), array(new CCheckBox("all_graphs", true, "CheckAll('" . $form->GetName() . "','all_graphs','graphs');"), S_GRAPHS)));
$sql_from = '';
$sql_where = '';
if ($_REQUEST['groupid'] > 0) {
$sql_from .= ' ,hosts_groups hg ';
$sql_where .= ' AND hg.groupid=' . $_REQUEST['groupid'] . ' AND hg.hostid=h.hostid ';
}
示例5: foreach
echo $dstfrm;
?>
'];
<!--
<?php
foreach ($new_group as $id => $name) {
echo 'add_var_to_opener_obj(form,"new_group[' . $id . ']","' . $name . '")' . "\r";
}
?>
if(form)
{
form.submit();
close_window();
}
-->
</script>
<?php
}
$form = new CForm();
$form->AddVar('dstfrm', $dstfrm);
$form->SetName('groups');
$table = new CTableInfo(S_NO_GROUPS_DEFINED);
$table->SetHeader(array(array(new CCheckBox("all_groups", NULL, "CheckAll('" . $form->GetName() . "','all_groups');"), S_NAME)));
$result = DBselect('select * from usrgrp where ' . DBin_node('usrgrpid') . ' order by name');
while ($row = DBfetch($result)) {
$table->AddRow(array(array(new CCheckBox('new_group[' . $row['usrgrpid'] . ']', isset($new_group[$row['usrgrpid']]), NULL, $row['name']), $row['name'])));
}
$table->SetFooter(new CButton('select', S_SELECT));
$form->AddItem($table);
$form->Show();
include_once "include/page_footer.php";
示例6: CForm
$table->SetFooter($td);
$form->AddItem($table);
$form->Show();
}
//-------------------------------------------- </PARENT SERVICES LIST> --------------------------------------------
//---------------------------------------------- <CHILD SERVICES LIST> --------------------------------------------
if (isset($_REQUEST['cservices'])) {
if (isset($service)) {
$service = get_service_by_serviceid($service['serviceid']);
}
// update date after ACTIONS
show_table_header(S_IT_SERVICES_BIG);
$form = new CForm();
$form->SetName("services");
if (isset($service)) {
$form->AddVar("serviceid", $service['serviceid']);
}
$table = new CTableInfo();
$table->SetHeader(array(S_SERVICE, S_STATUS_CALCULATION, S_TRIGGER));
if (isset($service)) {
$childs = get_service_childs($service['serviceid'], 1);
$childs_str = implode(',', $childs);
!empty($childs_str) ? $childs_str .= ',' : '';
$query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' AND s.serviceid NOT IN (' . $childs_str . $service['serviceid'] . ') ' . ' ORDER BY s.sortorder,s.name';
} else {
$query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder,s.name';
}
$db_services = DBselect($query);
while ($db_service_data = DBfetch($db_services)) {
$prefix = null;
$trigger = "-";
示例7: array
require_once "include/config.inc.php";
$page["title"] = "S_RESOURCE";
$page["file"] = "popup_right.php";
define('ZBX_PAGE_NO_MENU', 1);
include_once "include/page_header.php";
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array("dstfrm" => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, NULL), "permission" => array(T_ZBX_INT, O_MAND, P_SYS, IN(PERM_DENY . ',' . PERM_READ_ONLY . ',' . PERM_READ_WRITE), NULL), 'nodeid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL));
check_fields($fields);
$dstfrm = get_request("dstfrm", 0);
// destination form
$permission = get_request("permission", PERM_DENY);
// right
$nodeid = get_request('nodeid', get_profile('web.popup_right.nodeid.last', get_current_nodeid(false)));
update_profile('web.popup_right.nodeid.last', $nodeid);
$frmTitle = new CForm();
$frmTitle->AddVar('dstfrm', $dstfrm);
$frmTitle->AddVar('permission', $permission);
if (ZBX_DISTRIBUTED) {
$available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY);
$cmbResourceNode = new CComboBox('nodeid', $nodeid, 'submit();');
$cmbResourceNode->AddItem(0, S_ALL_S);
$sql = 'SELECT name,nodeid FROM nodes WHERE ' . DBcondition('nodeid', $available_nodes);
$db_nodes = DBselect($sql);
while ($node = DBfetch($db_nodes)) {
$cmbResourceNode->AddItem($node['nodeid'], $node['name']);
}
$frmTitle->AddItem(array(S_NODE, SPACE, $cmbResourceNode));
}
show_table_header(permission2str($permission), $frmTitle);
$form = new CForm();
$form->addOption('id', 'groups');
示例8: isset
$bstime = isset($_REQUEST['stime']) ? $_REQUEST['stime'] : date('YmdHi', time() - $_REQUEST['period']);
$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 = array(S_SHOWING_HISTORY_OF . SPACE . zbx_date2age(0, $effectiveperiod), '[' . S_FROM_SMALL . ': ' . date('Y.M.d H:i:s', $time) . ']');
} else {
$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);
$r_header->AddItem(array($cmbColor, SPACE));
示例9: unset
unset($_REQUEST["sysmapid"]);
}
}
unset($all_maps[0]);
if (isset($_REQUEST["sysmapid"])) {
update_profile("web.maps.sysmapid", $_REQUEST["sysmapid"]);
}
$p_elements = array();
$text = null;
if (isset($_REQUEST["sysmapid"])) {
$sysmap = get_sysmap_by_sysmapid($_REQUEST["sysmapid"]);
$text = $all_maps[$_REQUEST["sysmapid"]];
}
$form = new CForm();
$form->SetMethod('get');
$form->AddVar("fullscreen", $_REQUEST["fullscreen"]);
$cmbMaps = new CComboBox("sysmapid", get_request("sysmapid", 0), "submit()");
foreach ($all_maps as $id => $name) {
$cmbMaps->AddItem($id, $name);
}
if ($cmbMaps->ItemsCount() > 0) {
$form->AddItem($cmbMaps);
$p_elements[] = get_table_header($text, $form);
}
$table = new CTable(S_NO_MAPS_DEFINED, "map");
if (isset($_REQUEST["sysmapid"])) {
$action_map = get_action_map_by_sysmapid($_REQUEST["sysmapid"]);
$table->AddRow($action_map);
$imgMap = new CImg("map.php?noedit=1&sysmapid=" . $_REQUEST["sysmapid"]);
$imgMap->SetMap($action_map->GetName());
$table->AddRow($imgMap);