本文整理汇总了PHP中CFormTable::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormTable::addOption方法的具体用法?PHP CFormTable::addOption怎么用?PHP CFormTable::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormTable
的用法示例。
在下文中一共展示了CFormTable::addOption方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert_mass_update_trigger_form
function insert_mass_update_trigger_form()
{
//$elements_array_name){
global $USER_DETAILS;
$visible = get_request('visible', array());
$priority = get_request('priority', '');
$dependencies = get_request('dependencies', array());
$original_templates = array();
asort($dependencies);
$frmMTrig = new CFormTable(S_TRIGGERS_MASSUPDATE, 'triggers.php');
$frmMTrig->addVar('massupdate', get_request('massupdate', 1));
$frmMTrig->addOption('id', 'massupdate');
$triggers = $_REQUEST['g_triggerid'];
foreach ($triggers as $id => $triggerid) {
$frmMTrig->addVar('g_triggerid[' . $triggerid . ']', $triggerid);
}
$cmbPrior = new CComboBox("priority", $priority);
for ($i = 0; $i <= 5; $i++) {
$cmbPrior->addItem($i, get_severity_description($i));
}
$frmMTrig->addRow(array(new CVisibilityBox('visible[priority]', isset($visible['priority']), 'priority', S_ORIGINAL), S_SEVERITY), $cmbPrior);
/* fependencies */
$dep_el = array();
foreach ($dependencies as $val) {
array_push($dep_el, array(new CCheckBox("rem_dependence[]", 'no', null, strval($val)), expand_trigger_description($val)), BR());
$frmMTrig->addVar("dependencies[]", strval($val));
}
if (count($dep_el) == 0) {
$dep_el[] = S_NO_DEPENDENCES_DEFINED;
} else {
$dep_el[] = new CButton('del_dependence', 'delete selected');
}
// $frmMTrig->addRow(S_THE_TRIGGER_DEPENDS_ON,$dep_el);
/* end dependencies */
/* new dependence */
//$frmMTrig->addVar('new_dependence','0');
$btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?dstfrm=massupdate&dstact=add_dependence" . "&dstfld1=new_dependence[]&srctbl=triggers&objname=triggers&srcfld1=1&multiselect=1" . "',600,450);", 'T');
array_push($dep_el, array(br(), $btnSelect));
$dep_div = new CDiv($dep_el);
$dep_div->addOption('id', 'dependency_box');
$frmMTrig->addRow(array(new CVisibilityBox('visible[dependencies]', isset($visible['dependencies']), 'dependency_box', S_ORIGINAL), S_TRIGGER_DEPENDENCIES), $dep_div);
/* end new dependence */
$frmMTrig->addItemToBottomRow(new CButton('mass_save', S_SAVE));
$frmMTrig->addItemToBottomRow(SPACE);
$frmMTrig->addItemToBottomRow(new CButtonCancel(url_param('config') . url_param('groupid')));
$frmMTrig->Show();
}
示例2: Clink
show_table_header($header, $frmForm);
}
}
/************************* FILTER **************************/
/***********************************************************/
$prev = 'Prev 100';
$next = 'Next 100';
if ($_REQUEST['start'] > 0) {
$prev = new Clink('Prev ' . PAGE_SIZE, 'audit.php?prev=1' . url_param('start') . url_param('config'), 'styled');
}
if ($table->GetNumRows() >= PAGE_SIZE) {
$next = new Clink('Next ' . PAGE_SIZE, 'audit.php?next=1' . url_param('start') . url_param('config'), 'styled');
}
$filterForm = new CFormTable(S_FILTER);
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->addOption('name', 'zbx_filter');
$filterForm->addOption('id', 'zbx_filter');
$filterForm->setMethod('get');
$script = new CScript("javascript: if(CLNDR['audit_since'].clndr.setSDateFromOuterObj()){" . "\$('filter_timesince').value = parseInt(CLNDR['audit_since'].clndr.sdt.getTime()/1000);}" . "if(CLNDR['audit_till'].clndr.setSDateFromOuterObj()){" . "\$('filter_timetill').value = parseInt(CLNDR['audit_till'].clndr.sdt.getTime()/1000);}");
$filterForm->addAction('onsubmit', $script);
$filterForm->addVar('filter_timesince', $_REQUEST['filter_timesince'] > 0 ? $_REQUEST['filter_timesince'] : '');
$filterForm->addVar('filter_timetill', $_REQUEST['filter_timetill'] > 0 ? $_REQUEST['filter_timetill'] : '');
$filterForm->addVar('config', $_REQUEST['config']);
$filterForm->addVar('userid', $_REQUEST['userid']);
if (isset($_REQUEST['userid']) && $_REQUEST['userid'] > 0) {
$user = get_user_by_userid($_REQUEST['userid']);
} else {
$user['alias'] = '';
}
$row = new CRow(array(new CCol($config == 1 ? S_RECIPIENT : S_USER, 'form_row_l'), new CCol(array(new CTextBox("user", $user['alias'], 32, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=userid&dstfld2=user" . "&srctbl=users&srcfld1=userid&srcfld2=alias&real_hosts=1');", 'T')), 'form_row_r')));
$filterForm->addRow($row);
示例3: unset
}
show_messages($result, S_SCRIPT_DELETED, S_CANNOT_DELETE_SCRIPT);
if ($result) {
unset($_REQUEST['form']);
unset($_REQUEST['scriptid']);
}
}
}
}
$row_count = 0;
if (isset($_REQUEST['form'])) {
$available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY);
show_table_header(S_SCRIPTS);
echo SBR;
$frmScr = new CFormTable(S_SCRIPT, 'scripts.php', 'POST', null, 'form');
$frmScr->addOption('id', 'scripts');
if (isset($_REQUEST['scriptid'])) {
$frmScr->addVar('scriptid', $_REQUEST['scriptid']);
}
if (!isset($_REQUEST['scriptid']) || isset($_REQUEST['form_refresh'])) {
$name = get_request('name', '');
$command = get_request('command', '');
$usrgrpid = get_request('usrgrpid', 0);
$groupid = get_request('groupid', 0);
$access = get_request('access', PERM_READ_ONLY);
}
if (isset($_REQUEST['scriptid']) && !isset($_REQUEST['form_refresh'])) {
$frmScr->addVar('form_refresh', get_request('form_refresh', 1));
if ($script = get_script_by_scriptid($_REQUEST['scriptid'])) {
$name = $script['name'];
$command = $script['command'];
示例4: bar_report_form3
function bar_report_form3()
{
global $USER_DETAILS;
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
$config = get_request('config', 1);
$title = get_request('title', 'Report 2');
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$sorttype = get_request('sorttype', 0);
$scaletype = get_request('scaletype', TIMEPERIOD_TYPE_WEEKLY);
$avgperiod = get_request('avgperiod', TIMEPERIOD_TYPE_DAILY);
$report_timesince = get_request('report_timesince', time() - 86400);
$report_timetill = get_request('report_timetill', time());
$captions = get_request('captions', array());
$items = get_request('items', array());
$hostids = get_request('hostids', array());
$showlegend = get_request('showlegend', 0);
$palette = get_request('palette', 0);
$palettetype = get_request('palettetype', 0);
$reportForm = new CFormTable(S_REPORTS, null, 'get');
//,'events.php?report_set=1','POST',null,'sform');
$reportForm->addOption('name', 'zbx_report');
$reportForm->addOption('id', 'zbx_report');
// $reportForm->setMethod('post');
if (isset($_REQUEST['report_show']) && !empty($items)) {
$reportForm->addVar('report_show', 'show');
}
$reportForm->addVar('config', $config);
$reportForm->addVar('report_timesince', $report_timesince > 0 ? $report_timesince : '');
$reportForm->addVar('report_timetill', $report_timetill > 0 ? $report_timetill : '');
// $reportForm->addVar('items',$items); //params are set later!!
// $reportForm->addVar('periods',$periods);
$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));
$reportForm->addVar('sortorder', 0);
// GROUPS
$groupids = get_request('groupids', array());
$group_tb = new CTweenBox($reportForm, 'groupids', null, 10);
$sql_from = '';
$sql_where = 'AND ' . DBcondition('g.groupid', $groupids);
$sql = 'SELECT DISTINCT g.groupid, g.name ' . ' FROM hosts h, hosts_groups hg, groups g ' . $sql_from . ' WHERE hg.groupid=g.groupid' . ' AND h.hostid=hg.hostid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . $sql_where . ' ORDER BY g.name';
//SDI($sql);
$db_groups = DBselect($sql);
while ($group = DBfetch($db_groups)) {
$groupids[$group['groupid']] = $group['groupid'];
$group_tb->addItem($group['groupid'], $group['name'], true);
}
$sql = 'SELECT DISTINCT g.* ' . ' FROM hosts h, hosts_groups hg, groups g ' . ' WHERE hg.groupid=g.groupid' . ' AND h.hostid=hg.hostid ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBcondition('g.groupid', $groupids, true) . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' ORDER BY g.name';
$db_groups = DBselect($sql);
while ($group = DBfetch($db_groups)) {
$group_tb->addItem($group['groupid'], $group['name'], false);
}
$reportForm->addRow(S_GROUPS, $group_tb->Get(S_SELECTED_GROUPS, S_OTHER . SPACE . S_GROUPS));
// ----------
// HOSTS
// validate_group(PERM_READ_ONLY,array('real_hosts'),'web.last.conf.groupid');
$cmbGroups = new CComboBox('groupid', get_request('groupid', 0), 'submit()');
$cmbGroups->addItem(0, S_ALL_S);
$sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g,hosts_groups hg,hosts h ' . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND g.groupid=hg.groupid ' . ' AND h.hostid=hg.hostid' . ' AND h.status IN (' . HOST_STATUS_MONITORED . ') ' . ' ORDER BY g.name';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$cmbGroups->addItem($row['groupid'], $row['name']);
}
$td_groups = new CCol(array(S_GROUP, SPACE, $cmbGroups));
$td_groups->addOption('style', 'text-align: right;');
$host_tb = new CTweenBox($reportForm, 'hostids', null, 10);
$sql_from = '';
$sql_where = 'AND ' . DBcondition('h.hostid', $hostids);
$sql = 'SELECT DISTINCT h.hostid, h.host ' . ' FROM hosts h ' . $sql_from . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . $sql_where . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' ORDER BY h.host';
$db_hosts = DBselect($sql);
while ($host = DBfetch($db_hosts)) {
$hostids[$host['hostid']] = $host['hostid'];
$host_tb->addItem($host['hostid'], $host['host'], true);
}
$sql_from = '';
$sql_where = '';
if (isset($_REQUEST['groupid']) && $_REQUEST['groupid'] > 0) {
$sql_from .= ', hosts_groups hg ';
$sql_where .= ' AND hg.groupid=' . $_REQUEST['groupid'] . ' AND h.hostid=hg.hostid ';
}
$sql = 'SELECT DISTINCT h.* ' . ' FROM hosts h ' . $sql_from . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . ' AND ' . DBcondition('h.hostid', $hostids, true) . ' AND h.status IN (' . HOST_STATUS_MONITORED . ') ' . $sql_where . ' ORDER BY h.host';
$db_hosts = DBselect($sql);
while ($host = DBfetch($db_hosts)) {
$host_tb->addItem($host['hostid'], $host['host'], false);
}
$reportForm->addRow(S_HOSTS, $host_tb->Get(S_SELECTED_HOSTS, array(S_OTHER . SPACE . S_HOSTS . SPACE . '|' . SPACE . S_GROUP . SPACE, $cmbGroups)));
// ----------
//*/
// PERIOD
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_since'].clndr.clndrshow(pos.top,pos.left);");
$reporttimetab = new CTable(null, 'calendar');
$reporttimetab->addOption('width', '10%');
$reporttimetab->setCellPadding(0);
$reporttimetab->setCellSpacing(0);
$reporttimetab->addRow(array(S_FROM, new CNumericBox('report_since_day', $report_timesince > 0 ? date('d', $report_timesince) : '', 2), '/', new CNumericBox('report_since_month', $report_timesince > 0 ? date('m', $report_timesince) : '', 2), '/', new CNumericBox('report_since_year', $report_timesince > 0 ? date('Y', $report_timesince) : '', 4), SPACE, new CNumericBox('report_since_hour', $report_timesince > 0 ? date('H', $report_timesince) : '', 2), ':', new CNumericBox('report_since_minute', $report_timesince > 0 ? date('i', $report_timesince) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,' . '["report_since_day","report_since_month","report_since_year","report_since_hour","report_since_minute"],' . '"avail_report_since",' . '"report_timesince");');
$clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_till'].clndr.clndrshow(pos.top,pos.left);");
//.........这里部分代码省略.........
示例5: Ctextbox
if (defined('ZBX_MBSTRINGS_ENABLED')) {
$value = mb_convert_encoding($value, 'UTF-8', mb_detect_encoding($value));
$valueTo = mb_convert_encoding($valueTo, 'UTF-8', mb_detect_encoding($valueTo));
}
$frmLcls->addRow($value, new Ctextbox('langTo[' . $key . ']', $valueTo, 80));
$value = '';
}
$frmLcls->addItemToBottomRow(new CButton('prev', '<< ' . S_PREVIOUS));
$frmLcls->addItemToBottomRow(SPACE);
$frmLcls->addItemToBottomRow(new CButton('download', S_DOWNLOAD));
$frmLcls->Show();
} else {
show_table_header(S_LOCALES);
echo SBR;
$frmLcls = new CFormTable(S_CREATE . SPACE . S_LOCALE_SMALL, 'locales.php', 'post', null, 'form');
$frmLcls->addOption('id', 'locales');
$cmbLang = new CComboBox('srclang', get_request('srclang', 'en_gb'));
foreach ($ZBX_LOCALES as $id => $name) {
$cmbLang->addItem($id, $name);
}
$frmLcls->addRow('Take for default locale', $cmbLang);
$cmbExtLang = new CComboBox('extlang', get_request('extlang', 'new'));
$cmbExtLang->addItem('new', S_CREATE . SPACE . S_NEW_SMALL);
foreach ($ZBX_LOCALES as $id => $name) {
$cmbExtLang->addItem($id, $name);
}
$frmLcls->addRow('Locale to extend', $cmbExtLang);
$cmbFill = new CComboBox('fill', get_request('fill', 1));
$cmbFill->addItem('0', S_DO_NOT_ADD);
$cmbFill->addItem('1', S_LEAVE_EMPTY);
$cmbFill->addItem('2', S_FILL_WITH_DEFAULT_VALUE);