本文整理汇总了PHP中CSpan::addAction方法的典型用法代码示例。如果您正苦于以下问题:PHP CSpan::addAction方法的具体用法?PHP CSpan::addAction怎么用?PHP CSpan::addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSpan
的用法示例。
在下文中一共展示了CSpan::addAction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$i['action'] = str_in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues';
$i['description'] = item_description($item);
$items[] = $i;
}
// Actions
$actions = get_event_actions_status($event['eventid']);
if ($config['event_ack_enable']) {
if ($event['acknowledged'] == 1) {
$ack = new CLink(S_YES, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $page['file']);
} else {
$ack = new CLink(S_NO, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $page['file'], 'on');
}
}
$description = expand_trigger_description_by_data(zbx_array_merge($trigger, array('clock' => $event['clock'])), ZBX_FLAG_EVENT);
$tr_desc = new CSpan($description, 'pointer');
$tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $event['clock'] . "'})," . zbx_jsvalue($items, true) . ");");
// Duration
$tr_event = $event + $trigger;
if ($next_event = get_next_event($tr_event, $events, $_REQUEST['hide_unknown'])) {
$event['duration'] = zbx_date2age($tr_event['clock'], $next_event['clock']);
} else {
$event['duration'] = zbx_date2age($tr_event['clock']);
}
$table->addRow(array(new CLink(zbx_date2str(S_EVENTS_ACTION_TIME_FORMAT, $event['clock']), 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid'], 'action'), is_show_all_nodes() ? get_node_name_by_elid($event['objectid']) : null, $_REQUEST['hostid'] == 0 ? $host['host'] : null, new CSpan($tr_desc, 'link_menu'), new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value'])), new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority'], $event['value'])), $event['duration'], $config['event_ack_enable'] ? $ack : NULL, $actions));
}
}
$table = array($paging, $table, $paging);
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
}
$events_wdgt->addItem($table);
示例2: CSpan
$items[$inum]['description'] = $item_description;
}
$trigger['items'] = $items;
//----
$description = new CSpan($description, 'link_menu');
// trigger description js menu {{{
$hosts = reset($trigger['hosts']);
$menu_trigger_conf = 'null';
if ($admin_links) {
$menu_trigger_conf = "['" . S_CONFIGURATION_OF_TRIGGERS . "',\"javascript:\n\t\t\t\tredirect('triggers.php?form=update&triggerid=" . $trigger['triggerid'] . '&switch_node=' . id2nodeid($trigger['triggerid']) . "')\",\n\t\t\t\tnull, {'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
}
$menu_trigger_url = 'null';
if (!zbx_empty($trigger['url'])) {
$menu_trigger_url = "['" . S_URL . "',\"javascript: window.location.href='" . $trigger['url'] . "'\",\n\t\t\t\tnull, {'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
}
$description->addAction('onclick', "javascript: create_mon_trigger_menu(event, new Array({'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $trigger['lastchange'] . "'}, " . $menu_trigger_conf . ", " . $menu_trigger_url . ")," . zbx_jsvalue($items, true) . ");");
// }}} trigger description js menu
if ($_REQUEST['show_details']) {
$font = new CTag('font', 'yes');
$font->setAttribute('color', '#000');
$font->setAttribute('size', '-2');
$font->addItem(explode_exp($trigger['expression'], 1, false, true));
$description = array($description, BR(), $font);
}
// DEPENDENCIES {{{
if (!empty($trigger['dependencies'])) {
$dep_table = new CTableInfo();
$dep_table->setAttribute('style', 'width: 200px;');
$dep_table->addRow(bold(S_DEPENDS_ON . ':'));
foreach ($trigger['dependencies'] as $dep) {
$dep_table->addRow(' - ' . expand_trigger_description($dep['triggerid']));
示例3: openWinCentered
$menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $row['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
$menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
$menus = rtrim($menus, ',');
$menus = "show_popup_menu(event,[[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
$host = new CSpan($row['host'], 'pointer');
$host->setAttribute('onclick', 'javascript: ' . $menus);
}
$tr_conf_link = 'null';
if ($admin_links) {
$tr_conf_link = "['" . S_CONFIGURATION_OF_TRIGGERS . "',\"javascript: redirect('triggers.php?form=update&triggerid=" . $row['triggerid'] . "&hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
}
$tr_desc = new CSpan($description, 'pointer');
$tr_desc->addAction('onclick', "javascript: create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $row['triggerid'] . "', 'lastchange': '" . $row['lastchange'] . "'}, " . $tr_conf_link . ")," . zbx_jsvalue($row['items']) . ");");
// We add 1 to event start url, so events would show it
$clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row['lastchange']), 'events.php?triggerid=' . $row['triggerid'] . '&nav_time=' . ($row['lastchange'] + 1), 'action');
//--
$table->addRow(array($show_event_col ? SPACE : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row['value'])), $value, $clock, get_node_name_by_elid($row['triggerid']), $host, $tr_desc, $actions, $show_event_col ? SPACE : NULL, new CLink(zbx_empty($row['comments']) ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action')));
$event_limit = 0;
foreach ($row['events'] as $eventid => $row_event) {
$value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
if ($config['event_ack_enable']) {
if ($row_event['acknowledged'] == 1) {
$acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid']));
$ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'], 'action'), ')');
} else {
$ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
}
}
示例4: bar_report_form2
function bar_report_form2()
{
global $USER_DETAILS;
$config = get_request('config', 1);
$title = get_request('title', S_REPORT . ' 2');
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$sorttype = get_request('sorttype', 0);
$captions = get_request('captions', array());
$items = get_request('items', array());
$periods = get_request('periods', array());
$showlegend = get_request('showlegend', 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('items', $items);
// periods add later
$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));
if (count($periods) < 2) {
$sortCmb = new CComboBox('sorttype', $sorttype);
$sortCmb->addItem(0, S_NAME);
$sortCmb->addItem(1, S_VALUE);
$reportForm->addRow(S_SORT_BY, $sortCmb);
} else {
$reportForm->addVar('sortorder', 0);
}
//*/
// PERIODS
if (count($periods)) {
$periods_table = new CTableInfo();
foreach ($periods as $pid => $period) {
$color = new CColorCell(null, $period['color']);
$edit_link = 'popup_period.php?period_id=' . $pid . '&config=2' . '&dstfrm=' . $reportForm->getName() . '&caption=' . $period['caption'] . '&report_timesince=' . $period['report_timesince'] . '&report_timetill=' . $period['report_timetill'] . '&color=' . $period['color'];
$caption = new CSpan($period['caption'], 'link');
$caption->addAction('onclick', "return PopUp('" . $edit_link . "',840,340,'period_form');");
$periods_table->addRow(array(new CCheckBox('group_pid[' . $pid . ']'), $caption, zbx_date2str(S_REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timesince']), zbx_date2str(S_REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timetill']), $color));
}
$delete_button = new CButton('delete_period', S_DELETE_SELECTED);
} else {
$periods_table = $delete_button = null;
}
$reportForm->addVar('periods', $periods);
$reportForm->addRow(S_PERIOD, array($periods_table, new CButton('add_period', S_ADD, "return PopUp('popup_period.php?config=2&dstfrm=" . $reportForm->getName() . "',840,340,'period_form');"), $delete_button));
unset($periods_table, $delete_button);
//-----------
// ITEMS
if (count($items)) {
$items_table = new CTableInfo();
foreach ($items as $gid => $gitem) {
$host = get_host_by_itemid($gitem['itemid']);
$item = get_item_by_itemid($gitem['itemid']);
if ($host['status'] == HOST_STATUS_TEMPLATE) {
$only_hostid = $host['hostid'];
} else {
$monitored_hosts = 1;
}
$caption = new CSpan($gitem['caption'], 'link');
$caption->onClick('return PopUp("popup_bitem.php?config=2&list_name=items&dstfrm=' . $reportForm->GetName() . url_param($gitem, false) . url_param($gid, false, 'gid') . '",550,400,"graph_item_form");');
$description = $host['host'] . ': ' . item_description($item);
$items_table->addRow(array(new CCheckBox('group_gid[' . $gid . ']', isset($group_gid[$gid])), $caption, $description, graph_item_calc_fnc2str($gitem['calc_fnc'], 0)));
}
$delete_button = new CButton('delete_item', S_DELETE_SELECTED);
} else {
$items_table = $delete_button = null;
}
$reportForm->addRow(S_ITEMS, array($items_table, new CButton('add_item', S_ADD, "return PopUp('popup_bitem.php?config=2&dstfrm=" . $reportForm->getName() . "',550,400,'graph_item_form');"), $delete_button));
unset($items_table, $delete_button);
//--------------
$reportForm->addItemToBottomRow(new CButton('report_show', S_SHOW));
$reset = new CButton('reset', S_RESET);
$reset->setType('reset');
$reportForm->addItemToBottomRow($reset);
return $reportForm;
}
示例5: CTextBox
$templateUrlLabel = new CTextBox('urls[#{id}][name]', '', 32);
$templateUrlLabel->setAttribute('disabled', 'disabled');
$templateUrlLink = new CTextBox('urls[#{id}][url]', '', 32);
$templateUrlLink->setAttribute('disabled', 'disabled');
$templateUrlEtype = new CComboBox('urls[#{id}][elementtype]');
$templateUrlEtype->setAttribute('disabled', 'disabled');
$templateUrlEtype->addItems(sysmap_element_types());
$templateRemoveButton = new CSpan(_('Remove'), 'link_menu');
$templateRemoveButton->addAction('onclick', '$("entry_#{id}").remove();');
$templateUrlRow = new CRow(array($templateUrlLabel, $templateUrlLink, $templateUrlEtype, $templateRemoveButton));
$templateUrlRow->addStyle('display: none');
$templateUrlRow->setAttribute('id', 'urlEntryTpl');
$urlTable->addRow($templateUrlRow);
// append "add" button to url table
$addButton = new CSpan(_('Add'), 'link_menu');
$addButton->addAction('onclick', 'cloneRow("urlEntryTpl", ' . $i . ')');
$addButtonColumn = new CCol($addButton);
$addButtonColumn->setColSpan(4);
$urlTable->addRow($addButtonColumn);
// append url table to form list
$sysmapList->addRow(_('URLs'), new CDiv($urlTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// append sysmap to form
$sysmapTab = new CTabView();
$sysmapTab->addTab('sysmapTab', _('Map'), $sysmapList);
$sysmapForm->addItem($sysmapTab);
// append buttons to form
if (hasRequest('sysmapid') && getRequest('sysmapid') > 0) {
$sysmapForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButton('clone', _('Clone')), new CButtonDelete(_('Delete network map?'), url_param('form') . url_param('sysmapid')), new CButtonCancel())));
} else {
$sysmapForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel()));
}
示例6: get_item_filter_form
function get_item_filter_form()
{
$selection_mode = $_REQUEST['selection_mode'];
$filter_node = $_REQUEST['filter_node'];
$filter_group = $_REQUEST['filter_group'];
$filter_host = $_REQUEST['filter_host'];
$filter_application = $_REQUEST['filter_application'];
$filter_description = $_REQUEST['filter_description'];
$filter_type = $_REQUEST['filter_type'];
$filter_key = $_REQUEST['filter_key'];
$filter_snmp_community = $_REQUEST['filter_snmp_community'];
$filter_snmp_oid = $_REQUEST['filter_snmp_oid'];
$filter_snmp_port = $_REQUEST['filter_snmp_port'];
$filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname'];
$filter_snmpv3_securitylevel = $_REQUEST['filter_snmpv3_securitylevel'];
$filter_snmpv3_authpassphrase = $_REQUEST['filter_snmpv3_authpassphrase'];
$filter_snmpv3_privpassphrase = $_REQUEST['filter_snmpv3_privpassphrase'];
$filter_value_type = $_REQUEST['filter_value_type'];
$filter_data_type = $_REQUEST['filter_data_type'];
$filter_units = $_REQUEST['filter_units'];
$filter_formula = $_REQUEST['filter_formula'];
$filter_delay = $_REQUEST['filter_delay'];
$filter_history = $_REQUEST['filter_history'];
$filter_trends = $_REQUEST['filter_trends'];
$filter_status = $_REQUEST['filter_status'];
$filter_logtimefmt = $_REQUEST['filter_logtimefmt'];
$filter_delta = $_REQUEST['filter_delta'];
$filter_trapper_hosts = $_REQUEST['filter_trapper_hosts'];
$form = new CFormTable(S_ITEM . ' ' . S_FILTER);
$form->addOption('name', 'zbx_filter');
$form->addOption('id', 'zbx_filter');
$form->SetMethod('get');
$form->addAction('onsubmit', "javascript: if(empty_form(this)) return Confirm('Filter is empty! All items will be selected. Proceed?');");
$form->addVar('filter_hostid', get_request('filter_hostid', get_request('hostid')));
$form->addVar('selection_mode', $selection_mode);
$modeLink = new CSpan($selection_mode == 0 ? S_ADVANCED : S_SIMPLE, 'link');
$modeLink->addAction('onclick', "javascript: create_var('" . $form->GetName() . "','selection_mode'," . ($selection_mode == 0 ? 1 : 0) . ',true);');
$form->addRow(S_SELECTION_MODE, $modeLink);
if (ZBX_DISTRIBUTED && $selection_mode) {
$form->addRow(array('from ', bold(S_NODE), ' like'), array(new CTextBox('filter_node', $filter_node, 32), new CButton('btn_node', S_SELECT, "return PopUp('popup.php?dstfrm=" . $form->GetName() . "&dstfld1=filter_node&srctbl=nodes&srcfld1=name',450,450);", "G")));
}
if ($selection_mode) {
$form->addRow(array('from ', bold(S_HOST_GROUP), ' like'), array(new CTextBox('filter_group', $filter_group, 32), new CButton("btn_group", S_SELECT, "return PopUp('popup.php?dstfrm=" . $form->GetName() . "&dstfld1=filter_group&srctbl=host_group&srcfld1=name',450,450);", "G")));
}
$form->addRow(array('from ', bold(S_HOST), ' like'), array(new CTextBox('filter_host', $filter_host, 32), new CButton("btn_host", S_SELECT, "return PopUp('popup.php?dstfrm=" . $form->GetName() . "&dstfld1=filter_host&dstfld2=filter_hostid&srctbl=hosts&srcfld1=host&srcfld2=hostid',450,450);", 'H')));
if ($selection_mode) {
$form->addRow(array('from ', bold(S_APPLICATION), ' like'), array(new CTextBox('filter_application', $filter_application, 32), new CButton('btn_app', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->GetName() . '&dstfld1=filter_application&srctbl=applications' . '&srcfld1=name",400,300,"application");', 'A')));
}
$form->addRow(array('with ', bold(S_DESCRIPTION), ' like'), new CTextBox("filter_description", $filter_description, 40));
if ($selection_mode) {
$cmbType = new CComboBox("filter_type", $filter_type, "submit()");
$cmbType->addItem(-1, S_ALL_SMALL);
foreach (array(ITEM_TYPE_ZABBIX, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV1, ITEM_TYPE_SNMPV2C, ITEM_TYPE_SNMPV3, ITEM_TYPE_TRAPPER, ITEM_TYPE_INTERNAL, ITEM_TYPE_AGGREGATE, ITEM_TYPE_HTTPTEST, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI) as $it) {
$cmbType->addItem($it, item_type2str($it));
}
$form->addRow(array('with ', bold(S_TYPE)), $cmbType);
}
$form->addRow(array('with ', bold(S_KEY), ' like'), array(new CTextBox("filter_key", $filter_key, 40)));
if ($selection_mode) {
if ($filter_type == ITEM_TYPE_SNMPV1 || $filter_type == ITEM_TYPE_SNMPV2C || $filter_type == ITEM_TYPE_SNMPV3) {
$form->addRow(array('with ', bold(S_SNMP_COMMUNITY), ' like'), new CTextBox("filter_snmp_community", $filter_snmp_community, 16));
$form->addRow(array('with ', bold(S_SNMP_OID), ' like'), new CTextBox("filter_snmp_oid", $filter_snmp_oid, 40));
$form->addRow(array('with ', bold(S_SNMP_PORT), ' like'), new CNumericBox("filter_snmp_port", $filter_snmp_port, 5, null, true));
}
if ($filter_type == ITEM_TYPE_SNMPV3) {
$form->addRow(array('with ', bold(S_SNMPV3_SECURITY_NAME), ' like'), new CTextBox("filter_snmpv3_securityname", $filter_snmpv3_securityname, 64));
$cmbSecLevel = new CComboBox("filter_snmpv3_securitylevel", $filter_snmpv3_securitylevel);
$cmbSecLevel->addItem(-1, S_ALL_SMALL);
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV, "NoAuthPriv");
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, "AuthNoPriv");
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, "AuthPriv");
$form->addRow(array('with ', bold(S_SNMPV3_SECURITY_LEVEL)), $cmbSecLevel);
$form->addRow(array('with ', bold(S_SNMPV3_AUTH_PASSPHRASE), ' like'), new CTextBox("filter_snmpv3_authpassphrase", $filter_snmpv3_authpassphrase, 64));
$form->addRow(array('with ', bold(S_SNMPV3_PRIV_PASSPHRASE), ' like'), new CTextBox("filter_snmpv3_privpassphrase", $filter_snmpv3_privpassphrase, 64));
}
$cmbValType = new CComboBox("filter_value_type", $filter_value_type, "submit()");
$cmbValType->AddItem(-1, S_ALL_SMALL);
$cmbValType->AddItem(ITEM_VALUE_TYPE_UINT64, S_NUMERIC_UNSIGNED);
$cmbValType->AddItem(ITEM_VALUE_TYPE_FLOAT, S_NUMERIC_FLOAT);
$cmbValType->AddItem(ITEM_VALUE_TYPE_STR, S_CHARACTER);
$cmbValType->AddItem(ITEM_VALUE_TYPE_LOG, S_LOG);
$cmbValType->AddItem(ITEM_VALUE_TYPE_TEXT, S_TEXT);
$form->AddRow(array('with ', bold(S_TYPE_OF_INFORMATION)), $cmbValType);
if ($filter_value_type == ITEM_VALUE_TYPE_UINT64) {
$cmbDataType = new CComboBox("filter_data_type", $filter_data_type, "submit()");
$cmbDataType->addItem(-1, S_ALL_SMALL);
$cmbDataType->addItem(ITEM_DATA_TYPE_DECIMAL, item_data_type2str(ITEM_DATA_TYPE_DECIMAL));
$cmbDataType->addItem(ITEM_DATA_TYPE_OCTAL, item_data_type2str(ITEM_DATA_TYPE_OCTAL));
$cmbDataType->addItem(ITEM_DATA_TYPE_HEXADECIMAL, item_data_type2str(ITEM_DATA_TYPE_HEXADECIMAL));
$form->addRow(array('with ', bold(S_DATA_TYPE)), $cmbDataType);
}
if ($filter_value_type == ITEM_VALUE_TYPE_FLOAT || $filter_value_type == ITEM_VALUE_TYPE_UINT64) {
$form->addRow(array('with ', bold(S_UNITS)), new CTextBox("filter_units", $filter_units, 40));
$form->addRow(array('with ', bold(S_CUSTOM_MULTIPLIER), ' like'), new CTextBox("filter_formula", $filter_formula, 40));
}
if ($filter_type != ITEM_TYPE_TRAPPER && $filter_type != ITEM_TYPE_HTTPTEST) {
$form->addRow(array('with ', bold(S_UPDATE_INTERVAL_IN_SEC)), new CNumericBox("filter_delay", $filter_delay, 5, null, true));
}
$form->addRow(array('with ', bold(S_KEEP_HISTORY_IN_DAYS)), new CNumericBox("filter_history", $filter_history, 8, null, true));
$form->addRow(array('with ', bold(S_KEEP_TRENDS_IN_DAYS)), new CNumericBox("filter_trends", $filter_trends, 8, null, true));
//.........这里部分代码省略.........
示例7: valueDistributionFormForMultipleItems
/**
* Create bar report form for "Distribution of values for multiple items".
*
* @param array $items
* @param array $periods
*
* @return object $reportForm
*/
function valueDistributionFormForMultipleItems($items = array(), $periods = array())
{
$config = get_request('config', 1);
$title = get_request('title', _('Report 2'));
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$sorttype = get_request('sorttype', 0);
$showlegend = get_request('showlegend', 0);
$reportForm = new CFormTable(null, null, 'get');
$reportForm->setAttribute('name', 'zbx_report');
$reportForm->setAttribute('id', 'zbx_report');
if (isset($_REQUEST['report_show']) && is_array($items) && $items && is_array($periods) && $periods) {
$reportForm->addVar('report_show', 'show');
}
$reportForm->addVar('config', $config);
$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));
if (count($periods) < 2) {
$sortCmb = new CComboBox('sorttype', $sorttype);
$sortCmb->addItem(0, _('Name'));
$sortCmb->addItem(1, _('Value'));
$reportForm->addRow(_('Sort by'), $sortCmb);
} else {
$reportForm->addVar('sortorder', 0);
}
if (is_array($periods) && $periods) {
$periods_table = new CTableInfo();
foreach ($periods as $pid => $period) {
$color = new CColorCell(null, $period['color']);
$edit_link = 'popup_period.php?' . 'period_id=' . $pid . '&config=2' . '&dstfrm=' . $reportForm->getName() . '&caption=' . $period['caption'] . '&report_timesince=' . $period['report_timesince'] . '&report_timetill=' . $period['report_timetill'] . '&color=' . $period['color'];
$caption = new CSpan($period['caption'], 'link');
$caption->addAction('onclick', "return PopUp('" . $edit_link . "',840,340,'period_form');");
$periods_table->addRow(array(new CCheckBox('group_pid[' . $pid . ']'), $caption, zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timesince']), zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timetill']), $color));
}
$reportForm->addVar('periods', $periods);
$delete_button = new CSubmit('delete_period', _('Delete selected'));
} else {
$periods_table = $delete_button = null;
}
$reportForm->addRow(_('Period'), array($periods_table, new CButton('add_period', _('Add'), 'return PopUp("popup_period.php?config=2&dstfrm=' . $reportForm->getName() . '", 840, 340, "period_form");'), $delete_button));
unset($periods_table, $delete_button);
if (is_array($items) && $items) {
$items_table = new CTableInfo();
foreach ($items as $id => &$item) {
$caption = new CSpan($item['caption'], 'link');
$caption->onClick('return PopUp("popup_bitem.php?' . 'config=2' . '&list_name=items' . '&dstfrm=' . $reportForm->GetName() . url_param($item, false) . url_param($id, false, 'gid') . '", 550, 400, "graph_item_form");');
$description = $item['host']['name'] . NAME_DELIMITER . itemName($item);
$items_table->addRow(array(new CCheckBox('group_gid[' . $id . ']', isset($group_gid[$id])), $caption, $description, graph_item_calc_fnc2str($item['calc_fnc'], 0)));
// once used, unset unnecessary fields so they don't pass to URL. "color" goes in "periods" parameter.
unset($item['value_type'], $item['host'], $item['name'], $item['color']);
}
unset($item);
$reportForm->addVar('items', $items);
$delete_button = new CSubmit('delete_item', _('Delete selected'));
} else {
$items_table = $delete_button = null;
}
$reportForm->addRow(_('Items'), array($items_table, new CButton('add_item', _('Add'), "return PopUp('popup_bitem.php?config=2&dstfrm=" . $reportForm->getName() . "', 550, 400, 'graph_item_form');"), $delete_button));
unset($items_table, $delete_button);
$reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show')));
$reset = new CButton('reset', _('Reset'));
$reset->setType('reset');
$reportForm->addItemToBottomRow($reset);
return $reportForm;
}
示例8: array
$trigger['items'][$item['itemid']] = array('itemid' => $item['itemid'], 'action' => str_in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues', 'name' => itemName($item), 'value_type' => $item['value_type']);
}
$triggers[$tid] = $trigger;
}
CArrayHelper::sort($triggers, array(array('field' => 'cnt_event', 'order' => ZBX_SORT_DOWN), 'host', 'description', 'priority'));
$scripts_by_hosts = API::Script()->getScriptsByHosts($hosts);
foreach ($triggers as $trigger) {
$menus = '';
$host_nodeid = id2nodeid($trigger['hostid']);
foreach ($scripts_by_hosts[$trigger['hostid']] as $script) {
$script_nodeid = id2nodeid($script['scriptid']);
if (bccomp($host_nodeid, $script_nodeid) == 0) {
$menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['hostid'] . "&scriptid=" . $script['scriptid'] . "','Global script',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
}
}
$menus .= "['" . _('URLs') . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
$menus .= "['" . _('Latest data') . "',\"javascript: redirect('latest.php?hostid=" . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
$menus = "show_popup_menu(event,[['" . _('Scripts') . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
$hostSpan = new CSpan($trigger['hostname'], 'link_menu');
$hostSpan->setAttribute('onclick', $menus);
$tr_conf_link = 'null';
if ($USER_DETAILS['type'] > USER_TYPE_ZABBIX_USER && $trigger['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$tr_conf_link = "['" . _('Configuration of trigger') . "',\"javascript: redirect('triggers.php?form=update&triggerid=" . $trigger['triggerid'] . "&hostid=" . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
}
$tr_desc = new CSpan($trigger['description'], 'link_menu');
$tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " [{'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $trigger['lastchange'] . "'}," . $tr_conf_link . "]," . zbx_jsvalue($trigger['items'], true) . ");");
$table->addRow(array(get_node_name_by_elid($trigger['triggerid']), $hostSpan, $tr_desc, getSeverityCell($trigger['priority']), $trigger['cnt_event']));
}
$rprt_wdgt->addItem($table);
$rprt_wdgt->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
示例9: bar_report_form2
function bar_report_form2()
{
$config = get_request('config', 1);
$title = get_request('title', _('Report 2'));
$xlabel = get_request('xlabel', '');
$ylabel = get_request('ylabel', '');
$sorttype = get_request('sorttype', 0);
$items = get_request('items', array());
$periods = get_request('periods', array());
$showlegend = get_request('showlegend', 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('items', $items);
// periods add later
$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));
if (count($periods) < 2) {
$sortCmb = new CComboBox('sorttype', $sorttype);
$sortCmb->addItem(0, _('Name'));
$sortCmb->addItem(1, _('Value'));
$reportForm->addRow(_('Sort by'), $sortCmb);
} else {
$reportForm->addVar('sortorder', 0);
}
//*/
// PERIODS
if (count($periods)) {
$periods_table = new CTableInfo();
foreach ($periods as $pid => $period) {
$color = new CColorCell(null, $period['color']);
$edit_link = 'popup_period.php?period_id=' . $pid . '&config=2' . '&dstfrm=' . $reportForm->getName() . '&caption=' . $period['caption'] . '&report_timesince=' . $period['report_timesince'] . '&report_timetill=' . $period['report_timetill'] . '&color=' . $period['color'];
$caption = new CSpan($period['caption'], 'link');
$caption->addAction('onclick', "return PopUp('" . $edit_link . "',840,340,'period_form');");
$periods_table->addRow(array(new CCheckBox('group_pid[' . $pid . ']'), $caption, zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timesince']), zbx_date2str(REPORTS_BAR_REPORT_DATE_FORMAT, $period['report_timetill']), $color));
}
$delete_button = new CSubmit('delete_period', _('Delete selected'));
} else {
$periods_table = $delete_button = null;
}
$reportForm->addVar('periods', $periods);
$reportForm->addRow(_('Period'), array($periods_table, new CButton('add_period', _('Add'), "return PopUp('popup_period.php?config=2&dstfrm=" . $reportForm->getName() . "',840,340,'period_form');"), $delete_button));
unset($periods_table, $delete_button);
//-----------
// ITEMS
if (count($items)) {
$items_table = new CTableInfo();
foreach ($items as $gid => $gitem) {
$host = get_host_by_itemid($gitem['itemid']);
$item = get_item_by_itemid($gitem['itemid']);
$caption = new CSpan($gitem['caption'], 'link');
$caption->onClick('return PopUp("popup_bitem.php?config=2&list_name=items&dstfrm=' . $reportForm->GetName() . url_param($gitem, false) . url_param($gid, false, 'gid') . '",550,400,"graph_item_form");');
$description = $host['name'] . ': ' . itemName($item);
$items_table->addRow(array(new CCheckBox('group_gid[' . $gid . ']', isset($group_gid[$gid])), $caption, $description, graph_item_calc_fnc2str($gitem['calc_fnc'], 0)));
}
$delete_button = new CSubmit('delete_item', _('Delete selected'));
} else {
$items_table = $delete_button = null;
}
$reportForm->addRow(_('Items'), array($items_table, new CButton('add_item', _('Add'), "return PopUp('popup_bitem.php?config=2&dstfrm=" . $reportForm->getName() . "',550,400,'graph_item_form');"), $delete_button));
unset($items_table, $delete_button);
//--------------
$reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show')));
$reset = new CButton('reset', _('Reset'));
$reset->setType('reset');
$reportForm->addItemToBottomRow($reset);
return $reportForm;
}