本文整理汇总了PHP中CFormTable::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormTable::setAttribute方法的具体用法?PHP CFormTable::setAttribute怎么用?PHP CFormTable::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormTable
的用法示例。
在下文中一共展示了CFormTable::setAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CWidget
$trigg_wdgt = new CWidget();
$r_form = new CForm(null, 'get');
$r_form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB(true)));
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$fs_icon = get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']));
$trigg_wdgt->addPageHeader(S_STATUS_OF_TRIGGERS_BIG . ' [' . date(S_DATE_FORMAT_YMDHMS) . ']', array($fs_icon));
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$trigg_wdgt->addHeader(S_TRIGGERS_BIG, $r_form);
$trigg_wdgt->addHeader($numrows);
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable(null, null, 'get');
//,'tr_status.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$filterForm->addVar('groupid', $_REQUEST['groupid']);
$filterForm->addVar('hostid', $_REQUEST['hostid']);
$tr_select = new CComboBox('show_triggers', $show_triggers);
$tr_select->addItem(TRIGGERS_OPTION_ALL, S_ANY);
$tr_select->additem(TRIGGERS_OPTION_ONLYTRUE, S_PROBLEM);
$filterForm->addRow(S_TRIGGERS_STATUS, $tr_select);
if ($config['event_ack_enable']) {
$cb_ack_status = new CComboBox('ack_status', $ack_status);
$cb_ack_status->addItem(ZBX_ACK_STS_ANY, S_ANY);
$cb_ack_status->additem(ZBX_ACK_STS_WITH_UNACK, S_WITH_UNACKNOWLEDGED_EVENTS);
$cb_ack_status->additem(ZBX_ACK_STS_WITH_LAST_UNACK, S_WITH_LAST_EVENT_UNACKNOWLEDGED);
$filterForm->addRow(S_ACKNOWLEDGE_STATUS, $cb_ack_status);
}
示例2: unset
}
unset($_REQUEST['groupids'][$groupid]);
}
}
}
}
$dashboard_wdgt = new CWidget();
// Header
$dashboard_wdgt->setClass('header');
$dashboard_wdgt->addPageHeader(S_DASHBOARD_CONFIGURATION_BIG, SPACE);
//-------------
// GROUPS
$dashForm = new CFormTable(S_FILTER);
$dashForm->addVar('form_refresh', 1);
$dashForm->setName('dashconf');
$dashForm->setAttribute('id', 'dashform');
if (isset($_REQUEST['form_refresh'])) {
$filterEnable = get_request('filterEnable', 0);
$groupids = get_request('groupids', array());
$groupids = zbx_toHash($groupids);
$grpswitch = get_request('grpswitch', 0);
$maintenance = get_request('maintenance', 0);
$extAck = get_request('extAck', 0);
$severity = get_request('trgSeverity', array());
$severity = array_keys($severity);
} else {
$filterEnable = CProfile::get('web.dashconf.filter.enable', 0);
$groupids = get_favorites('web.dashconf.groups.groupids');
$groupids = zbx_objectValues($groupids, 'value');
$groupids = zbx_toHash($groupids);
$grpswitch = CProfile::get('web.dashconf.groups.grpswitch', 0);
示例3: 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', S_REPORT . ' 3');
$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', date('YmdHis', time() - 86400));
$report_timetill = get_request('report_timetill', date('YmdHis'));
$captions = get_request('captions', array());
$items = get_request('items', array());
$hostids = get_request('hostids', array());
$hostids = zbx_toHash($hostids);
$showlegend = get_request('showlegend', 0);
$palette = get_request('palette', 0);
$palettetype = get_request('palettetype', 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('report_timesince', date('YmdHis', $report_timesince));
$reportForm->addVar('report_timetill', date('YmdHis', $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', $groupids, 10);
$options = array('real_hosts' => 1, 'output' => 'extend');
$db_groups = CHostGroup::get($options);
order_result($db_groups, 'name');
foreach ($db_groups as $gnum => $group) {
$groupids[$group['groupid']] = $group['groupid'];
$group_tb->addItem($group['groupid'], $group['name']);
}
$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');
$groupid = get_request('groupid', 0);
$cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
$cmbGroups->addItem(0, S_ALL_S);
foreach ($db_groups as $gnum => $group) {
$cmbGroups->addItem($group['groupid'], $group['name']);
}
$td_groups = new CCol(array(S_GROUP, SPACE, $cmbGroups));
$td_groups->setAttribute('style', 'text-align: right;');
$host_tb = new CTweenBox($reportForm, 'hostids', $hostids, 10);
$options = array('real_hosts' => 1, 'output' => array('hostid', 'host'));
if ($groupid > 0) {
$options['groupids'] = $groupid;
}
$db_hosts = CHost::get($options);
$db_hosts = zbx_toHash($db_hosts, 'hostid');
order_result($db_hosts, 'host');
foreach ($db_hosts as $hnum => $host) {
$host_tb->addItem($host['hostid'], $host['host']);
}
$options = array('real_hosts' => 1, 'output' => array('hostid', 'host'), 'hostids' => $hostids);
$db_hosts2 = CHost::get($options);
order_result($db_hosts2, 'host');
foreach ($db_hosts2 as $hnum => $host) {
if (!isset($db_hosts[$host['hostid']])) {
$host_tb->addItem($host['hostid'], $host['host']);
}
}
$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->setAttribute('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);");
$reporttimetab->addRow(array(S_TILL, new CNumericBox('report_till_day', $report_timetill > 0 ? date('d', $report_timetill) : '', 2), '/', new CNumericBox('report_till_month', $report_timetill > 0 ? date('m', $report_timetill) : '', 2), '/', new CNumericBox('report_till_year', $report_timetill > 0 ? date('Y', $report_timetill) : '', 4), SPACE, new CNumericBox('report_till_hour', $report_timetill > 0 ? date('H', $report_timetill) : '', 2), ':', new CNumericBox('report_till_minute', $report_timetill > 0 ? date('i', $report_timetill) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,' . '["report_till_day","report_till_month","report_till_year","report_till_hour","report_till_minute"],' . '"avail_report_till",' . '"report_timetill");');
zbx_add_post_js('addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_since\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_since\'].clndr));' . 'addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_till\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_till\'].clndr));');
$reportForm->addRow(S_PERIOD, $reporttimetab);
//-----------
$scale = new CComboBox('scaletype', $scaletype);
$scale->addItem(TIMEPERIOD_TYPE_HOURLY, S_HOURLY);
$scale->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY);
//.........这里部分代码省略.........
示例4: 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->setAttribute('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'];
示例5: CTextBox
}
// $value = new CDiv($value);
// $value->setAttribute('style','text-align: right;');
// $frmLcls->addRow($value, new CTextBox('langTo['.$key.']',$valueTo,80));
$frmLcls->addRow(new CTextBox('langTo[' . $key . ']', $valueTo, 80), $value);
$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->setAttribute('id', 'locales');
$cmbLang = new CComboBox('srclang', get_request('srclang', 'en_gb'));
foreach ($ZBX_LOCALES as $id => $name) {
$cmbLang->addItem($id, $name);
}
$frmLcls->addRow(S_TAKE_DEF_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(S_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);
示例6: valueComparisonFormForMultiplePeriods
/**
* Create report bar for for "Compare values for multiple periods"
*
* @return object $reportForm
*/
function valueComparisonFormForMultiplePeriods()
{
$config = get_request('config', 1);
$title = get_request('title', _('Report 3'));
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$scaletype = get_request('scaletype', TIMEPERIOD_TYPE_WEEKLY);
$avgperiod = get_request('avgperiod', TIMEPERIOD_TYPE_DAILY);
$report_timesince = get_request('report_timesince', date(TIMESTAMP_FORMAT_ZERO_TIME, time() - SEC_PER_DAY));
$report_timetill = get_request('report_timetill', date(TIMESTAMP_FORMAT_ZERO_TIME));
$itemId = get_request('itemid', 0);
$hostids = get_request('hostids', array());
$hostids = zbx_toHash($hostids);
$showlegend = get_request('showlegend', 0);
$palette = get_request('palette', 0);
$palettetype = get_request('palettetype', 0);
$reportForm = new CFormTable(null, null, 'get');
$reportForm->setAttribute('name', 'zbx_report');
$reportForm->setAttribute('id', 'zbx_report');
if (isset($_REQUEST['report_show']) && $itemId) {
$reportForm->addVar('report_show', 'show');
}
$reportForm->addVar('config', $config);
$reportForm->addVar('report_timesince', date(TIMESTAMP_FORMAT, $report_timesince));
$reportForm->addVar('report_timetill', date(TIMESTAMP_FORMAT, $report_timetill));
$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));
$reportForm->addVar('sortorder', 0);
$groupids = get_request('groupids', array());
$group_tb = new CTweenBox($reportForm, 'groupids', $groupids, 10);
$options = array('real_hosts' => true, 'output' => 'extend');
$db_groups = API::HostGroup()->get($options);
order_result($db_groups, 'name');
foreach ($db_groups as $gnum => $group) {
$groupids[$group['groupid']] = $group['groupid'];
$group_tb->addItem($group['groupid'], $group['name']);
}
$reportForm->addRow(_('Groups'), $group_tb->Get(_('Selected groups'), _('Other groups')));
$groupid = get_request('groupid', 0);
$cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
$cmbGroups->addItem(0, _('All'));
foreach ($db_groups as $gnum => $group) {
$cmbGroups->addItem($group['groupid'], $group['name']);
}
$td_groups = new CCol(array(_('Group'), SPACE, $cmbGroups));
$td_groups->setAttribute('style', 'text-align: right;');
$host_tb = new CTweenBox($reportForm, 'hostids', $hostids, 10);
$options = array('real_hosts' => true, 'output' => array('hostid', 'name'));
if ($groupid > 0) {
$options['groupids'] = $groupid;
}
$db_hosts = API::Host()->get($options);
$db_hosts = zbx_toHash($db_hosts, 'hostid');
order_result($db_hosts, 'name');
foreach ($db_hosts as $hnum => $host) {
$host_tb->addItem($host['hostid'], $host['name']);
}
$options = array('real_hosts' => true, 'output' => array('hostid', 'name'), 'hostids' => $hostids);
$db_hosts2 = API::Host()->get($options);
order_result($db_hosts2, 'name');
foreach ($db_hosts2 as $hnum => $host) {
if (!isset($db_hosts[$host['hostid']])) {
$host_tb->addItem($host['hostid'], $host['name']);
}
}
$reportForm->addRow(_('Hosts'), $host_tb->Get(_('Selected hosts'), array(_('Other hosts | Group') . SPACE, $cmbGroups)));
$reporttimetab = new CTable(null, 'calendar');
$timeSinceRow = createDateSelector('report_timesince', $report_timesince, 'report_timetill');
array_unshift($timeSinceRow, _('From'));
$reporttimetab->addRow($timeSinceRow);
$timeTillRow = createDateSelector('report_timetill', $report_timetill, 'report_timesince');
array_unshift($timeTillRow, _('Till'));
$reporttimetab->addRow($timeTillRow);
$reportForm->addRow(_('Period'), $reporttimetab);
$scale = new CComboBox('scaletype', $scaletype);
$scale->addItem(TIMEPERIOD_TYPE_HOURLY, _('Hourly'));
$scale->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily'));
$scale->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly'));
$scale->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly'));
$scale->addItem(TIMEPERIOD_TYPE_YEARLY, _('Yearly'));
$reportForm->addRow(_('Scale'), $scale);
$avgcmb = new CComboBox('avgperiod', $avgperiod);
$avgcmb->addItem(TIMEPERIOD_TYPE_HOURLY, _('Hourly'));
$avgcmb->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily'));
$avgcmb->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly'));
$avgcmb->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly'));
$avgcmb->addItem(TIMEPERIOD_TYPE_YEARLY, _('Yearly'));
$reportForm->addRow(_('Average by'), $avgcmb);
$itemName = '';
if ($itemId) {
$itemName = get_item_by_itemid($itemId);
$itemName = itemName($itemName);
}
//.........这里部分代码省略.........
示例7: 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->setAttribute('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);
/* dependencies */
$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', S_DELETE_SELECTED);
}
// $frmMTrig->addRow(S_THE_TRIGGER_DEPENDS_ON,$dep_el);
/* end dependencies */
/* new dependency */
//$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->setAttribute('id', 'dependency_box');
$frmMTrig->addRow(array(new CVisibilityBox('visible[dependencies]', isset($visible['dependencies']), 'dependency_box', S_ORIGINAL), S_TRIGGER_DEPENDENCIES), $dep_div);
/* end new dependency */
$frmMTrig->addItemToBottomRow(new CButton('mass_save', S_SAVE));
$frmMTrig->addItemToBottomRow(SPACE);
$frmMTrig->addItemToBottomRow(new CButtonCancel(url_param('config') . url_param('groupid')));
$frmMTrig->show();
}
示例8: bar_report_form3
function bar_report_form3()
{
$config = get_request('config', 1);
$title = get_request('title', _('Report 3'));
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$scaletype = get_request('scaletype', TIMEPERIOD_TYPE_WEEKLY);
$avgperiod = get_request('avgperiod', TIMEPERIOD_TYPE_DAILY);
$report_timesince = get_request('report_timesince', date('YmdHis', time() - SEC_PER_DAY));
$report_timetill = get_request('report_timetill', date('YmdHis'));
$items = get_request('items', array());
$hostids = get_request('hostids', array());
$hostids = zbx_toHash($hostids);
$showlegend = get_request('showlegend', 0);
$palette = get_request('palette', 0);
$palettetype = get_request('palettetype', 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('report_timesince', date('YmdHis', $report_timesince));
$reportForm->addVar('report_timetill', date('YmdHis', $report_timetill));
// $reportForm->addVar('items',$items); //params are set later!!
// $reportForm->addVar('periods',$periods);
$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));
$reportForm->addVar('sortorder', 0);
// GROUPS
$groupids = get_request('groupids', array());
$group_tb = new CTweenBox($reportForm, 'groupids', $groupids, 10);
$options = array('real_hosts' => 1, 'output' => 'extend');
$db_groups = API::HostGroup()->get($options);
order_result($db_groups, 'name');
foreach ($db_groups as $gnum => $group) {
$groupids[$group['groupid']] = $group['groupid'];
$group_tb->addItem($group['groupid'], $group['name']);
}
$reportForm->addRow(_('Groups'), $group_tb->Get(_('Selected groups'), _('Other groups')));
// ----------
// HOSTS
// validate_group(PERM_READ_ONLY,array('real_hosts'),'web.last.conf.groupid');
$groupid = get_request('groupid', 0);
$cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
$cmbGroups->addItem(0, _('All'));
foreach ($db_groups as $gnum => $group) {
$cmbGroups->addItem($group['groupid'], $group['name']);
}
$td_groups = new CCol(array(_('Group'), SPACE, $cmbGroups));
$td_groups->setAttribute('style', 'text-align: right;');
$host_tb = new CTweenBox($reportForm, 'hostids', $hostids, 10);
$options = array('real_hosts' => 1, 'output' => array('hostid', 'name'));
if ($groupid > 0) {
$options['groupids'] = $groupid;
}
$db_hosts = API::Host()->get($options);
$db_hosts = zbx_toHash($db_hosts, 'hostid');
order_result($db_hosts, 'name');
foreach ($db_hosts as $hnum => $host) {
$host_tb->addItem($host['hostid'], $host['name']);
}
$options = array('real_hosts' => 1, 'output' => array('hostid', 'name'), 'hostids' => $hostids);
$db_hosts2 = API::Host()->get($options);
order_result($db_hosts2, 'name');
foreach ($db_hosts2 as $hnum => $host) {
if (!isset($db_hosts[$host['hostid']])) {
$host_tb->addItem($host['hostid'], $host['name']);
}
}
$reportForm->addRow(_('Hosts'), $host_tb->Get(_('Selected hosts'), array(_('Other hosts | 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->setAttribute('width', '10%');
$reporttimetab->setCellPadding(0);
$reporttimetab->setCellSpacing(0);
$reporttimetab->addRow(array(_('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);");
$reporttimetab->addRow(array(_('Till'), new CNumericBox('report_till_day', $report_timetill > 0 ? date('d', $report_timetill) : '', 2), '/', new CNumericBox('report_till_month', $report_timetill > 0 ? date('m', $report_timetill) : '', 2), '/', new CNumericBox('report_till_year', $report_timetill > 0 ? date('Y', $report_timetill) : '', 4), SPACE, new CNumericBox('report_till_hour', $report_timetill > 0 ? date('H', $report_timetill) : '', 2), ':', new CNumericBox('report_till_minute', $report_timetill > 0 ? date('i', $report_timetill) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,' . '["report_till_day","report_till_month","report_till_year","report_till_hour","report_till_minute"],' . '"avail_report_till",' . '"report_timetill");');
zbx_add_post_js('addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_since\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_since\'].clndr));' . 'addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_till\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_till\'].clndr));');
$reportForm->addRow(_('Period'), $reporttimetab);
$scale = new CComboBox('scaletype', $scaletype);
$scale->addItem(TIMEPERIOD_TYPE_HOURLY, _('Hourly'));
$scale->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily'));
$scale->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly'));
$scale->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly'));
$scale->addItem(TIMEPERIOD_TYPE_YEARLY, _('Yearly'));
$reportForm->addRow(_('Scale'), $scale);
$avgcmb = new CComboBox('avgperiod', $avgperiod);
//.........这里部分代码省略.........
示例9: insert_mass_update_trigger_form
function insert_mass_update_trigger_form()
{
//$elements_array_name){
$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->addVar('go', get_request('go', 'massupdate'));
$frmMTrig->setAttribute('id', 'massupdate');
$frmMTrig->setName('trig_form');
$triggers = $_REQUEST['g_triggerid'];
foreach ($triggers as $id => $triggerid) {
$frmMTrig->addVar('g_triggerid[' . $triggerid . ']', $triggerid);
}
$cmbPrior = new CComboBox("priority", $priority);
$cmbPrior->addItems(get_severity_description());
$frmMTrig->addRow(array(new CVisibilityBox('visible[priority]', isset($visible['priority']), 'priority', S_ORIGINAL), S_SEVERITY), $cmbPrior);
/* dependencies */
$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', S_DELETE_SELECTED);
}
// $frmMTrig->addRow(S_THE_TRIGGER_DEPENDS_ON,$dep_el);
/* end dependencies */
/* new dependency */
//$frmMTrig->addVar('new_dependence','0');
$btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?dstfrm=massupdate&dstact=add_dependence&reference=deptrigger" . "&dstfld1=new_dependence[]&srctbl=triggers&objname=triggers&srcfld1=triggerid&multiselect=1" . "',1000,700);", 'T');
array_push($dep_el, array(br(), $btnSelect));
$dep_div = new CDiv($dep_el);
$dep_div->setAttribute('id', 'dependency_box');
$frmMTrig->addRow(array(new CVisibilityBox('visible[dependencies]', isset($visible['dependencies']), 'dependency_box', S_ORIGINAL), S_TRIGGER_DEPENDENCIES), $dep_div);
/* end new dependency */
$frmMTrig->addItemToBottomRow(new CButton('mass_save', S_SAVE));
$frmMTrig->addItemToBottomRow(SPACE);
$frmMTrig->addItemToBottomRow(new CButtonCancel(url_param('groupid')));
$script = "function addPopupValues(list){\n\t\t\t\t\t\tif(!isset('object', list)) return false;\n\n\t\t\t\t\t\tif(list.object == 'deptrigger'){\n\t\t\t\t\t\t\tfor(var i=0; i < list.values.length; i++){\n\t\t\t\t\t\t\t\tcreate_var('" . $frmMTrig->getName() . "', 'new_dependence['+i+']', list.values[i], false);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcreate_var('" . $frmMTrig->getName() . "','add_dependence', 1, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}";
insert_js($script);
return $frmMTrig;
}