当前位置: 首页>>代码示例>>PHP>>正文


PHP CButton::setType方法代码示例

本文整理汇总了PHP中CButton::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP CButton::setType方法的具体用法?PHP CButton::setType怎么用?PHP CButton::setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CButton的用法示例。


在下文中一共展示了CButton::setType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CRow

    $filterForm->addVar('triggerid', get_request('triggerid'));
    $filterForm->addVar('stime', get_request('stime'));
    $filterForm->addVar('period', get_request('period'));
    if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
        $trigger = expand_trigger_description($_REQUEST['triggerid']);
    } else {
        $trigger = '';
    }
    $row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox('trigger', $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->getName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
    $filterForm->addRow($row);
    $filterForm->addVar('hide_unknown', $_REQUEST['hide_unknown']);
    $unkcbx = new CCheckBox('hide_unk', $_REQUEST['hide_unknown'], null, '1');
    $unkcbx->setAction('javascript: create_var("' . $filterForm->GetName() . '", "hide_unknown", (this.checked?1:0), 0); ');
    $filterForm->addRow(S_HIDE_UNKNOWN, $unkcbx);
    $reset = new CButton('filter_rst', S_RESET);
    $reset->setType('button');
    $reset->setAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
    $filterForm->addItemToBottomRow(new CButton('filter_set', S_FILTER));
    $filterForm->addItemToBottomRow($reset);
}
$events_wdgt->addFlicker($filterForm, CProfile::get('web.events.filter.state', 0));
$scroll_div = new CDiv();
$scroll_div->setAttribute('id', 'scrollbar_cntr');
$events_wdgt->addFlicker($scroll_div, CProfile::get('web.events.filter.state', 0));
// }}} FILTER
$table = new CTableInfo(S_NO_EVENTS_FOUND);
// CHECK IF EVENTS EXISTS {{{
$options = array('output' => API_OUTPUT_EXTEND, 'sortfield' => 'eventid', 'sortorder' => ZBX_SORT_UP, 'nopermissions' => 1, 'limit' => 1);
if ($source == EVENT_SOURCE_DISCOVERY) {
    $options['source'] = EVENT_SOURCE_DISCOVERY;
} else {
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:events.php

示例2: CComboBox

 $node_form->setMethod('get');
 $node_form->setAttribute('id', 'node_form');
 // +++ create Combo Box with selected nodes +++
 $combo_node_list = null;
 if (count($ZBX_VIEWED_NODES['nodes']) > 0) {
     $combo_node_list = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()');
     foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) {
         $combo_node_list->addItem($nodeid, $nodedata['name']);
     }
 }
 // --- ---
 $jscript = 'javascript : ' . " var pos = getPosition('button_show_tree');" . " ShowHide('div_node_tree',IE6?'block':'table');" . ' pos.top += 20;' . " \$('div_node_tree').setStyle({top: pos.top+'px'});" . " showPopupDiv('div_node_tree','select_iframe');";
 // IE6
 $button_show_tree = new CButton('show_node_tree', S_SELECT_NODES, $jscript);
 //sdelatj konstatntu!
 $button_show_tree->setType('button');
 $button_show_tree->setAttribute('id', 'button_show_tree');
 // +++ Create node tree +++
 $combo_check_all = new CCheckbox('check_all_nodes', null, "javascript : check_all('node_form', this.checked);");
 $node_tree = array();
 $node_tree[0] = array('id' => 0, 'caption' => S_ALL_S, 'combo_select_node' => $combo_check_all, 'parentid' => 0);
 //root
 foreach ($available_nodes as $num => $node) {
     $checked = uint_in_array($node['nodeid'], $ZBX_VIEWED_NODES['nodeids']);
     $combo_select_node = new CCheckbox('selected_nodes[' . $node['nodeid'] . ']', $checked, null, $node['nodeid']);
     // If not exist parent for node, link it to root (0)
     if (!isset($available_nodes[$node['masterid']])) {
         $node['masterid'] = 0;
     }
     $node_tree[$node['nodeid']] = array('id' => $node['nodeid'], 'caption' => $node['name'], 'combo_select_node' => $combo_select_node, 'parentid' => $node['masterid']);
 }
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:page_header.php

示例3: 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;
 }
开发者ID:rennhak,项目名称:zabbix,代码行数:21,代码来源:class.ctweenbox.php

示例4: bar_report_form3


//.........这里部分代码省略.........
    $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);
    $scale->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY);
    $scale->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY);
    $scale->addItem(TIMEPERIOD_TYPE_YEARLY, S_YEARLY);
    $reportForm->addRow(S_SCALE, $scale);
    $avgcmb = new CComboBox('avgperiod', $avgperiod);
    $avgcmb->addItem(TIMEPERIOD_TYPE_HOURLY, S_HOURLY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_YEARLY, S_YEARLY);
    $reportForm->addRow(S_AVERAGE_BY, $avgcmb);
    // ITEMS
    $itemid = 0;
    $description = '';
    if (count($items) && $items[0]['itemid'] > 0) {
        $itemid = $items[0]['itemid'];
        $description = get_item_by_itemid($itemid);
        $description = item_description($description);
    }
    $reportForm->addVar('items[0][itemid]', $itemid);
    $txtCondVal = new CTextBox('items[0][description]', $description, 50, 'yes');
    $btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $reportForm->GetName() . "&dstfld1=items[0][itemid]&dstfld2=items[0][description]&" . "srctbl=items&srcfld1=itemid&srcfld2=description&monitored_hosts=1');", 'T');
    $reportForm->addRow(S_ITEM, array($txtCondVal, $btnSelect));
    $paletteCmb = new CComboBox('palette', $palette);
    $paletteCmb->addItem(0, S_PALETTE . ' #1');
    $paletteCmb->addItem(1, S_PALETTE . ' #2');
    $paletteCmb->addItem(2, S_PALETTE . ' #3');
    $paletteCmb->addItem(3, S_PALETTE . ' #4');
    $paletteTypeCmb = new CComboBox('palettetype', $palettetype);
    $paletteTypeCmb->addItem(0, S_MIDDLE);
    $paletteTypeCmb->addItem(1, S_DARKEN);
    $paletteTypeCmb->addItem(2, S_BRIGHTEN);
    $reportForm->addRow(S_PALETTE, array($paletteCmb, $paletteTypeCmb));
    //--------------
    $reportForm->addItemToBottomRow(new CButton('report_show', S_SHOW));
    $reset = new CButton('reset', S_RESET);
    $reset->setType('reset');
    $reportForm->addItemToBottomRow($reset);
    return $reportForm;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:reports.inc.php

示例5: valueComparisonFormForMultiplePeriods


//.........这里部分代码省略.........
    $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);
    }
    $itemidVar = new CVar('itemid', $itemId, 'itemid');
    $reportForm->addItem($itemidVar);
    $txtCondVal = new CTextBox('item_name', $itemName, 50, 'yes');
    $txtCondVal->setAttribute('id', 'item_name');
    $btnSelect = new CButton('btn1', _('Select'), 'return PopUp("popup.php?dstfrm=' . $reportForm->GetName() . '&dstfld1=itemid' . '&dstfld2=item_name' . '&srctbl=items' . '&srcfld1=itemid' . '&srcfld2=name' . '&monitored_hosts=1");', 'T');
    $reportForm->addRow(_('Item'), array($txtCondVal, $btnSelect));
    $paletteCmb = new CComboBox('palette', $palette);
    $paletteCmb->addItem(0, _s('Palette #%1$s', 1));
    $paletteCmb->addItem(1, _s('Palette #%1$s', 2));
    $paletteCmb->addItem(2, _s('Palette #%1$s', 3));
    $paletteCmb->addItem(3, _s('Palette #%1$s', 4));
    $paletteTypeCmb = new CComboBox('palettetype', $palettetype);
    $paletteTypeCmb->addItem(0, _('Middle'));
    $paletteTypeCmb->addItem(1, _('Darken'));
    $paletteTypeCmb->addItem(2, _('Brighten'));
    $reportForm->addRow(_('Palette'), array($paletteCmb, $paletteTypeCmb));
    $reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show')));
    $reset = new CButton('reset', _('Reset'));
    $reset->setType('reset');
    $reportForm->addItemToBottomRow($reset);
    return $reportForm;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:101,代码来源:reports.inc.php

示例6: add_groups

$groups = CHostGroup::get($options);
foreach ($groups as $gnum => $row) {
    $groups[$gnum]['nodename'] = get_node_name_by_elid($row['groupid'], true, ':') . $row['name'];
    if ($nodeid == 0) {
        $groups[$gnum]['name'] = $groups[$gnum]['nodename'];
    }
}
order_result($groups, 'name');
foreach ($groups as $gnum => $row) {
    $grouplist[$count] = array('groupid' => $row['groupid'], 'name' => $row['nodename'], 'permission' => $permission);
    $table->addRow(new CCol(array(new CCheckBox('groups[' . $count . ']', NULL, NULL, $count), $row['name'])));
    $count++;
}
insert_js('var grouplist = ' . zbx_jsvalue($grouplist) . ';');
$button = new CButton('select', S_SELECT, 'add_groups("' . $dstfrm . '")');
$button->setType('button');
$table->setFooter(new CCol($button, 'right'));
$form->addItem($table);
$form->show();
?>
<script language="JavaScript" type="text/javascript">
<!--
function add_groups(formname) {
	var parent_document = window.opener.document;

	if(!parent_document) return close_window();

	$('groups').getInputs("checkbox").each(
		function(box){
			if(box.checked && (box.name != "all_groups")){
				var groupid = grouplist[box.value].groupid;
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:popup_right.php

示例7: CCol

    }
    $col = new CCol($result);
    $col->setAttribute('style', $style);
    $res_table->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
if ($allowedTesting && $test) {
    $result = evalExpressionData($expression, $macrosData, $octet);
}
$style = 'text-align: center;';
if ($result != '-') {
    $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->setFooter(array($outline, $col), $res_table->headerClass);
$frm_test->addRow(S_RESULT, $res_table);
// action buttons
$btn_test = new CButton('test_expression', S_TEST);
if (!$allowedTesting) {
    $btn_test->setAttribute('disabled', 'disabled');
}
$frm_test->addItemToBottomRow($btn_test);
$frm_test->addItemToBottomRow(SPACE);
$btn_close = new CButton('close', S_CLOSE);
$btn_close->setType('button');
$btn_close->setAction('javascript: self.close();');
$frm_test->addItemToBottomRow($btn_close);
$frm_test->show();
//------------------------ </FORM> ---------------------------
include_once 'include/page_footer.php';
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_testexpr.php

示例8: bar_report_form3


//.........这里部分代码省略.........
    $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);
    $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);
    // items
    $itemid = 0;
    $description = '';
    if (count($items) && $items[0]['itemid'] > 0) {
        $itemid = $items[0]['itemid'];
        $description = get_item_by_itemid($itemid);
        $description = itemName($description);
    }
    $itemidVar = new CVar('items[0][itemid]', $itemid, 'items_0_itemid');
    $reportForm->addItem($itemidVar);
    $txtCondVal = new CTextBox('items[0][description]', $description, 50, 'yes');
    $txtCondVal->setAttribute('id', 'items_0_description');
    $btnSelect = new CButton('btn1', _('Select'), "return PopUp('popup.php?dstfrm=" . $reportForm->GetName() . "&dstfld1=items_0_itemid&dstfld2=items_0_description&" . "srctbl=items&srcfld1=itemid&srcfld2=name&monitored_hosts=1');", 'T');
    $reportForm->addRow(_('Item'), array($txtCondVal, $btnSelect));
    $paletteCmb = new CComboBox('palette', $palette);
    $paletteCmb->addItem(0, _s('Palette #%1$s', 1));
    $paletteCmb->addItem(1, _s('Palette #%1$s', 2));
    $paletteCmb->addItem(2, _s('Palette #%1$s', 3));
    $paletteCmb->addItem(3, _s('Palette #%1$s', 4));
    $paletteTypeCmb = new CComboBox('palettetype', $palettetype);
    $paletteTypeCmb->addItem(0, _('Middle'));
    $paletteTypeCmb->addItem(1, _('Darken'));
    $paletteTypeCmb->addItem(2, _('Brighten'));
    $reportForm->addRow(_('Palette'), array($paletteCmb, $paletteTypeCmb));
    $reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show')));
    $reset = new CButton('reset', _('Reset'));
    $reset->setType('reset');
    $reportForm->addItemToBottomRow($reset);
    return $reportForm;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:reports.inc.php

示例9: get_macros_widget

function get_macros_widget($hostid = null)
{
    if (isset($_REQUEST['form_refresh'])) {
        $macros = get_request('macros', array());
    } else {
        if ($hostid > 0) {
            $macros = CUserMacro::get(array('output' => API_OUTPUT_EXTEND, 'hostids' => $hostid));
            order_result($macros, 'macro');
        } else {
            if ($hostid === null) {
                $macros = CUserMacro::get(array('output' => API_OUTPUT_EXTEND, 'globalmacro' => 1));
                order_result($macros, 'macro');
            } else {
                $macros = array();
            }
        }
    }
    if (empty($macros)) {
        $macros = array(0 => array('macro' => '', 'value' => ''));
    }
    $macros_tbl = new CTable(SPACE, 'formElementTable');
    $macros_tbl->setAttribute('id', 'tbl_macros');
    $macros_tbl->addRow(array(SPACE, S_MACRO, SPACE, S_VALUE));
    insert_js('
			function addMacroRow(){

				if(typeof(addMacroRow.macro_count) == "undefined"){
					addMacroRow.macro_count = ' . count($macros) . ';
				}

				var tr = document.createElement("tr");
				tr.className = (addMacroRow.macro_count % 2) ? "form_even_row" : "form_odd_row";

				var td1 = document.createElement("td");
				tr.appendChild(td1);

				var cb = document.createElement("input");
				cb.setAttribute("type", "checkbox");
				cb.className = "checkbox";
				td1.appendChild(cb);
				td1.appendChild(document.createTextNode(" "));

				var td2 = document.createElement("td");
				tr.appendChild(td2);

				var text1 = document.createElement("input");
				text1.setAttribute("type", "text");
				text1.setAttribute("name", "macros["+addMacroRow.macro_count+"][macro]");
				text1.className = "biginput";
				text1.setAttribute("size",30);
				text1.setAttribute("placeholder","{$MACRO}");
				td2.appendChild(text1);
				td2.appendChild(document.createTextNode(" "));

				var td3 = document.createElement("td");
				tr.appendChild(td3);

				var span = document.createElement("span");
				span.innerHTML = "&rArr;";
				span.setAttribute("style", "vertical-align:top;");
				td3.appendChild(span);

				var td4 = document.createElement("td");
				tr.appendChild(td4);

				var text2 = document.createElement("input");
				text2.setAttribute("type", "text");
				text2.setAttribute("placeholder","<' . S_VALUE . '>");
				text2.setAttribute("name","macros["+addMacroRow.macro_count+"][value]");
				text2.className = "biginput";
				text2.setAttribute("size",40);
				td4.appendChild(text2);

				var sd = $("row_new_macro").insert({before : tr});
				addMacroRow.macro_count++;
			}
		');
    $macros = array_values($macros);
    foreach ($macros as $macroid => $macro) {
        $text1 = new CTextBox('macros[' . $macroid . '][macro]', $macro['macro'], 30);
        $text1->setAttribute('placeholder', '{$MACRO}');
        $text2 = new CTextBox('macros[' . $macroid . '][value]', $macro['value'], 40);
        $text2->setAttribute('placeholder', '<' . S_VALUE . '>');
        $span = new CSpan(RARR);
        $span->addStyle('vertical-align:top;');
        $macros_tbl->addRow(array(new CCheckBox(), $text1, $span, $text2));
    }
    $script = '$$("#tbl_macros input:checked").each(function(obj){ $(obj.parentNode.parentNode).remove(); if (typeof(deleted_macro_cnt) == \'undefined\') deleted_macro_cnt=1; else deleted_macro_cnt++; });';
    $delete_btn = new CButton('macros_del', S_DELETE_SELECTED, $script);
    $delete_btn->setType('button');
    $add_button = new CButton('macro_add', S_ADD, 'javascript: addMacroRow()');
    $add_button->setType('button');
    $buttonRow = new CRow();
    $buttonRow->setAttribute('id', 'row_new_macro');
    $col = new CCol(array($add_button, SPACE, $delete_btn));
    $col->setAttribute('colspan', 4);
    $buttonRow->addItem($col);
    $macros_tbl->addRow($buttonRow);
    $footer = null;
    if ($hostid === null) {
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:forms.inc.php

示例10: array

 $frmTRLog->addRow(S_ITEM, array($ctb, $cbtn));
 $frmTRLog->addVar('itemid', $itemid);
 $exp_select = new CComboBox('expr_type');
 $exp_select->setAttribute('id', 'expr_type');
 $exp_select->addItem(REGEXP_INCLUDE, S_INCLUDE_S);
 $exp_select->addItem(REGEXP_EXCLUDE, S_EXCLUDE);
 $ctb = new CTextBox('expression', '', 80);
 $ctb->setAttribute('id', 'logexpr');
 $cb = new CButton('add_exp', S_ADD, 'javascript: add_logexpr();');
 $cb->setType('button');
 $cb->setAttribute('id', 'add_exp');
 $cbAdd = new CButton('add_key_and', S_AND_BIG, 'javascript: add_keyword_and();');
 $cbAdd->setType('button');
 $cbAdd->setAttribute('id', 'add_key_and');
 $cbOr = new CButton('add_key_or', S_OR_BIG, 'javascript: add_keyword_or();');
 $cbOr->setType('button');
 $cbOr->setAttribute('id', 'add_key_or');
 $cbIregexp = new CCheckBox('iregexp', 'no', null, 1);
 $cbIregexp->setAttribute('id', 'iregexp');
 $frmTRLog->addRow(S_EXPRESSION, array($ctb, BR(), $cbIregexp, 'iregexp', SPACE, $cbAdd, SPACE, $cbOr, SPACE, $exp_select, SPACE, $cb));
 $keyTable = new CTableInfo(null);
 $keyTable->setAttribute('id', 'key_list');
 $keyTable->setHeader(array(S_KEYWORD, S_TYPE, S_ACTION));
 $table = new CTableInfo(null);
 $table->setAttribute('id', 'exp_list');
 $table->setHeader(array(S_EXPRESSION, S_TYPE, S_POSITION, S_ACTION));
 $maxid = 0;
 $bExprResult = true;
 $exprData = new CTriggerExpression(array('expression' => empty($expressions) ? '' : construct_expression($itemid, $expressions)));
 if (isset($_REQUEST['triggerid']) && !isset($_REQUEST['save_trigger']) && !empty($exprData->errors) && !isset($_REQUEST['form_refresh'])) {
     info($exprData->errors);
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_logform.php

示例11: CComboBox

 $frmCnct->addVar('linktriggers', $triggerids);
 $triggerid = get_request('triggerid', 0);
 $drawtype = get_request('drawtype', 0);
 $color = get_request('color', 'DD0000');
 $frmCnct->addVar('mapid', $_REQUEST['mapid']);
 $frmCnct->addVar('triggerid', $triggerid);
 // START comboboxes preparations
 $cmbType = new CComboBox('drawtype', $drawtype);
 $drawtypes = map_link_drawtypes();
 foreach ($drawtypes as $num => $i) {
     $value = map_link_drawtype2str($i);
     $cmbType->addItem($i, $value);
 }
 //---
 $btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?srctbl=triggers" . '&srcfld1=triggerid' . '&real_hosts=1' . '&reference=linktrigger' . '&multiselect=1' . "&writeonly=1');", 'T');
 $btnSelect->setType('button');
 $btnRemove = new CButton('remove', S_REMOVE);
 // END preparation
 $trList = new CListBox('del_linktriggers[]', null, 15);
 if (empty($triggers)) {
     $trList->setAttribute('style', 'width: 300px;');
 }
 foreach ($triggers as $tnum => $trigger) {
     $dbTriggers = CTrigger::get($options);
     order_result($dbTriggers, 'description');
     $host = reset($trigger['hosts']);
     $trList->addItem($trigger['triggerid'], $host['host'] . ':' . expand_trigger_description_by_data($trigger));
 }
 $frmCnct->addRow(S_TRIGGERS, array($trList, BR(), $btnSelect, $btnRemove));
 $frmCnct->addRow(S_TYPE . ' (' . S_PROBLEM_BIG . ')', $cmbType);
 $frmCnct->addRow(S_COLOR . ' (' . S_PROBLEM_BIG . ')', new CColor('color', $color));
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:popup_link_tr.php


注:本文中的CButton::setType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。