本文整理汇总了PHP中CForm::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::setAttribute方法的具体用法?PHP CForm::setAttribute怎么用?PHP CForm::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CComboBox
$inventoryFieldsComboBox->addItem($inventoryField['db_field'], $inventoryField['title']);
}
$exactComboBox = new CComboBox('filter_exact', $this->data['filterExact']);
$exactComboBox->addItem('0', _('like'));
$exactComboBox->addItem('1', _('exactly'));
$filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories');
$filter = new CSubmit('filter_set', _('Filter'));
$filter->useJQueryStyle('main');
$reset = new CSubmit('filter_rst', _('Reset'));
$reset->useJQueryStyle();
$divButtons = new CDiv(array($filter, SPACE, $reset));
$divButtons->setAttribute('style', 'padding: 4px 0px;');
$footerCol = new CCol($divButtons, 'controls');
$filterTable->addRow($footerCol);
$filterForm = new CForm('get');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addItem($filterTable);
$hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0));
$hostInventoryWidget->addHeaderRowNumber();
$table = new CTableInfo(_('No hosts found.'));
$table->setHeader(array(make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder'])));
foreach ($this->data['hosts'] as $host) {
$hostGroups = array();
foreach ($host['groups'] as $group) {
$hostGroups[] = $group['name'];
}
natsort($hostGroups);
$hostGroups = implode(', ', $hostGroups);
$row = array(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid'), $host['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''), $hostGroups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a']));
$table->addRow($row);
示例2: unset
$menu_table->setCellSpacing(0);
$menu_table->setCellPadding(5);
$menu_table->addRow($main_menu);
$node_form = null;
if (ZBX_DISTRIBUTED && !defined('ZBX_HIDE_NODE_SELECTION')) {
insert_js_function('check_all');
$available_nodes = get_accessible_nodes_by_user(CWebUser::$data, PERM_READ, PERM_RES_DATA_ARRAY);
$available_nodes = get_tree_by_parentid($ZBX_LOCALNODEID, $available_nodes, 'masterid');
// remove parent nodes
if (empty($available_nodes[0])) {
unset($available_nodes[0]);
}
if (!empty($available_nodes)) {
$node_form = new CForm('get');
$node_form->cleanItems();
$node_form->setAttribute('id', 'node_form');
// create ComboBox with selected nodes
$nodesComboBox = null;
if (count($ZBX_VIEWED_NODES['nodes']) > 0) {
$nodesComboBox = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()');
foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) {
$nodesComboBox->addItem($nodeid, $nodedata['name']);
}
}
$jscript = 'javascript: ' . " var pos = getPosition('button_show_tree');" . " showHide('div_node_tree', 'table');" . ' pos.top += 20;' . " \$('div_node_tree').setStyle({top: pos.top + 'px'});";
$button_show_tree = new CButton('show_node_tree', _('Select Nodes'), $jscript);
$button_show_tree->setAttribute('id', 'button_show_tree');
// create node tree
$node_tree = array();
$node_tree[0] = array('id' => 0, 'caption' => _('All'), 'combo_select_node' => new CCheckbox('check_all_nodes', null, "javascript : check_all('node_form', this.checked);"), 'parentid' => 0);
foreach ($available_nodes as $node) {
示例3: getItemFilterForm
function getItemFilterForm(&$items)
{
$filter_groupId = $_REQUEST['filter_groupid'];
$filter_hostId = $_REQUEST['filter_hostid'];
$filter_application = $_REQUEST['filter_application'];
$filter_name = $_REQUEST['filter_name'];
$filter_type = $_REQUEST['filter_type'];
$filter_key = $_REQUEST['filter_key'];
$filter_snmp_community = $_REQUEST['filter_snmp_community'];
$filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname'];
$filter_snmp_oid = $_REQUEST['filter_snmp_oid'];
$filter_port = $_REQUEST['filter_port'];
$filter_value_type = $_REQUEST['filter_value_type'];
$filter_data_type = $_REQUEST['filter_data_type'];
$filter_delay = $_REQUEST['filter_delay'];
$filter_history = $_REQUEST['filter_history'];
$filter_trends = $_REQUEST['filter_trends'];
$filter_status = $_REQUEST['filter_status'];
$filter_state = $_REQUEST['filter_state'];
$filter_templated_items = $_REQUEST['filter_templated_items'];
$filter_with_triggers = $_REQUEST['filter_with_triggers'];
$subfilter_hosts = $_REQUEST['subfilter_hosts'];
$subfilter_apps = $_REQUEST['subfilter_apps'];
$subfilter_types = $_REQUEST['subfilter_types'];
$subfilter_value_types = $_REQUEST['subfilter_value_types'];
$subfilter_status = $_REQUEST['subfilter_status'];
$subfilter_state = $_REQUEST['subfilter_state'];
$subfilter_templated_items = $_REQUEST['subfilter_templated_items'];
$subfilter_with_triggers = $_REQUEST['subfilter_with_triggers'];
$subfilter_history = $_REQUEST['subfilter_history'];
$subfilter_trends = $_REQUEST['subfilter_trends'];
$subfilter_interval = $_REQUEST['subfilter_interval'];
$form = new CForm('get');
$form->setAttribute('name', 'zbx_filter');
$form->setAttribute('id', 'zbx_filter');
$form->addVar('subfilter_hosts', $subfilter_hosts);
$form->addVar('subfilter_apps', $subfilter_apps);
$form->addVar('subfilter_types', $subfilter_types);
$form->addVar('subfilter_value_types', $subfilter_value_types);
$form->addVar('subfilter_status', $subfilter_status);
$form->addVar('subfilter_state', $subfilter_state);
$form->addVar('subfilter_templated_items', $subfilter_templated_items);
$form->addVar('subfilter_with_triggers', $subfilter_with_triggers);
$form->addVar('subfilter_history', $subfilter_history);
$form->addVar('subfilter_trends', $subfilter_trends);
$form->addVar('subfilter_interval', $subfilter_interval);
// type select
$fTypeVisibility = array();
$cmbType = new CComboBox('filter_type', $filter_type);
$cmbType->setAttribute('id', 'filter_type');
$cmbType->addItem(-1, _('all'));
foreach (array('filter_delay_label', 'filter_delay') as $vItem) {
zbx_subarray_push($fTypeVisibility, -1, $vItem);
}
$itemTypes = item_type2str();
unset($itemTypes[ITEM_TYPE_HTTPTEST]);
// httptest items are only for internal zabbix logic
$cmbType->addItems($itemTypes);
foreach ($itemTypes as $typeNum => $typeLabel) {
if ($typeNum != ITEM_TYPE_TRAPPER) {
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label');
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay');
}
switch ($typeNum) {
case ITEM_TYPE_SNMPV1:
case ITEM_TYPE_SNMPV2C:
$snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port');
foreach ($snmp_types as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
case ITEM_TYPE_SNMPV3:
foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port') as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
}
}
zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ');');
// type of information select
$fVTypeVisibility = array();
$cmbValType = new CComboBox('filter_value_type', $filter_value_type);
$cmbValType->addItem(-1, _('all'));
$cmbValType->addItem(ITEM_VALUE_TYPE_UINT64, _('Numeric (unsigned)'));
$cmbValType->addItem(ITEM_VALUE_TYPE_FLOAT, _('Numeric (float)'));
$cmbValType->addItem(ITEM_VALUE_TYPE_STR, _('Character'));
$cmbValType->addItem(ITEM_VALUE_TYPE_LOG, _('Log'));
$cmbValType->addItem(ITEM_VALUE_TYPE_TEXT, _('Text'));
foreach (array('filter_data_type_label', 'filter_data_type') as $vItem) {
zbx_subarray_push($fVTypeVisibility, ITEM_VALUE_TYPE_UINT64, $vItem);
}
zbx_add_post_js("var filterValueTypeSwitcher = new CViewSwitcher('filter_value_type', 'change', " . zbx_jsvalue($fVTypeVisibility, true) . ');');
// status select
$cmbStatus = new CComboBox('filter_status', $filter_status);
$cmbStatus->addItem(-1, _('all'));
foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED) as $status) {
$cmbStatus->addItem($status, item_status2str($status));
}
// state select
$cmbState = new CComboBox('filter_state', $filter_state);
//.........这里部分代码省略.........
示例4: CWidget
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$dashconfWidget = new CWidget();
$dashconfWidget->setClass('header');
$dashconfWidget->addPageHeader(_('DASHBOARD CONFIGURATION'));
// create form
$dashconfForm = new CForm();
$dashconfForm->setName('dashconf');
$dashconfForm->setAttribute('id', 'dashform');
$dashconfForm->addVar('filterEnable', $this->data['isFilterEnable']);
// create form list
$dashconfFormList = new CFormList('dashconfFormList');
// append filter status to form list
if ($this->data['isFilterEnable']) {
$filterStatusSpan = new CSpan(_('Enabled'), 'green underline pointer');
$filterStatusSpan->setAttribute('onclick', "create_var('" . $dashconfForm->getName() . "', 'filterEnable', 0, true);");
} else {
$filterStatusSpan = new CSpan(_('Disabled'), 'red underline pointer');
$filterStatusSpan->setAttribute('onclick', "\$('dashform').enable(); create_var('" . $dashconfForm->getName() . "', 'filterEnable', 1, true);");
}
$dashconfFormList->addRow(_('Dashboard filter'), $filterStatusSpan);
// append host groups to form list
$hostGroupsComboBox = new CComboBox('grpswitch', $this->data['grpswitch'], 'submit();');
$hostGroupsComboBox->addItem(0, _('All'));
示例5: CWidget
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$scriptsWidget = new CWidget();
$createForm = new CForm('get');
$createForm->addItem(new CSubmit('form', _('Create script')));
$scriptsWidget->addPageHeader(_('CONFIGURATION OF SCRIPTS'), $createForm);
$scriptsWidget->addHeader(_('Scripts'));
$scriptsWidget->addHeaderRowNumber();
$scriptsForm = new CForm();
$scriptsForm->setName('scriptsForm');
$scriptsForm->setAttribute('id', 'scripts');
$scriptsTable = new CTableInfo(_('No scripts found.'));
$scriptsTable->setHeader(array(new CCheckBox('all_scripts', null, "checkAll('" . $scriptsForm->getName() . "', 'all_scripts', 'scripts');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Type'), _('Execute on'), make_sorting_header(_('Commands'), 'command', $this->data['sort'], $this->data['sortorder']), _('User group'), _('Host group'), _('Host access')));
foreach ($this->data['scripts'] as $script) {
switch ($script['type']) {
case ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT:
$scriptType = _('Script');
break;
case ZBX_SCRIPT_TYPE_IPMI:
$scriptType = _('IPMI');
break;
default:
$scriptType = '';
break;
}
if ($script['type'] == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT) {
示例6: CForm
$comboform = new CForm();
$comboform->addVar('dstfrm', $dstfrm);
// create table header +
$cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
$cmbGroups->addItem(0, S_ALL_S);
$sql = 'SELECT usrgrpid, name FROM usrgrp WHERE ' . DBin_node('usrgrpid') . ' ORDER BY name';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$cmbGroups->addItem($row['usrgrpid'], $row['name']);
}
$comboform->addItem($cmbGroups);
show_table_header(S_USERS, $comboform);
// -
// create user twinbox +
$form = new CForm('users.php');
$form->setAttribute('id', 'users');
$user_tb = new CTweenBox($form, 'usersid', null, 10);
$from = '';
$where = '';
if ($groupid > 0) {
$from = ', users_groups g ';
$where = ' AND u.userid=g.userid AND g.usrgrpid=' . $groupid;
}
$sql = 'SELECT u.userid, u.alias FROM users u ' . $from . ' WHERE ' . DBin_node('u.userid') . $where . ' ORDER BY name';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$user_tb->addItem($row['userid'], $row['alias'], false);
}
$form->addItem($user_tb->get('asdasda', 'asdasdasdas'));
// -
$button = new CButton('select', S_SELECT, 'add_users("' . $dstfrm . '")');
示例7: CComboBox
$frmTitle->addVar('dstfrm', $dstfrm);
$frmTitle->addVar('permission', $permission);
if (ZBX_DISTRIBUTED) {
$available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
$cmbResourceNode = new CComboBox('nodeid', $nodeid, 'submit();');
$cmbResourceNode->addItem(0, S_ALL_S);
$sql = 'SELECT name,nodeid ' . ' FROM nodes ' . ' WHERE ' . DBcondition('nodeid', $available_nodes);
$db_nodes = DBselect($sql);
while ($node = DBfetch($db_nodes)) {
$cmbResourceNode->addItem($node['nodeid'], $node['name']);
}
$frmTitle->addItem(array(S_NODE, SPACE, $cmbResourceNode));
}
show_table_header(permission2str($permission), $frmTitle);
$form = new CForm();
$form->setAttribute('id', 'groups');
$table = new CTableInfo(S_NO_RESOURCES_DEFINED);
$table->setHeader(new CCol(array(new CCheckBox('all_groups', NULL, 'check_all(this.checked)'), S_NAME)));
// NODES
if ($nodeid == 0) {
$nodeids = get_current_nodeid(true);
} else {
$nodeids = $nodeid;
}
$count = 0;
$grouplist = array();
$options = array('nodeids' => $nodeids, 'output' => API_OUTPUT_EXTEND);
$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) {
示例8: CButton
}
$table->addRow($name);
}
if ($multiselect) {
$button = new CButton('select', _('Select'), "javascript: addSelectedValues('slides', " . zbx_jsvalue($reference) . ');');
$table->setFooter(new CCol($button, 'right'));
insert_js('var popupReference = ' . zbx_jsvalue($slideshows, true) . ';');
}
zbx_add_post_js('chkbxRange.pageGoName = "slides";');
$form->addItem($table);
$form->show();
} elseif ($srctbl == 'screens') {
require_once dirname(__FILE__) . '/include/screens.inc.php';
$form = new CForm();
$form->setName('screenform');
$form->setAttribute('id', 'screens');
$table = new CTableInfo(_('No screens found.'));
if ($multiselect) {
$header = array(array(new CCheckBox('all_screens', null, "javascript: checkAll('" . $form->getName() . "', 'all_screens', 'screens');"), _('Name')));
} else {
$header = array(_('Name'));
}
$table->setHeader($header);
$screens = API::Screen()->get(array('nodeids' => $nodeId, 'output' => array('screenid', 'name'), 'preservekeys' => true, 'editable' => $writeonly === null ? null : true));
order_result($screens, 'name');
foreach ($screens as $screen) {
$name = new CSpan($screen['name'], 'link');
if ($multiselect) {
$js_action = 'javascript: addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($screen['screenid']) . ');';
} else {
$values = array($dstfld1 => $screen[$srcfld1], $dstfld2 => $screen[$srcfld2]);
示例9: make_hint_row
function make_hint_row($type, $instance)
{
$state = $instance['state'];
if ($type == "other" && $instance["stuck_state"] == 1) {
$state = "stuck";
}
$r = new CRow();
if (in_array($type, array("poweron", "poweroff", "suspend"))) {
$r->addItem(new CCheckBox("hostids[]", null, null, $instance['hostid']));
}
$hostScripts = API::Script()->getScriptsByHosts(zbx_objectValues(array($instance['host']), 'hostid'));
$hostSpan = new CSpan(nbsp($instance['name']), 'link_menu menu-host');
$hostSpan->setAttribute('data-menu', hostMenuData($instance['host'], $hostScripts[$instance['hostid']]));
$r->addItem($hostSpan);
$r->addItem(new CCol($state, get_item_level($state)));
$r->addItem($instance['cpu']);
$r->addItem($instance['memory']);
$r->addItem($instance['main_interface']);
if ($type == "other" && $instance["stuck_state"] == 1) {
$question = $instance['stuck_question'];
$json = new CJSON();
$choiceinfos = $json->decode($instance['stuck_choices'], true);
$answer_form = new CForm();
$answer_form->setAction('#');
$answer_form->setAttribute('id', "answer");
$answer_form->addVar("driver", "vsphere");
$answer_form->addVar("hostids[]", $instance['hostid']);
$instancename = $instance['host']['host'];
$answer_button = new CButton('answer', _('Answer'), "return checkAnswer('answer', 'choice', '{$instancename}', 'Execute');");
$choice_table = new CTableInfo();
foreach ($choiceinfos as $choice) {
$radio = new CRadioButton('choice', $choice['key']);
$label = new CLabel($choice['label']);
$choice_table->addRow(new CRow(array($radio, $label)));
}
$answer_form->addItem($choice_table);
$answer_form->addItem($answer_button);
$question_span = new CSpan($question);
$question_span->setHint($answer_form);
$question_col = new CCol($question_span, 'warning');
$r->addItem($question_col);
} else {
if ($type == "poweron") {
$ssh_link = new CLink(_('connect'), "gateone.php?hostid={$instance['hostid']}");
$ssh_link->setTarget("_blank");
$r->addItem($ssh_link);
}
}
return $r;
}
示例10: make_ipmistat_summary
function make_ipmistat_summary($preloading = false)
{
$form_name = 'ipmi_control';
$table = new CTableInfo();
$ipmicontrol_form = new CForm();
$ipmicontrol_form->setName('ipmi_control');
$ipmicontrol_form->setAttribute('id', 'ipmi_control');
$ipmicontrol_form->addVar('driver', 'ipmi');
$script_itemkey = 'push_message.py[{$HYCLOPS_SERVER},{$HYCLOPS_PORT},ipmi,{HOST.HOST}]';
$table->setHeader(array(is_show_all_nodes() ? S_NODE : null, new CCheckBox('all_physical_hosts', null, "checkAllHosts('" . $ipmicontrol_form->getName() . "', 'all_physical_hosts', '');"), _('Host name'), _('IPMI interface'), _('Status'), _('Problems')));
$hosts = get_ipmi_hosts();
if (empty($hosts)) {
return null;
}
foreach ($hosts as $host) {
$triggers = get_triggers($host['hostid']);
$trigger_count = count($triggers);
// get State
if (!$preloading) {
if (is_script_success($host['hostid'], $script_itemkey)) {
$state = strtolower(get_item_value($host['hostid'], "ipmi.state.text"));
} else {
$state = _('script failed');
}
} else {
$state = _('loading...');
}
// Check box
$checkbox_col = new CCheckBox("hostids[]", null, null, $host['hostid']);
if (!is_operation_available("ipmi", $state)) {
$checkbox_col->attributes['disabled'] = 'disabled';
}
// Host name
if ($trigger_count == 0) {
$hostname_col = new CCol(new CSpan($host['host']));
} else {
$hostname_col = new CLink(new CSpan($host['host']), 'tr_status.php?&hostid=' . $host['hostid'] . '&show_triggers=' . TRIGGERS_OPTION_ONLYTRUE);
}
// IPMI Interfaces
$ipmi_addresses = get_addresses($host['hostid'], INTERFACE_TYPE_IPMI);
$ipmi_ip_col = new CCol(reset($ipmi_addresses));
// Status
$state_col = new CCol($state, get_item_level($state));
// Problem
if ($trigger_count == 0) {
$problem_col = new CCol($trigger_count, 'normal');
} else {
$problem_col = new CCol($trigger_count, 'high');
$problem_col->setHint(make_trigger_table($triggers, $hostname_col));
}
$r = new CRow();
$r->addItem($checkbox_col);
$r->addItem($hostname_col);
$r->addItem($ipmi_ip_col);
$r->addItem($state_col);
$r->addItem($problem_col);
$table->addRow($r);
}
$table->setFooter(new CCol(make_operation_box_footer(zbx_objectValues($hosts, 'hostid'), $form_name)));
$ipmicontrol_form->addItem($table);
$script = new CJSScript(get_js("jQuery('#hat_ipmistat_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
return new CDiv(array($ipmicontrol_form, $script));
}
示例11: dirname
$page['title'] = _('Resource');
$page['file'] = 'popup_right.php';
define('ZBX_PAGE_NO_MENU', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'permission' => array(T_ZBX_INT, O_MAND, P_SYS, IN(PERM_DENY . ',' . PERM_READ . ',' . PERM_READ_WRITE), null));
check_fields($fields);
$dstfrm = getRequest('dstfrm', 0);
$permission = getRequest('permission', PERM_DENY);
/*
* Display
*/
show_table_header(permission2str($permission));
// host groups
$hostGroupForm = new CForm();
$hostGroupForm->setAttribute('id', 'groups');
$hostGroupTable = new CTableInfo(_('No host groups found.'));
$hostGroupTable->setHeader(new CCol(array(new CCheckBox('all_groups', null, 'checkAll(this.checked)'), _('Name'))));
$hostGroups = API::HostGroup()->get(array('output' => array('groupid', 'name')));
order_result($hostGroups, 'name');
foreach ($hostGroups as $hostGroup) {
$hostGroupCheckBox = new CCheckBox();
$hostGroupCheckBox->setAttribute('data-id', $hostGroup['groupid']);
$hostGroupCheckBox->setAttribute('data-name', $hostGroup['name']);
$hostGroupCheckBox->setAttribute('data-permission', $permission);
$hostGroupTable->addRow(new CCol(array($hostGroupCheckBox, $hostGroup['name'])));
}
$hostGroupTable->setFooter(new CCol(new CButton('select', _('Select'), 'addGroups("' . $dstfrm . '")'), 'right'));
$hostGroupForm->addItem($hostGroupTable);
$hostGroupForm->show();
?>
示例12: while
while ($row = DBfetch($result)) {
$name = new CLink($row["key_"], "#", "action");
if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') {
$action = get_window_opener($dstfrm, $dstfld1, $srcfld2) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);";
} else {
$action = get_window_opener($dstfrm, $dstfld1, html_entity_decode($row[$srcfld1])) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : '');
}
$name->SetAction($action . " close_window(); return false;");
$table->addRow(array($name, $row["description"]));
}
$table->Show();
} else {
if ($srctbl == 'triggers') {
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, $available_hosts, PERM_RES_IDS_ARRAY, $nodeid);
$form = new CForm();
$form->setAttribute('id', S_TRIGGERS);
$table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
if ($multiselect) {
insert_js_function('add_selected_values');
insert_js_function('check_all');
$header = array(new CCol(array(new CCheckBox("check", NULL, 'check_all("' . S_TRIGGERS . '", this.checked);'), S_NAME)), S_SEVERITY, S_STATUS);
$button = new CButton('select', S_SELECT, 'add_selected_values("' . S_TRIGGERS . '", "' . $dstfrm . '", "' . $dstfld1 . '", "' . $dstact . '")');
$button->setType('button');
$table->setFooter(new CCol($button, 'right'));
} else {
insert_js_function('add_value');
$header = array(S_NAME, S_SEVERITY, S_STATUS);
}
$table->SetHeader($header);
$sql = 'SELECT h.host,t.triggerid,t.description,t.expression,t.priority,t.status,count(d.triggerid_up) as dep_count ' . ' FROM hosts h,items i,functions f, triggers t' . ' LEFT JOIN trigger_depends d ON d.triggerid_down=t.triggerid ' . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND t.triggerid=f.triggerid' . ' AND ' . DBin_node('t.triggerid', $nodeid) . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status in (' . implode(',', $host_status) . ')';
if ($hostid > 0) {
示例13: get_item_filter_form
function get_item_filter_form(&$items)
{
$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_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname'];
$filter_snmp_oid = $_REQUEST['filter_snmp_oid'];
$filter_snmp_port = $_REQUEST['filter_snmp_port'];
$filter_value_type = $_REQUEST['filter_value_type'];
$filter_data_type = $_REQUEST['filter_data_type'];
$filter_delay = $_REQUEST['filter_delay'];
$filter_history = $_REQUEST['filter_history'];
$filter_trends = $_REQUEST['filter_trends'];
$filter_status = $_REQUEST['filter_status'];
$filter_templated_items = $_REQUEST['filter_templated_items'];
$filter_with_triggers = $_REQUEST['filter_with_triggers'];
// subfilter
$subfilter_hosts = $_REQUEST['subfilter_hosts'];
$subfilter_apps = $_REQUEST['subfilter_apps'];
$subfilter_types = $_REQUEST['subfilter_types'];
$subfilter_value_types = $_REQUEST['subfilter_value_types'];
$subfilter_status = $_REQUEST['subfilter_status'];
$subfilter_templated_items = $_REQUEST['subfilter_templated_items'];
$subfilter_with_triggers = $_REQUEST['subfilter_with_triggers'];
$subfilter_history = $_REQUEST['subfilter_history'];
$subfilter_trends = $_REQUEST['subfilter_trends'];
$subfilter_interval = $_REQUEST['subfilter_interval'];
$form = new CForm();
$form->setAttribute('name', 'zbx_filter');
$form->setAttribute('id', 'zbx_filter');
$form->setMethod('get');
$form->addVar('filter_hostid', get_request('filter_hostid', get_request('hostid')));
$form->addVar('subfilter_hosts', $subfilter_hosts);
$form->addVar('subfilter_apps', $subfilter_apps);
$form->addVar('subfilter_types', $subfilter_types);
$form->addVar('subfilter_value_types', $subfilter_value_types);
$form->addVar('subfilter_status', $subfilter_status);
$form->addVar('subfilter_templated_items', $subfilter_templated_items);
$form->addVar('subfilter_with_triggers', $subfilter_with_triggers);
$form->addVar('subfilter_history', $subfilter_history);
$form->addVar('subfilter_trends', $subfilter_trends);
$form->addVar('subfilter_interval', $subfilter_interval);
// FORM FOR FILTER DISPLAY {
$table = new CTable('', 'itemfilter');
$table->setCellPadding(0);
$table->setCellSpacing(0);
// 1st col
$col_table1 = new CTable();
$col_table1->setClass('filter');
$col_table1->addRow(array(bold(S_HOST_GROUP . ': '), array(new CTextBox('filter_group', $filter_group, 20), new CButton('btn_group', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->getName() . '&dstfld1=filter_group&srctbl=host_group&srcfld1=name",450,450);', 'G'))));
$col_table1->addRow(array(bold(S_HOST . ': '), array(new CTextBox('filter_host', $filter_host, 20), new CButton('btn_host', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->getName() . '&dstfld1=filter_host&srctbl=hosts_and_templates&srcfld1=host",450,450);', 'H'))));
$col_table1->addRow(array(bold(S_APPLICATION . ': '), array(new CTextBox('filter_application', $filter_application, 20), new CButton('btn_app', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->getName() . '&dstfld1=filter_application&srctbl=applications&srcfld1=name",400,300,"application");', 'A'))));
$col_table1->addRow(array(array(bold(S_DESCRIPTION), SPACE . S_LIKE_SMALL . ': '), new CTextBox("filter_description", $filter_description, 30)));
$col_table1->addRow(array(array(bold(S_KEY), SPACE . S_LIKE_SMALL . ': '), new CTextBox("filter_key", $filter_key, 30)));
// 2nd col
$col_table2 = new CTable();
$col_table2->setClass('filter');
$fTypeVisibility = array();
//first row
$cmbType = new CComboBox("filter_type", $filter_type);
//"javascript: create_var('zbx_filter', 'filter_set', '1', true); ");
$cmbType->setAttribute('id', 'filter_type');
$cmbType->addItem(-1, S_ALL_SMALL);
foreach (array('filter_delay_label', 'filter_delay') as $vItem) {
zbx_subarray_push($fTypeVisibility, -1, $vItem);
}
$itemTypes = item_type2str();
// httptest items are only for internal zabbix logic
unset($itemTypes[ITEM_TYPE_HTTPTEST]);
$cmbType->addItems($itemTypes);
foreach ($itemTypes as $typeNum => $typeLabel) {
if ($typeNum != ITEM_TYPE_TRAPPER) {
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label');
zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay');
}
switch ($typeNum) {
case ITEM_TYPE_SNMPV1:
case ITEM_TYPE_SNMPV2C:
$snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_snmp_port_label', 'filter_snmp_port');
foreach ($snmp_types as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
case ITEM_TYPE_SNMPV3:
foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_snmp_port_label', 'filter_snmp_port') as $vItem) {
zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
}
break;
}
}
zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ");");
$col21 = new CCol(bold(S_TYPE . ': '));
$col21->setAttribute('style', 'width: 170px');
$col_table2->addRow(array($col21, $cmbType));
//second row
$label221 = new CSpan(bold(S_UPDATE_INTERVAL_IN_SEC . ': '));
//.........这里部分代码省略.........
示例14: array
if (isset($row['servicedownid'])) {
$services[$row['serviceid']]['childs'][] = array('id' => $row['servicedownid'], 'soft' => 1, 'linkid' => $row['linkid']);
}
}
$treeServ = array();
createShowServiceTree($services, $treeServ);
//return into $treeServ parametr
//permission issue
$treeServ = del_empty_nodes($treeServ);
$tree = new CTree('service_status_tree', $treeServ, array('caption' => bold(S_SERVICE), 'status' => bold(S_STATUS), 'reason' => bold(S_REASON), 'sla' => bold('SLA (' . $periods[$period_start] . ')'), 'sla2' => bold(nbsp(S_SLA)), 'graph' => bold(S_GRAPH)));
if ($tree) {
// creates form for choosing a preset interval
$r_form = new CForm();
$r_form->setClass('nowrap');
$r_form->setMethod('get');
$r_form->setAttribute('name', 'period_choice');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$period_combo = new CComboBox('period_start', $period_start, 'javascript: submit();');
foreach ($periods as $key => $val) {
$period_combo->AddItem($key, $val);
}
$r_form->AddItem(array(S_PERIOD, $period_combo));
$url = '?period_start=' . $period_start . '&fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->setAttribute('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
$srv_wdgt = new CWidget('hat_services', $tree->getHTML());
$srv_wdgt->addHeader(S_IT_SERVICES_BIG, array($r_form, $fs_icon));
$srv_wdgt->show();
} else {
error('Can not format Tree. Check logik structure in service links');
示例15: array
$slaData = API::Service()->getSla(array('intervals' => array(array('from' => $period_start, 'to' => $period_end))));
// expand problem trigger descriptions
foreach ($slaData as &$serviceSla) {
foreach ($serviceSla['problems'] as &$problemTrigger) {
$problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description'];
}
unset($problemTrigger);
}
unset($serviceSla);
$treeData = array();
createServiceMonitoringTree($services, $slaData, $period, $treeData);
$tree = new CServiceTree('service_status_tree', $treeData, array('caption' => _('Service'), 'status' => _('Status'), 'reason' => _('Reason'), 'sla' => _('Problem time'), 'sla2' => nbsp(_('SLA') . ' / ' . _('Acceptable SLA'))));
if ($tree) {
// creates form for choosing a preset interval
$r_form = new CForm();
$r_form->setAttribute('class', 'nowrap');
$r_form->setMethod('get');
$r_form->setAttribute('name', 'period_choice');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$period_combo = new CComboBox('period', $period, 'javascript: submit();');
foreach ($periods as $key => $val) {
$period_combo->addItem($key, $val);
}
$r_form->addItem(array(_('Period') . SPACE, $period_combo));
$srv_wdgt = new CWidget('hat_services', 'service-list service-mon');
$srv_wdgt->addPageHeader(_('IT SERVICES'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$srv_wdgt->addHeader(_('IT services'), $r_form);
$srv_wdgt->addItem(BR());
$srv_wdgt->addItem($tree->getHTML());
$srv_wdgt->show();
} else {