本文整理汇总了PHP中CTable::addOption方法的典型用法代码示例。如果您正苦于以下问题:PHP CTable::addOption方法的具体用法?PHP CTable::addOption怎么用?PHP CTable::addOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTable
的用法示例。
在下文中一共展示了CTable::addOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($caption_l = S_IN, $caption_r = S_OTHER)
{
$grp_tab = new CTable();
$grp_tab->addOption('name', $this->name);
$grp_tab->addOption('id', $this->name);
$grp_tab->setCellSpacing(0);
$grp_tab->setCellPadding(0);
if (!is_null($caption_l) || !is_null($caption_r)) {
$grp_tab->addRow(array($caption_l, SPACE, $caption_r));
}
$add_btn = new CButton('add', ' « ');
//S_ADD);//
$add_btn->setType('button');
$add_btn->setAction('javascript: moveListBoxSelectedItem("' . $this->form->GetName() . '","' . $this->varname . '","' . $this->id_r . '","' . $this->id_l . '","add");');
$rmv_btn = new CButton('remove', ' » ');
//S_REMOVE);//
$rmv_btn->setType('button');
$rmv_btn->setAction('javascript: moveListBoxSelectedItem("' . $this->form->GetName() . '","' . $this->varname . '","' . $this->id_l . '","' . $this->id_r . '","rmv");');
$grp_tab->addRow(array($this->lbox, new CCol(array($add_btn, BR(), $rmv_btn), 'top'), $this->rbox));
return $grp_tab;
}
示例2: CDiv
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
//-------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->addOption('border', 0);
$left_tab->addRow(create_hat(S_EVENT . SPACE . S_SOURCE . SPACE . S_DETAILS, make_trigger_details($_REQUEST['triggerid'], $trigger_data), null, 'hat_triggerdetails'));
$left_tab->addRow(create_hat(S_EVENT_DETAILS, make_event_details($_REQUEST['eventid']), null, 'hat_eventdetails'));
$right_tab = new CTable();
$right_tab->setCellPadding(3);
$right_tab->setCellSpacing(3);
$right_tab->addOption('border', 0);
$right_tab->addRow(create_hat(S_ACKNOWLEDGES, make_acktab_by_eventid($_REQUEST['eventid']), null, 'hat_eventack', get_profile('web.tr_events.hats.hat_eventack.state', 1)));
$right_tab->addRow(create_hat(S_MESSAGE_ACTIONS, get_action_msgs_for_event($_REQUEST['eventid']), null, 'hat_eventactionmsgs', get_profile('web.tr_events.hats.hat_eventactionmsgs.state', 1)));
$right_tab->addRow(create_hat(S_COMMAND_ACTIONS, get_action_cmds_for_event($_REQUEST['eventid']), null, 'hat_eventactioncmds', get_profile('web.tr_events.hats.hat_eventactioncmds.state', 1)));
$right_tab->addRow(create_hat(S_EVENTS . SPACE . S_LIST . SPACE . '[' . S_LAST . ' 20]', make_small_eventlist($_REQUEST['triggerid'], $trigger_data), null, 'hat_eventlist', get_profile('web.tr_events.hats.hat_eventlist.state', 1)));
$td_l = new CCol($left_tab);
$td_l->addOption('valign', 'top');
$td_r = new CCol($right_tab);
$td_r->addOption('valign', 'top');
$outer_table = new CTable();
$outer_table->addOption('border', 0);
$outer_table->setCellPadding(1);
$outer_table->setCellSpacing(1);
$outer_table->addRow(array($td_l, $td_r));
$p_elements[] = $outer_table;
$latest_hat = create_hat($text, $p_elements, array($fs_icon), 'hat_tr_events', get_profile('web.tr_events.hats.hat_tr_events.state', 1));
$latest_hat->show();
include_once 'include/page_footer.php';
示例3: CTable
$frmMaintenance->addVar('maintenanceid', $_REQUEST['maintenanceid']);
}
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->addOption('border', 0);
$left_tab->addRow(create_hat(S_MAINTENANCE, get_maintenance_form(), null, 'hat_maintenance'));
$left_tab->addRow(create_hat(S_MAINTENANCE_PERIODS, get_maintenance_periods(), null, 'hat_timeperiods'));
if (isset($_REQUEST['new_timeperiod'])) {
$new_timeperiod = $_REQUEST['new_timeperiod'];
$left_tab->addRow(create_hat(is_array($new_timeperiod) && isset($new_timeperiod['id']) ? S_EDIT_MAINTENANCE_PERIOD : S_NEW_MAINTENANCE_PERIOD, get_timeperiod_form(), null, 'hat_new_timeperiod'));
}
$right_tab = new CTable();
$right_tab->setCellPadding(3);
$right_tab->setCellSpacing(3);
$right_tab->addOption('border', 0);
$right_tab->addRow(create_hat(S_HOSTS_IN_MAINTENANCE, get_maintenance_hosts_form($frmMaintenance), null, 'hat_host_link'));
$right_tab->addRow(create_hat(S_GROUPS_IN_MAINTENANCE, get_maintenance_groups_form($frmMaintenance), null, 'hat_group_link'));
$td_l = new CCol($left_tab);
$td_l->addOption('valign', 'top');
$td_r = new CCol($right_tab);
$td_r->addOption('valign', 'top');
$outer_table = new CTable();
$outer_table->addOption('border', 0);
$outer_table->setCellPadding(1);
$outer_table->setCellSpacing(1);
$outer_table->addRow(array($td_l, $td_r));
$frmMaintenance->additem($outer_table);
show_messages();
$frmMaintenance->show();
// insert_maintenance_form();
示例4: time
$color = get_request('color', '009900');
$report_timesince = get_request('report_timesince', time() - 86400);
$report_timetill = get_request('report_timetill', time());
$frmPd->addVar('config', $config);
$frmPd->addVar('report_timesince', $report_timesince);
$frmPd->addVar('report_timetill', $report_timetill);
if (isset($_REQUEST['period_id'])) {
$frmPd->addVar('period_id', $_REQUEST['period_id']);
}
$frmPd->addRow(array(new CVisibilityBox('caption_visible', !zbx_empty($caption), 'caption', S_DEFAULT), S_CAPTION), new CTextBox('caption', $caption, 10));
// $frmPd->addRow(S_CAPTION, new CTextBox('caption',$caption,10));
//*
$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);");
$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");');
$frmPd->addRow(S_PERIOD, $reporttimetab);
//*/
if ($config != 1) {
$frmPd->addRow(S_COLOR, new CColor('color', $color));
} else {
$frmPd->addVar('color', $color);
}
$frmPd->addItemToBottomRow(new CButton('save', isset($_REQUEST['period_id']) ? S_UPDATE : S_ADD));
示例5: create_filter
function create_filter($col_l, $col_r, $items, $id = 'zbx_filter', $state = 1)
{
if (isset($_REQUEST['print'])) {
$state = 0;
}
$table = new CTable();
$table->addOption('width', '100%');
$table->setCellPadding(0);
$table->setCellSpacing(0);
$table->addOption('border', 0);
$icon = new CDiv(SPACE, $state ? 'filteropened' : 'filterclosed');
$icon->addAction('onclick', new CScript("javascript: change_filter_state(this,'" . $id . "');"));
$icon->addOption('title', S_MAXIMIZE . '/' . S_MINIMIZE);
$icon->addAction('id', 'filter_icon');
$td_icon = new CCol($icon);
$td_icon->addOption('valign', 'bottom');
$icons_row = array($td_icon, SPACE);
$icons_row[] = $col_l;
$icon_tab = new CTable();
$icon_tab->setCellSpacing(0);
$icon_tab->setCellPadding(0);
$icon_tab->addRow($icons_row);
$table->addRow(get_thin_table_header($icon_tab, $col_r));
$div = new CDiv($items);
$div->addOption('id', $id);
if (!$state) {
$div->addOption('style', 'display: none;');
}
$tab = new CTable();
$tab->addRow($div);
// $table->addRow($tab);
$table->addRow($div);
return $table;
}
示例6: show_messages
function show_messages($bool = TRUE, $okmsg = NULL, $errmsg = NULL)
{
global $page, $ZBX_MESSAGES;
if (!defined('PAGE_HEADER_LOADED')) {
return;
}
if (!isset($page["type"])) {
$page["type"] = PAGE_TYPE_HTML;
}
$message = array();
$width = 0;
$height = 0;
$img_space = null;
if (!$bool && !is_null($errmsg)) {
$msg = 'ERROR: ' . $errmsg;
} else {
if ($bool && !is_null($okmsg)) {
$msg = $okmsg;
}
}
if (isset($msg)) {
switch ($page['type']) {
case PAGE_TYPE_IMAGE:
array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2));
$width = max($width, ImageFontWidth(2) * strlen($msg) + 1);
$height += imagefontheight(2) + 1;
break;
case PAGE_TYPE_XML:
echo htmlspecialchars($msg) . "\n";
break;
case PAGE_TYPE_HTML:
default:
$msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr');
$msg_tab->setCellPadding(0);
$msg_tab->setCellSpacing(0);
$msg_col = new CCol(bold($msg), 'msg_main msg');
$msg_col->addOption('id', 'page_msg');
$msg_details = SPACE;
if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
$msg_details = new CDiv(array(S_DETAILS), 'pointer');
$msg_details->addAction('onclick', new CScript("javascript: ShowHide('msg_messages', IE?'block':'table');"));
$msg_details->addOption('title', S_MAXIMIZE . '/' . S_MINIMIZE);
}
$msg_tab->addRow(array(new CCol($msg_details, 'clr'), $msg_col));
$msg_tab->Show();
$img_space = new CImg('images/general/tree/zero.gif', 'space', '100', '2');
break;
}
}
if (isset($ZBX_MESSAGES)) {
if ($page['type'] == PAGE_TYPE_IMAGE) {
$msg_font = 2;
foreach ($ZBX_MESSAGES as $msg) {
if ($msg['type'] == 'error') {
array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font));
} else {
array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font));
}
$width = max($width, imagefontwidth($msg_font) * strlen($msg['message']) + 1);
$height += imagefontheight($msg_font) + 1;
}
} else {
if ($page['type'] == PAGE_TYPE_XML) {
foreach ($ZBX_MESSAGES as $msg) {
echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n";
}
} else {
$lst_error = new CList(null, 'messages');
foreach ($ZBX_MESSAGES as $msg) {
$lst_error->addItem($msg['message'], $msg['type']);
$bool = $bool && 'error' != strtolower($msg['type']);
}
//message scroll if needed
$msg_show = 6;
$msg_count = count($ZBX_MESSAGES);
if ($msg_count > $msg_show) {
$msg_count = $msg_show;
$msg_count = $msg_count * 16;
$lst_error->addOption('style', 'height: ' . $msg_count . 'px;');
}
$tab = new CTable(null, $bool ? 'msgok' : 'msgerr');
$tab->setCellPadding(0);
$tab->setCellSpacing(0);
$tab->addOption('id', 'msg_messages');
$tab->addOption('style', 'width: 100%;');
if (isset($msg_tab) && $bool) {
$tab->addOption('style', 'display: none;');
}
$tab->addRow(new CCol($lst_error, 'msg'));
$tab->Show();
//---
}
}
$ZBX_MESSAGES = null;
}
if (!is_null($img_space)) {
print unpack_object($img_space);
}
if ($page['type'] == PAGE_TYPE_IMAGE && count($message) > 0) {
$width += 2;
//.........这里部分代码省略.........
示例7: 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);
$db_selements = DBselect('SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid']);
while ($db_selement = DBfetch($db_selements)) {
$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->options['cellpadding'] = 3;
$table->options['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->addOption('id', 'link_triggers');
foreach ($triggers as $id => $trigger) {
if (!isset($trigger['triggerid'])) {
continue;
}
$colorbox = new CSpan(SPACE . SPACE . SPACE);
$colorbox->addOption('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';');
$table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array(new CLink($trigger['description'], "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');"), 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');
$btnRemove = new CButton('btn1', S_REMOVE, "javascript: remove_childs('" . $frmCnct->GetName() . "','triggers','tr');", 'T');
$btnadd->SetType('button');
$frmCnct->addRow(S_LINK_STATUS_INDICATORS, array($table, BR(), $btnadd, $btnRemove));
//----------
$frmCnct->addRow(S_TYPE . ' (' . S_OK_BIG . ')', $cmbType);
$frmCnct->addRow(S_COLOR . ' (' . S_OK_BIG . ')', new CColor('color', $color));
$frmCnct->addItemToBottomRow(new CButton("save_link", S_SAVE));
if (isset($_REQUEST["linkid"])) {
//.........这里部分代码省略.........
示例8: 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);");
//.........这里部分代码省略.........
示例9: CDiv
$url = '?elementid=' . $elementid . ($_REQUEST['fullscreen'] ? '' : '&fullscreen=1');
$url .= url_param('groupid') . url_param('hostid');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
}
$menu = array();
$submenu = array();
// js menu arrays
make_refresh_menu('mainpage', 'hat_slides', get_profile('web.slides.rf_rate.hat_slides', 30), array('elementid' => $elementid), $menu, $submenu);
insert_js('var page_menu=' . zbx_jsvalue($menu) . ";\n" . 'var page_submenu=' . zbx_jsvalue($submenu) . ";\n");
// --------------
$tab = new CTable();
$tab->setCellPadding(0);
$tab->setCellSpacing(0);
$tab->addOption('border', 0);
$tab->addOption('width', '100%');
// Refresh tab
$refresh_tab = array(array('id' => 'hat_slides', 'frequency' => get_profile('web.slides.rf_rate.hat_slides', 30), 'url' => 'slides.php?elementid=' . $elementid . url_param('stime') . url_param('period') . url_param('groupid') . url_param('hostid'), 'params' => array('lastupdate' => time())));
add_doll_objects($refresh_tab);
$refresh_icon = new CDiv(SPACE, 'iconmenu');
$refresh_icon->addAction('onclick', 'javascript: create_page_menu(event,"hat_slides");');
$refresh_icon->addOption('title', S_MENU);
if (isset($elementid)) {
$effectiveperiod = navigation_bar_calc();
if (2 != $_REQUEST['fullscreen']) {
$stime = time() - 31536000;
// ~1year
$bstime = time() - $effectiveperiod;
if (isset($_REQUEST['stime'])) {
$bstime = $_REQUEST['stime'];
示例10: CFormTable
} else {
if (isset($_REQUEST['hostid'])) {
/************************* FILTER *************************/
/***********************************************************/
$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('post');
$filterForm->addVar('filter_timesince', $_REQUEST['filter_timesince'] > 0 ? $_REQUEST['filter_timesince'] : '');
$filterForm->addVar('filter_timetill', $_REQUEST['filter_timetill'] > 0 ? $_REQUEST['filter_timetill'] : '');
//*
$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);");
$filtertimetab = new CTable(null, 'calendar');
$filtertimetab->addOption('width', '10%');
$filtertimetab->setCellPadding(0);
$filtertimetab->setCellSpacing(0);
$filtertimetab->addRow(array(S_FROM, new CNumericBox('filter_since_day', $_REQUEST['filter_timesince'] > 0 ? date('d', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_month', $_REQUEST['filter_timesince'] > 0 ? date('m', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_year', $_REQUEST['filter_timesince'] > 0 ? date('Y', $_REQUEST['filter_timesince']) : '', 4), SPACE, new CNumericBox('filter_since_hour', $_REQUEST['filter_timesince'] > 0 ? date('H', $_REQUEST['filter_timesince']) : '', 2), ':', new CNumericBox('filter_since_minute', $_REQUEST['filter_timesince'] > 0 ? date('i', $_REQUEST['filter_timesince']) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,' . '["filter_since_day","filter_since_month","filter_since_year","filter_since_hour","filter_since_minute"],' . '"avail_report_since",' . '"filter_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);");
$filtertimetab->AddRow(array(S_TILL, new CNumericBox('filter_till_day', $_REQUEST['filter_timetill'] > 0 ? date('d', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_month', $_REQUEST['filter_timetill'] > 0 ? date('m', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_year', $_REQUEST['filter_timetill'] > 0 ? date('Y', $_REQUEST['filter_timetill']) : '', 4), SPACE, new CNumericBox('filter_till_hour', $_REQUEST['filter_timetill'] > 0 ? date('H', $_REQUEST['filter_timetill']) : '', 2), ':', new CNumericBox('filter_till_minute', $_REQUEST['filter_timetill'] > 0 ? date('i', $_REQUEST['filter_timetill']) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,' . '["filter_till_day","filter_till_month","filter_till_year","filter_till_hour","filter_till_minute"],' . '"avail_report_till",' . '"filter_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));');
$filterForm->addRow(S_PERIOD, $filtertimetab);
//*/
$filterForm->addItemToBottomRow(new CButton('filter_set', S_FILTER));
$reset = new CButton("filter_rst", S_RESET);
$reset->SetType('button');
$reset->SetAction('javascript: var url = new Curl(location.href); url.setArgument("filter_rst",1); location.href = url.getUrl();');
$filterForm->addItemToBottomRow($reset);
示例11: makeRow
private function makeRow($id)
{
$table = new CTable();
$table->setCellSpacing(0);
$table->setCellPadding(0);
$table->addOption('border', '0');
$table->addOption('height', '100%');
$tr = $this->makeSImgStr($id);
$td = new CCol($this->tree[$id]['caption']);
$td->addOption('style', 'height: 100%; vertical-align: top; white-space: normal; padding-right: 10px; padding-left: 2px;');
$tr->addItem($td);
$table->addRow($tr);
$tr = new CRow();
$tr->addItem($table);
$tr->addOption('id', 'id_' . $id);
$tr->addOption('style', $this->tree[$id]['parentid'] != '0' ? 'display: none;' : '');
foreach ($this->fields as $key => $value) {
$td = new CCol($this->tree[$id][$value]);
$td->addOption('style', ' padding-right: 10px; padding-left: 2px;');
$tr->addItem($td);
}
return $tr;
}
示例12: CButton
$cb = new CButton('select_parent', S_CHANGE);
$cb->SetType('button');
$cb->SetAction("javascript: openWinCentered('services_form.php?pservices=1" . url_param('serviceid') . "','ZBX_Services_List',740,420,'scrollbars=1, toolbar=0, menubar=0, resizable=1, dialog=0');");
$frmService->AddRow('Parent Service', array($ctb, $cb));
//----------
//child links
$table = new CTable();
$table->setClass('tableinfo');
$table->setOddRowClass('even_row');
$table->setEvenRowClass('even_row');
$table->options['cellpadding'] = 3;
$table->options['cellspacing'] = 1;
$table->headerClass = 'header';
$table->footerClass = 'footer';
$table->setHeader(array(new CCheckBox('all_child_services', null, "check_childs('" . $frmService->GetName() . "','childs','all_child_services');"), S_SERVICES, S_SOFT, S_TRIGGER));
$table->addOption('id', 'service_childs');
foreach ($childs as $id => $child) {
$prefix = null;
$trigger = '-';
$description = new CLink($child['name'], 'services_form.php?sform=1&serviceid=' . $child['serviceid'], 'action');
if (isset($child['triggerid']) && !empty($child['triggerid'])) {
$trigger = expand_trigger_description($child['triggerid']);
}
$table->AddRow(array(array(new CCheckBox('childs_to_del[' . $child['serviceid'] . '][serviceid]', null, null, $child['serviceid']), new CVar('childs[' . $child['serviceid'] . '][serviceid]', $child['serviceid'])), array($description, new CVar('childs[' . $child['serviceid'] . '][name]', $child['name'])), new CCheckBox('childs[' . $child['serviceid'] . '][soft]', isset($child['soft']) && !empty($child['soft']) ? 'checked' : 'no', null, isset($child['soft']) && !empty($child['soft']) ? 1 : 0), array($trigger, new CVar('childs[' . $child['serviceid'] . '][triggerid]', isset($child['triggerid']) ? $child['triggerid'] : ''))));
}
$cb = new CButton('add_child_service', S_ADD);
$cb->SetType('button');
$cb->SetAction("javascript: openWinCentered('services_form.php?cservices=1" . url_param('serviceid') . "','ZBX_Services_List',640,520,'scrollbars=1, toolbar=0, menubar=0, resizable=0');");
$cb2 = new CButton('del_child_service', S_REMOVE);
$cb2->SetType('button');
$cb2->SetAction("javascript: remove_childs('" . $frmService->GetName() . "','childs_to_del','tr');");
示例13: CForm
$node_form = new CForm();
$node_form->addItem(array(new CSpan(S_CURRENT_NODE, 'textcolorstyles'), $lst_nodes));
unset($lst_nodes);
if (!defined('ZBX_DISABLE_SUBNODES')) {
global $ZBX_WITH_SUBNODES;
$cmd_show_subnodes = new CComboBox('show_subnodes', !empty($ZBX_WITH_SUBNODES) ? 1 : 0, 'submit()');
$cmd_show_subnodes->addItem(0, S_CURRENT_NODE_ONLY);
$cmd_show_subnodes->addItem(1, S_WITH_SUBNODES);
$node_form->addItem(array(SPACE, new CSpan(S_SHOW, 'textcolorstyles'), $cmd_show_subnodes));
}
}
}
$table = new CTable();
$table->setCellSpacing(0);
$table->setCellPadding(0);
$table->addOption('style', 'width: 100%;');
$r_col = new CCol($node_form);
$r_col->AddOption('align', 'right');
// $r_col->AddOption('style','text-align: right;');
$table->addRow(array($menu_table, $r_col));
$page_menu = new CDiv();
$page_menu->addoption('id', 'mmenu');
$page_menu->addItem($table);
$menu_selected = false;
foreach ($sub_menus as $label => $sub_menu) {
$sub_menu_table = new CTable(NULL, 'sub_menu');
$sub_menu_table->setCellSpacing(0);
$sub_menu_table->setCellPadding(5);
$sub_menu_row = array();
foreach ($sub_menu as $id => $sub_page) {
if (empty($sub_page['menu_text'])) {
示例14: get_screen
function get_screen($screenid, $editmode, $effectiveperiod = NULL)
{
global $USER_DETAILS;
if (!screen_accessible($screenid, $editmode == 1 ? PERM_READ_WRITE : PERM_READ_ONLY)) {
access_deny();
}
if (is_null($effectiveperiod)) {
$effectiveperiod = ZBX_MIN_PERIOD;
}
$result = DBselect('SELECT name,hsize,vsize FROM screens WHERE screenid=' . $screenid);
$row = DBfetch($result);
if (!$row) {
return new CTableInfo(S_NO_SCREENS_DEFINED);
}
for ($r = 0; $r < $row['vsize']; $r++) {
for ($c = 0; $c < $row['hsize']; $c++) {
if (isset($skip_field[$r][$c])) {
continue;
}
$sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r;
$iresult = DBSelect($sql);
$irow = DBfetch($iresult);
if ($irow) {
$colspan = $irow['colspan'];
$rowspan = $irow['rowspan'];
} else {
$colspan = 0;
$rowspan = 0;
}
for ($i = 0; $i < $rowspan || $i == 0; $i++) {
for ($j = 0; $j < $colspan || $j == 0; $j++) {
if ($i != 0 || $j != 0) {
$skip_field[$r + $i][$c + $j] = 1;
}
}
}
}
}
$table = new CTable(new CLink('No rows in screen ' . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit');
$table->addOption('id', 'iframe');
if ($editmode == 1) {
$add_col_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_col=';
$new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
for ($c = 0; $c < $row['hsize'] + 1; $c++) {
array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_col_link . $c)));
}
$table->addRow($new_cols);
}
$empty_screen_col = array();
for ($r = 0; $r < $row['vsize']; $r++) {
$new_cols = array();
$empty_screen_row = true;
if ($editmode == 1) {
$add_row_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_row=';
array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_row_link . $r)));
}
for ($c = 0; $c < $row['hsize']; $c++) {
$item = array();
if (isset($skip_field[$r][$c])) {
continue;
}
$item_form = false;
$iresult = DBSelect('SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r);
$irow = DBfetch($iresult);
if ($irow) {
$screenitemid = $irow['screenitemid'];
$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 {
$screenitemid = 0;
$resourcetype = 0;
$resourceid = 0;
$width = 0;
$height = 0;
$colspan = 0;
$rowspan = 0;
$elements = 0;
$valign = VALIGN_DEFAULT;
$halign = HALIGN_DEFAULT;
$style = 0;
$url = '';
$dynamic = 0;
}
if ($screenitemid > 0) {
$empty_screen_row = false;
$empty_screen_col[$c] = 1;
}
if ($editmode == 1 && $screenitemid != 0) {
$onclick_action = "ZBX_SCREENS['" . $_REQUEST['screenid'] . "'].screen.element_onclick('screenedit.php?form=update" . url_param('screenid') . '&screenitemid=' . $screenitemid . "#form');";
$action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitemid . '#form';
//.........这里部分代码省略.........
示例15: CImg
$rep_tab->addOption('border', 0);
// --------------
switch ($config) {
case 1:
$rep_form = bar_report_form();
break;
case 2:
$rep_form = bar_report_form2();
break;
case 3:
$rep_form = bar_report_form3();
break;
default:
$rep_form = bar_report_form();
}
$form = create_filter(S_REPORTS, NULL, $rep_form, 'report_form', get_profile('web.report6.filter.state', 1));
$form->Show();
if (isset($_REQUEST['report_show'])) {
$src = 'chart_bar.php?config=' . $_REQUEST['config'] . url_param('title') . url_param('xlabel') . url_param('ylabel') . url_param('scaletype') . url_param('avgperiod') . url_param('showlegend') . url_param('sorttype') . url_param('report_timesince') . url_param('report_timetill') . url_param('periods') . url_param('items') . url_param('hostids') . url_param('groupids') . url_param('palette') . url_param('palettetype');
$rep_tab->addRow(create_hat(S_REPORT, new CImg($src, 'report'), null, 'hat_report', get_profile('web.report6.hats.hat_report.state', 1)));
}
$outer_table = new CTable();
$outer_table->addOption('border', 0);
$outer_table->addOption('width', '100%');
$outer_table->setCellPadding(1);
$outer_table->setCellSpacing(1);
$tmp_row = new CRow($rep_tab);
$tmp_row->addOption('align', 'center');
$outer_table->addRow($tmp_row);
$outer_table->Show();
include_once 'include/page_footer.php';