本文整理汇总了PHP中CTable::setCellPadding方法的典型用法代码示例。如果您正苦于以下问题:PHP CTable::setCellPadding方法的具体用法?PHP CTable::setCellPadding怎么用?PHP CTable::setCellPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTable
的用法示例。
在下文中一共展示了CTable::setCellPadding方法的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: get
public function get($caption_l = null, $caption_r = null)
{
if (empty($caption_l)) {
$caption_l = _('In');
}
if (empty($caption_r)) {
$caption_r = _('Other');
}
$grp_tab = new CTable();
$grp_tab->attr('name', $this->name);
$grp_tab->attr('id', zbx_formatDomId($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', ' « ', null, 'formlist');
$add_btn->setAttribute('onclick', 'javascript: moveListBoxSelectedItem("' . $this->form->getName() . '", "' . $this->varname . '", "' . $this->id_r . '", "' . $this->id_l . '", "add");');
$rmv_btn = new CButton('remove', ' » ', null, 'formlist');
$rmv_btn->setAttribute('onclick', '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;
}
示例3: insert_host_form
//.........这里部分代码省略.........
array_push($host_footer, SPACE, new CButtonCancel(url_param('groupid')));
$host_footer = new CCol($host_footer);
$host_footer->setColSpan(2);
$host_tbl->setFooter($host_footer);
$host_wdgt = new CWidget();
$host_wdgt->setClass('header');
$host_wdgt->addHeader($frm_title);
$host_wdgt->addItem($host_tbl);
// } HOST WIDGET
// TEMPLATES{
$template_tbl = new CTableInfo(S_NO_TEMPLATES_LINKED, 'tablestripped');
$template_tbl->setOddRowClass('form_odd_row');
$template_tbl->setEvenRowClass('form_even_row');
foreach ($templates as $id => $temp_name) {
$frmHost->addVar('templates[' . $id . ']', $temp_name);
$template_tbl->addRow(new CCol(array(new CCheckBox('templates_rem[' . $id . ']', 'no', null, $id), $temp_name)));
}
$footer = new CCol(array(new CButton('add_template', S_ADD, "return PopUp('popup.php?dstfrm=" . $frmHost->getName() . "&dstfld1=new_template&srctbl=templates&srcfld1=hostid&srcfld2=host" . url_param($templates, false, 'existed_templates') . "',450,450)", 'T'), SPACE, new CButton('unlink', S_UNLINK), SPACE, new CButton('unlink_and_clear', S_UNLINK_AND_CLEAR)));
//$footer->setColSpan(2);
$template_tbl->setFooter($footer);
$template_wdgt = new CWidget();
$template_wdgt->setClass('header');
$template_wdgt->addHeader(S_LINKED_TEMPLATES);
$template_wdgt->addItem($template_tbl);
// } TEMPLATES
// MACROS WIDGET {
$macros_wdgt = get_macros_widget($_REQUEST['hostid']);
// } MACROS WIDGET
// PROFILE WIDGET {
$profile_tbl = new CTable('', 'tablestripped');
$profile_tbl->setOddRowClass('form_odd_row');
$profile_tbl->setEvenRowClass('form_even_row');
$profile_tbl->addRow(array(S_USE_PROFILE, new CCheckBox('useprofile', $useprofile, 'submit()')));
if ($useprofile == 'yes') {
$profile_tbl->addRow(array(S_DEVICE_TYPE, new CTextBox('devicetype', $devicetype, 61)));
$profile_tbl->addRow(array(S_NAME, new CTextBox('name', $name, 61)));
$profile_tbl->addRow(array(S_OS, new CTextBox('os', $os, 61)));
$profile_tbl->addRow(array(S_SERIALNO, new CTextBox('serialno', $serialno, 61)));
$profile_tbl->addRow(array(S_TAG, new CTextBox('tag', $tag, 61)));
$profile_tbl->addRow(array(S_MACADDRESS, new CTextBox('macaddress', $macaddress, 61)));
$profile_tbl->addRow(array(S_HARDWARE, new CTextArea('hardware', $hardware, 60, 4)));
$profile_tbl->addRow(array(S_SOFTWARE, new CTextArea('software', $software, 60, 4)));
$profile_tbl->addRow(array(S_CONTACT, new CTextArea('contact', $contact, 60, 4)));
$profile_tbl->addRow(array(S_LOCATION, new CTextArea('location', $location, 60, 4)));
$profile_tbl->addRow(array(S_NOTES, new CTextArea('notes', $notes, 60, 4)));
} else {
$frmHost->addVar('devicetype', $devicetype);
$frmHost->addVar('name', $name);
$frmHost->addVar('os', $os);
$frmHost->addVar('serialno', $serialno);
$frmHost->addVar('tag', $tag);
$frmHost->addVar('macaddress', $macaddress);
$frmHost->addVar('hardware', $hardware);
$frmHost->addVar('software', $software);
$frmHost->addVar('contact', $contact);
$frmHost->addVar('location', $location);
$frmHost->addVar('notes', $notes);
}
$profile_wdgt = new CWidget();
$profile_wdgt->setClass('header');
$profile_wdgt->addHeader(S_PROFILE);
$profile_wdgt->addItem($profile_tbl);
// } PROFILE WIDGET
// EXT PROFILE WIDGET {
$ext_profile_tbl = new CTable('', 'tablestripped');
$ext_profile_tbl->setOddRowClass('form_odd_row');
$ext_profile_tbl->setEvenRowClass('form_even_row');
$ext_profile_tbl->addRow(array(S_USE_EXTENDED_PROFILE, new CCheckBox('useprofile_ext', $useprofile_ext, 'submit()', 'yes')));
foreach ($ext_profiles_fields as $prof_field => $caption) {
if ($useprofile_ext == 'yes') {
$ext_profile_tbl->addRow(array($caption, new CTextBox('ext_host_profiles[' . $prof_field . ']', $ext_host_profiles[$prof_field], 40)));
} else {
$frmHost->addVar('ext_host_profiles[' . $prof_field . ']', $ext_host_profiles[$prof_field]);
}
}
$ext_profile_wdgt = new CWidget();
$ext_profile_wdgt->setClass('header');
$ext_profile_wdgt->addHeader(S_EXTENDED_HOST_PROFILE);
$ext_profile_wdgt->addItem($ext_profile_tbl);
// } EXT PROFILE WIDGET
$left_table = new CTable();
$left_table->setCellPadding(4);
$left_table->setCellSpacing(4);
$left_table->addRow($host_wdgt);
$right_table = new CTable();
$right_table->setCellPadding(4);
$right_table->setCellSpacing(4);
$right_table->addRow($template_wdgt);
$right_table->addRow($macros_wdgt);
$right_table->addRow($profile_wdgt);
$right_table->addRow($ext_profile_wdgt);
$td_l = new CCol($left_table);
$td_l->setAttribute('valign', 'top');
$td_r = new CCol($right_table);
$td_r->setAttribute('valign', 'top');
$outer_table = new CTable();
$outer_table->addRow(array($td_l, $td_r));
$frmHost->addItem($outer_table);
return $frmHost;
}
示例4: array
$admin = uint_in_array($USER_DETAILS['type'], array(USER_TYPE_ZABBIX_ADMIN, USER_TYPE_SUPER_ADMIN));
$rows_per_page = $USER_DETAILS['rows_per_page'];
$search_wdgt = new CWidget('search_wdgt');
$search = get_request('search', '');
// Header
if (zbx_empty($search)) {
$search = 'Search pattern is empty';
}
$search_wdgt->addHeader(array(S_SEARCH_BIG . ': ', bold($search)), SPACE);
//-------------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->setAttribute('border', 0);
$right_tab = new CTable();
$right_tab->setCellPadding(3);
$right_tab->setCellSpacing(3);
$right_tab->setAttribute('border', 0);
// FIND Hosts
$params = array('nodeids' => get_current_nodeid(), 'extendoutput' => true, 'pattern' => $search, 'extend_pattern' => true, 'limit' => $rows_per_page, 'order' => 'host');
$db_hosts = CHost::get($params);
$hosts = selectByPattern($db_hosts, 'host', $search, $rows_per_page);
$hostids = array_keys($hosts);
$hostsgroups = array();
$sql = 'SELECT * FROM hosts_groups hg WHERE ' . DBcondition('hg.hostid', $hostids);
$res = DBselect($sql);
while ($hostgroup = DBfetch($res)) {
$hostsgroups[$hostgroup['hostid']] = $hostgroup['groupid'];
}
$params = array('nodeids' => get_current_nodeid(), 'pattern' => $search, 'extend_pattern' => true, 'count' => 1);
$hosts_count = CHost::get($params);
示例5: 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';
示例6: show_messages
function show_messages($bool = true, $okmsg = null, $errmsg = null)
{
global $page, $ZBX_MESSAGES;
if (!defined('PAGE_HEADER_LOADED')) {
return null;
}
if (defined('ZBX_API_REQUEST')) {
return null;
}
if (!isset($page['type'])) {
$page['type'] = PAGE_TYPE_HTML;
}
$imageMessages = array();
if (!$bool && !is_null($errmsg)) {
$msg = _('ERROR') . ': ' . $errmsg;
} elseif ($bool && !is_null($okmsg)) {
$msg = $okmsg;
}
if (isset($msg)) {
switch ($page['type']) {
case PAGE_TYPE_IMAGE:
// save all of the messages in an array to display them later in an image
$imageMessages[] = array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68));
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);
$row = array();
$msg_col = new CCol(bold($msg), 'msg_main msg');
$msg_col->setAttribute('id', 'page_msg');
$row[] = $msg_col;
if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
$msg_details = new CDiv(_('Details'), 'blacklink');
$msg_details->setAttribute('onclick', 'javascript: showHide("msg_messages", IE ? "block" : "table");');
$msg_details->setAttribute('title', _('Maximize') . '/' . _('Minimize'));
array_unshift($row, new CCol($msg_details, 'clr'));
}
$msg_tab->addRow($row);
$msg_tab->show();
break;
}
}
if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
if ($page['type'] == PAGE_TYPE_IMAGE) {
foreach ($ZBX_MESSAGES as $msg) {
// save all of the messages in an array to display them later in an image
if ($msg['type'] == 'error') {
$imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55));
} else {
$imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55));
}
}
} elseif ($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']);
}
$msg_show = 6;
$msg_count = count($ZBX_MESSAGES);
if ($msg_count > $msg_show) {
$msg_count = $msg_show * 16;
$lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;');
}
$tab = new CTable(null, $bool ? 'msgok' : 'msgerr');
$tab->setCellPadding(0);
$tab->setCellSpacing(0);
$tab->setAttribute('id', 'msg_messages');
$tab->setAttribute('style', 'width: 100%;');
if (isset($msg_tab) && $bool) {
$tab->setAttribute('style', 'display: none;');
}
$tab->addRow(new CCol($lst_error, 'msg'));
$tab->show();
}
$ZBX_MESSAGES = null;
}
// draw an image with the messages
if ($page['type'] == PAGE_TYPE_IMAGE && count($imageMessages) > 0) {
$imageFontSize = 8;
// calculate the size of the text
$imageWidth = 0;
$imageHeight = 0;
foreach ($imageMessages as &$msg) {
$size = imageTextSize($imageFontSize, 0, $msg['text']);
$msg['height'] = $size['height'] - $size['baseline'];
// calculate the total size of the image
$imageWidth = max($imageWidth, $size['width']);
$imageHeight += $size['height'] + 1;
}
unset($msg);
//.........这里部分代码省略.........
示例7: bodyToString
public function bodyToString()
{
$res = parent::bodyToString();
$tbl = new CTable(null, $this->tableclass);
$tbl->setCellSpacing(0);
$tbl->setCellPadding(1);
$tbl->setAlign($this->align);
// add first row
if (!is_null($this->title)) {
$col = new CCol(null, 'form_row_first');
$col->setColSpan(2);
if (isset($this->help)) {
$col->addItem($this->help);
}
if (isset($this->title)) {
$col->addItem($this->title);
}
$tbl->setHeader($col);
}
// add last row
$tbl->setFooter($this->bottom_items);
// add center rows
foreach ($this->center_items as $item) {
$tbl->addRow($item);
}
return $res . $tbl->toString();
}
示例8: get_table_header
function get_table_header($columnLeft, $columnRights = SPACE)
{
if (isset($_REQUEST['print'])) {
hide_form_items($columnLeft);
hide_form_items($columnRights);
if ($columnLeft == SPACE && $columnRights == SPACE) {
return new CJSscript('');
}
}
$rights = array();
if ($columnRights) {
if (!is_array($columnRights)) {
$columnRights = array($columnRights);
}
foreach ($columnRights as $columnRight) {
$rights[] = new CDiv($columnRight, 'floatright');
}
$rights = array_reverse($rights);
}
$table = new CTable(null, 'ui-widget-header ui-corner-all header maxwidth');
$table->setCellSpacing(0);
$table->setCellPadding(1);
$table->addRow(array(new CCol($columnLeft, 'header_l left'), new CCol($rights, 'header_r right')));
return $table;
}
示例9: createFlicker
private function createFlicker($col1, $col2 = NULL)
{
$table = new CTable(NULL, 'flicker');
// $table->setAttribute('border',1);
$table->setCellSpacing(0);
$table->setCellPadding(1);
if (!is_null($col2)) {
$td_r = new CCol($col2, 'flicker_r');
$td_r->setAttribute('align', 'right');
$table->addRow(array(new CCol($col1, 'flicker_l'), $td_r));
} else {
$td_c = new CCol($col1, 'flicker_c');
$td_c->setAttribute('align', 'center');
$table->addRow($td_c);
}
return $table;
}
示例10: zbxCallPostScripts
//------------------------------------- <HISTORY> ---------------------------------------
if (isset($page['hist_arg']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
add_user_history($page);
}
//------------------------------------- </HISTORY> --------------------------------------
show_messages();
$post_script = '';
if ($page['type'] == PAGE_TYPE_HTML) {
$post_script .= 'function zbxCallPostScripts(){' . "\n";
if (isset($ZBX_PAGE_POST_JS)) {
foreach ($ZBX_PAGE_POST_JS as $num => $script) {
$post_script .= $script . "\n";
}
}
$post_script .= '}' . "\n";
// $post_script.= 'try{ chkbxRange.init(); } catch(e){ throw("Checkbox extension failed!");}';
$post_script .= 'chkbxRange.init();';
insert_js($post_script);
if (!defined('ZBX_PAGE_NO_MENU') && !defined('ZBX_PAGE_NO_FOOTER')) {
$table = new CTable(NULL, "page_footer");
$table->setCellSpacing(0);
$table->setCellPadding(1);
$table->AddRow(array(new CCol(new CLink(S_ZABBIX . SPACE . ZABBIX_VERSION . SPACE . S_COPYRIGHT_BY . SPACE . S_SIA_ZABBIX, 'http://www.zabbix.com', 'highlight', null, true), 'page_footer_l'), new CCol(array(new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), new CSpan($USER_DETAILS['userid'] == 0 ? S_NOT_CONNECTED : S_CONNECTED_AS . SPACE . "'" . $USER_DETAILS['alias'] . "'" . (ZBX_DISTRIBUTED ? SPACE . S_FROM_SMALL . SPACE . "'" . $USER_DETAILS['node']['name'] . "'" : ''), 'footer_sign')), "page_footer_r")));
$table->Show();
}
COpt::profiling_stop("script");
print '<!--' . "\n" . 'SELECTS: ' . $DB['SELECT_COUNT'] . "\n" . 'EXECUTE: ' . $DB['EXECUTE_COUNT'] . "\n" . 'TOTAL: ' . ($DB['EXECUTE_COUNT'] + $DB['SELECT_COUNT']) . "\n" . '-->';
echo "</body>\n";
echo "</html>\n";
}
exit;
示例11: makeRow
private function makeRow($id)
{
$table = new CTable();
$table->setCellSpacing(0);
$table->setCellPadding(0);
$table->setAttribute('border', '0');
$table->setAttribute('height', '100%');
$tr = $this->makeSImgStr($id);
$td = new CCol($this->tree[$id]['caption']);
$td->setAttribute('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->setAttribute('id', 'id_' . $id);
$tr->setAttribute('style', $this->tree[$id]['parentid'] != '0' ? 'display: none;' : '');
foreach ($this->fields as $key => $value) {
$td = new CCol($this->tree[$id][$value]);
$td->setAttribute('style', ' padding-right: 10px; padding-left: 2px;');
$tr->addItem($td);
}
return $tr;
}
示例12: get_table_header
function get_table_header($col1, $col2 = SPACE)
{
if (isset($_REQUEST['print'])) {
hide_form_items($col1);
hide_form_items($col2);
//if empty header than do not show it
if ($col1 == SPACE && $col2 == SPACE) {
return new CJSscript('');
}
}
$td_l = new CCol(SPACE, 'header_r');
$td_l->setAttribute('width', '100%');
$right_row = array($td_l);
if (!is_null($col2)) {
if (!is_array($col2)) {
$col2 = array($col2);
}
foreach ($col2 as $num => $r_item) {
$right_row[] = new CCol($r_item, 'header_r');
}
}
$right_tab = new CTable(null, 'nowrap');
$right_tab->setAttribute('width', '100%');
$right_tab->addRow($right_row);
$table = new CTable(NULL, 'header');
// $table->setAttribute('border',0);
$table->setCellSpacing(0);
$table->setCellPadding(1);
$td_r = new CCol($right_tab, 'header_r');
$td_r->setAttribute('align', 'right');
$table->addRow(array(new CCol($col1, 'header_l'), $td_r));
return $table;
}
示例13: 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);
//.........这里部分代码省略.........
示例14: get_timeperiod_form
//.........这里部分代码省略.........
$tblPeriod->addRow(array(_('Month'), $tabMonths));
$radioDaily = new CTag('input');
$radioDaily->setAttribute('type', 'radio');
$radioDaily->setAttribute('name', 'new_timeperiod[month_date_type]');
$radioDaily->setAttribute('value', '0');
$radioDaily->setAttribute('onclick', 'submit()');
$radioDaily2 = new CTag('input');
$radioDaily2->setAttribute('type', 'radio');
$radioDaily2->setAttribute('name', 'new_timeperiod[month_date_type]');
$radioDaily2->setAttribute('value', '1');
$radioDaily2->setAttribute('onclick', 'submit()');
if ($new_timeperiod['month_date_type']) {
$radioDaily2->setAttribute('checked', 'checked');
} else {
$radioDaily->setAttribute('checked', 'checked');
}
$tblPeriod->addRow(array(_('Date'), array($radioDaily, _('Day'), SPACE, SPACE, $radioDaily2, _('Day of week'))));
if ($new_timeperiod['month_date_type'] > 0) {
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day']));
$cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']);
$cmbCount->addItem(1, _('First'));
$cmbCount->addItem(2, _('Second'));
$cmbCount->addItem(3, _('Third'));
$cmbCount->addItem(4, _('Fourth'));
$cmbCount->addItem(5, _('Last'));
$td = new CCol($cmbCount);
$td->setColSpan(2);
$tabDays = new CTable();
$tabDays->addRow($td);
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), _('Monday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), _('Tuesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), _('Wednesday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), _('Thursday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), _('Friday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), _('Saturday')));
$tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), _('Sunday')));
$tblPeriod->addRow(array(_('Day of week'), $tabDays));
} else {
$tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
$tblPeriod->addRow(array(_('Day of month'), new CNumericBox('new_timeperiod[day]', $new_timeperiod['day'], 2)));
}
} else {
$tblPeriod->addItem(new CVar('new_timeperiod[every]', $new_timeperiod['every'], 'new_timeperiod_every_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[month]', bindec($bit_month), 'new_timeperiod_month_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[day]', $new_timeperiod['day'], 'new_timeperiod_day_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[hour]', $new_timeperiod['hour'], 'new_timeperiod_hour_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[minute]', $new_timeperiod['minute'], 'new_timeperiod_minute_tmp'));
$tblPeriod->addItem(new CVar('new_timeperiod[start_date]', $new_timeperiod['start_date']));
$tblPeriod->addItem(new CVar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
$tblPeriod->addItem(new CVar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
$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["new_timeperiod_date"].clndr.clndrshow(pos.top, pos.left);');
$filtertimetab = new CTable(null, 'calendar');
$filtertimetab->setAttribute('width', '10%');
$filtertimetab->setCellPadding(0);
$filtertimetab->setCellSpacing(0);
$startDate = zbxDateToTime($new_timeperiod['start_date']);
if (isset($_REQUEST['add_timeperiod'])) {
$newTimePeriodYear = get_request('new_timeperiod_year');
$newTimePeriodMonth = get_request('new_timeperiod_month');
$newTimePeriodDay = get_request('new_timeperiod_day');
$newTimePeriodHours = get_request('new_timeperiod_hour');
$newTimePeriodMinutes = get_request('new_timeperiod_minute');
} elseif ($startDate > 0) {
$newTimePeriodYear = date('Y', $startDate);
$newTimePeriodMonth = date('m', $startDate);
$newTimePeriodDay = date('d', $startDate);
$newTimePeriodHours = date('H', $startDate);
$newTimePeriodMinutes = date('i', $startDate);
} else {
$newTimePeriodYear = '';
$newTimePeriodMonth = '';
$newTimePeriodDay = '';
$newTimePeriodHours = '';
$newTimePeriodMinutes = '';
}
$filtertimetab->addRow(array(new CNumericBox('new_timeperiod_day', $newTimePeriodDay, 2), '/', new CNumericBox('new_timeperiod_month', $newTimePeriodMonth, 2), '/', new CNumericBox('new_timeperiod_year', $newTimePeriodYear, 4), SPACE, new CNumericBox('new_timeperiod_hour', $newTimePeriodHours, 2), ':', new CNumericBox('new_timeperiod_minute', $newTimePeriodMinutes, 2), $clndr_icon));
zbx_add_post_js('create_calendar(null, ["new_timeperiod_day", "new_timeperiod_month", "new_timeperiod_year", "new_timeperiod_hour", "new_timeperiod_minute"], "new_timeperiod_date", "new_timeperiod_start_date");');
$tblPeriod->addRow(array(_('Date'), $filtertimetab));
}
if ($new_timeperiod['timeperiod_type'] != TIMEPERIOD_TYPE_ONETIME) {
$tabTime = new CTable(null, 'calendar');
$tabTime->addRow(array(new CNumericBox('new_timeperiod[hour]', $new_timeperiod['hour'], 2), ':', new CNumericBox('new_timeperiod[minute]', $new_timeperiod['minute'], 2)));
$tblPeriod->addRow(array(_('At (hour:minute)'), $tabTime));
}
$perHours = new CComboBox('new_timeperiod[period_hours]', $new_timeperiod['period_hours']);
for ($i = 0; $i < 24; $i++) {
$perHours->addItem($i, $i);
}
$perMinutes = new CComboBox('new_timeperiod[period_minutes]', $new_timeperiod['period_minutes']);
for ($i = 0; $i < 60; $i++) {
$perMinutes->addItem($i, $i);
}
$tblPeriod->addRow(array(_('Maintenance period length'), array(new CNumericBox('new_timeperiod[period_days]', $new_timeperiod['period_days'], 3), _('Days') . SPACE . SPACE, $perHours, SPACE . _('Hours'), $perMinutes, SPACE . _('Minutes'))));
$td = new CCol(array(new CSubmit('add_timeperiod', $new ? _('Save') : _('Add')), SPACE, new CSubmit('cancel_new_timeperiod', _('Cancel'))));
$td->setAttribute('colspan', '3');
$td->setAttribute('style', 'text-align: right;');
$tblPeriod->setFooter($td);
return $tblPeriod;
}
示例15: CFormTable
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);
$filter = create_filter(S_FILTER, NULL, $filterForm, 'tr_filter', get_profile('web.avail_report.filter.state', 0));