本文整理汇总了PHP中CDiv::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CDiv::setAttribute方法的具体用法?PHP CDiv::setAttribute怎么用?PHP CDiv::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDiv
的用法示例。
在下文中一共展示了CDiv::setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
/**
* Display the widget in expanded or collapsed state.
*/
public function build()
{
$body = new CDiv($this->body, 'body');
$body->setAttribute('id', $this->id);
if (!$this->open) {
$body->setAttribute('style', 'display: none;');
if ($this->footer) {
$this->footer->setAttribute('style', 'display: none;');
}
}
$this->cleanItems();
$this->addItem($this->header);
$this->addItem($body);
$this->addItem($this->footer);
}
示例2: toString
public function toString($destroy = true)
{
if (count($this->tabs) == 1) {
$this->setAttribute('class', 'min-width ui-tabs ui-widget ui-widget-content ui-corner-all widget');
$header = reset($this->headers);
$header = new CDiv($header);
$header->addClass('ui-corner-all ui-widget-header header');
$header->setAttribute('id', 'tab_' . key($this->headers));
$this->addItem($header);
$tab = reset($this->tabs);
$tab->addClass('ui-tabs ui-tabs-panel ui-widget ui-widget-content ui-corner-all widget');
$this->addItem($tab);
} else {
$headersList = new CList();
foreach ($this->headers as $id => $header) {
$tabLink = new CLink($header, '#' . $id, null, null, false);
$tabLink->setAttribute('id', 'tab_' . $id);
$headersList->addItem($tabLink);
}
$this->addItem($headersList);
$this->addItem($this->tabs);
$options = array();
if (!is_null($this->selectedTab)) {
$options['selected'] = $this->selectedTab;
}
if ($this->rememberTab) {
$options['cookie'] = array();
}
zbx_add_post_js('jQuery("#' . $this->id . '").tabs(' . zbx_jsvalue($options, true) . ').show();');
}
return parent::toString($destroy);
}
示例3: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$error = null;
$timeOffset = null;
$timeZone = null;
switch ($this->screenitem['style']) {
case TIME_TYPE_HOST:
$items = API::Item()->get(array('itemids' => $this->screenitem['resourceid'], 'selectHosts' => array('host'), 'output' => array('itemid', 'value_type')));
$item = reset($items);
$host = reset($item['hosts']);
$lastValue = Manager::History()->getLast(array($item));
if ($lastValue) {
$lastValue = reset($lastValue[$item['itemid']]);
$item['lastvalue'] = $lastValue['value'];
$item['lastclock'] = $lastValue['clock'];
} else {
$item['lastvalue'] = '0';
$item['lastclock'] = '0';
}
$timeType = $host['host'];
preg_match('/([+-]{1})([\\d]{1,2}):([\\d]{1,2})/', $item['lastvalue'], $arr);
if (!empty($arr)) {
$timeZone = $arr[2] * SEC_PER_HOUR + $arr[3] * SEC_PER_MIN;
if ($arr[1] == '-') {
$timeZone = 0 - $timeZone;
}
}
if ($lastvalue = strtotime($item['lastvalue'])) {
$diff = time() - $item['lastclock'];
$timeOffset = $lastvalue + $diff;
} else {
$error = _('NO DATA');
}
break;
case TIME_TYPE_SERVER:
$error = null;
$timeType = _('SERVER');
$timeOffset = time();
$timeZone = date('Z');
break;
default:
$error = null;
$timeType = _('LOCAL');
$timeOffset = null;
$timeZone = null;
break;
}
if ($this->screenitem['width'] > $this->screenitem['height']) {
$this->screenitem['width'] = $this->screenitem['height'];
}
$item = new CFlashClock($this->screenitem['width'], $this->screenitem['height'], $this->action);
$item->setTimeError($error);
$item->setTimeType($timeType);
$item->setTimeZone($timeZone);
$item->setTimeOffset($timeOffset);
$flashclockOverDiv = new CDiv(null, 'flashclock');
$flashclockOverDiv->setAttribute('style', 'width: ' . $this->screenitem['width'] . 'px; height: ' . $this->screenitem['height'] . 'px;');
return $this->getOutput(array($item, $flashclockOverDiv));
}
示例4: toString
public function toString($destroy = true)
{
if (count($this->tabs) == 1) {
$this->setAttribute('class', 'min-width ui-tabs ui-widget ui-widget-content ui-corner-all widget');
$header = reset($this->headers);
$header = new CDiv($header);
$header->addClass('ui-corner-all ui-widget-header header');
$header->setAttribute('id', 'tab_' . key($this->headers));
$this->addItem($header);
$tab = reset($this->tabs);
$tab->addClass('ui-tabs ui-tabs-panel ui-widget ui-widget-content ui-corner-all widget');
$this->addItem($tab);
} else {
$headersList = new CList();
foreach ($this->headers as $id => $header) {
$tabLink = new CLink($header, '#' . $id, null, null, false);
$tabLink->setAttribute('id', 'tab_' . $id);
$headersList->addItem($tabLink);
}
$this->addItem($headersList);
$this->addItem($this->tabs);
if ($this->selectedTab === null) {
$activeTab = get_cookie('tab', 0);
$createEvent = '';
} else {
$activeTab = $this->selectedTab;
$createEvent = 'create: function() { jQuery.cookie("tab", ' . $this->selectedTab . '); },';
}
$disabledTabs = $this->disabledTabs === null ? '' : 'disabled: ' . CJs::encodeJson($this->disabledTabs) . ',';
zbx_add_post_js('
jQuery("#' . $this->id . '").tabs({
' . $createEvent . '
' . $disabledTabs . '
active: ' . $activeTab . ',
activate: function(event, ui) {
jQuery.cookie("tab", ui.newTab.index().toString());
}
})
.css("visibility", "visible");');
}
return parent::toString($destroy);
}
示例5: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$image = new CImg('map.php?noedit=1&sysmapid=' . $this->screenitem['resourceid'] . '&width=' . $this->screenitem['width'] . '&height=' . $this->screenitem['height'] . '&curtime=' . time());
$image->setAttribute('id', 'map_' . $this->screenitem['screenitemid']);
if ($this->mode == SCREEN_MODE_PREVIEW) {
$sysmap = API::Map()->get(array('sysmapids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'selectSelements' => API_OUTPUT_EXTEND, 'selectLinks' => API_OUTPUT_EXTEND, 'expandUrls' => true, 'nopermissions' => true, 'preservekeys' => true));
$sysmap = reset($sysmap);
$actionMap = getActionMapBySysmap($sysmap);
$image->setMap($actionMap->getName());
$output = array($actionMap, $image);
} elseif ($this->mode == SCREEN_MODE_EDIT) {
$output = array($image, BR(), new CLink(_('Change'), $this->action));
} else {
$output = array($image);
}
$this->insertFlickerfreeJs();
$div = new CDiv($output, 'map-container flickerfreescreen', $this->getScreenId());
$div->setAttribute('data-timestamp', $this->timestamp);
$div->addStyle('position: relative;');
return $div;
}
示例6: foreach
$dependenciesTable->setHeader(array(_('Name'), _('Action')));
foreach ($this->data['dependencies'] as $dependency) {
$triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']);
$hostNames = array();
foreach ($dependency['hosts'] as $host) {
$hostNames[] = CHtml::encode($host['name']);
$hostNames[] = ', ';
}
array_pop($hostNames);
if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$description = new CLink(array($hostNames, NAME_DELIMITER, CHtml::encode($dependency['description'])), 'triggers.php?form=update&hostid=' . $dependency['hostid'] . '&triggerid=' . $dependency['triggerid']);
$description->setAttribute('target', '_blank');
} else {
$description = array($hostNames, NAME_DELIMITER, $dependency['description']);
}
$row = new CRow(array($description, new CButton('remove', _('Remove'), 'javascript: removeDependency(\'' . $dependency['triggerid'] . '\');', 'link_menu')));
$row->setAttribute('id', 'dependency_' . $dependency['triggerid']);
$dependenciesTable->addRow($row);
}
$dependenciesDiv = new CDiv(array($dependenciesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?' . 'dstfrm=massupdate' . '&dstact=add_dependency' . '&reference=deptrigger' . '&dstfld1=new_dependency' . '&srctbl=triggers' . '&objname=triggers' . '&srcfld1=triggerid' . '&multiselect=1' . '&with_triggers=1", 1000, 700);', 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all');
$dependenciesDiv->setAttribute('id', 'dependencies_div');
$triggersFormList->addRow(array(_('Replace dependencies'), SPACE, new CVisibilityBox('visible[dependencies]', isset($this->data['visible']['dependencies']), 'dependencies_div', _('Original'))), $dependenciesDiv);
}
// append tabs to form
$triggersTab = new CTabView();
$triggersTab->addTab('triggersTab', _('Mass update'), $triggersFormList);
$triggersForm->addItem($triggersTab);
// append buttons to form
$triggersForm->addItem(makeFormFooter(new CSubmit('massupdate', _('Update')), new CButtonCancel(url_params(array('groupid', 'hostid', 'parent_discoveryid')))));
$triggersWidget->addItem($triggersForm);
return $triggersWidget;
示例7: array
$this->data['new_operation']['opcommand_hst'][$ohnum]['name'] = $cmd['hostid'] > 0 ? $hosts[$cmd['hostid']]['name'] : '';
}
order_result($this->data['new_operation']['opcommand_hst'], 'name');
$groups = API::HostGroup()->get(array('groupids' => zbx_objectValues($this->data['new_operation']['opcommand_grp'], 'groupid'), 'output' => array('groupid', 'name'), 'preservekeys' => true, 'editable' => true));
$this->data['new_operation']['opcommand_grp'] = array_values($this->data['new_operation']['opcommand_grp']);
foreach ($this->data['new_operation']['opcommand_grp'] as $ognum => $cmd) {
$this->data['new_operation']['opcommand_grp'][$ognum]['name'] = $groups[$cmd['groupid']]['name'];
}
order_result($this->data['new_operation']['opcommand_grp'], 'name');
// js add commands
$jsInsert = 'addPopupValues(' . zbx_jsvalue(array('object' => 'hostid', 'values' => $this->data['new_operation']['opcommand_hst'])) . ');';
$jsInsert .= 'addPopupValues(' . zbx_jsvalue(array('object' => 'groupid', 'values' => $this->data['new_operation']['opcommand_grp'])) . ');';
zbx_add_post_js($jsInsert);
// target list
$cmdList = new CDiv($cmdList, 'objectgroup border_dotted ui-corner-all inlineblock');
$cmdList->setAttribute('id', 'opCmdList');
$newOperationsTable->addRow(array(_('Target list'), $cmdList), 'indent_top');
// type
$typeComboBox = new CComboBox('new_operation[opcommand][type]', $this->data['new_operation']['opcommand']['type'], 'javascript: showOpTypeForm();');
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_IPMI, _('IPMI'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT, _('Custom script'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_SSH, _('SSH'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_TELNET, _('Telnet'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT, _('Global script'));
$userScriptId = new CVar('new_operation[opcommand][scriptid]', $this->data['new_operation']['opcommand']['scriptid']);
$userScriptName = new CTextBox('new_operation[opcommand][script]', $this->data['new_operation']['opcommand']['script'], 32, true);
$userScriptSelect = new CButton('select_opcommand_script', _('Select'), null, 'link_menu');
$userScript = new CDiv(array($userScriptId, $userScriptName, SPACE, $userScriptSelect), 'class_opcommand_userscript inlineblock hidden');
$newOperationsTable->addRow(array(_('Type'), array($typeComboBox, SPACE, $userScript)), 'indent_bottom');
// script
$executeOnRadioButton = new CRadioButtonList('new_operation[opcommand][execute_on]', $this->data['new_operation']['opcommand']['execute_on']);
示例8: CRow
}
$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 {
if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
$options['object'] = EVENT_OBJECT_TRIGGER;
$options['triggerids'] = $_REQUEST['triggerid'];
}
}
$firstEvent = CEvent::get($options);
// }}} CHECK IF EVENTS EXISTS
示例9: show
/**
* Process screen with particular screen objects.
*
* @return CTable
*/
public function show()
{
if (empty($this->screen)) {
return new CTableInfo(_('No screens defined.'));
}
$skipedFields = array();
$screenitems = array();
$emptyScreenColumns = array();
// calculate table columns and rows
foreach ($this->screen['screenitems'] as $screenitem) {
$screenitems[] = $screenitem;
for ($i = 0; $i < $screenitem['rowspan'] || $i == 0; $i++) {
for ($j = 0; $j < $screenitem['colspan'] || $j == 0; $j++) {
if ($i != 0 || $j != 0) {
if (!isset($skipedFields[$screenitem['y'] + $i])) {
$skipedFields[$screenitem['y'] + $i] = array();
}
$skipedFields[$screenitem['y'] + $i][$screenitem['x'] + $j] = 1;
}
}
}
}
// create screen table
$screenTable = new CTable();
$screenTable->setAttribute('class', in_array($this->mode, array(SCREEN_MODE_PREVIEW, SCREEN_MODE_SLIDESHOW)) ? 'screen_view' : 'screen_edit');
$screenTable->setAttribute('id', 'iframe');
// action top row
if ($this->mode == SCREEN_MODE_EDIT) {
$newColumns = array(new CCol(new CImg('images/general/zero.png', 'zero', 1, 1)));
for ($i = 0, $size = $this->screen['hsize'] + 1; $i < $size; $i++) {
$icon = new CImg('images/general/plus.png', null, null, null, 'pointer');
$icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_col=' . $i . '";');
array_push($newColumns, new CCol($icon));
}
$screenTable->addRow($newColumns);
}
for ($r = 0; $r < $this->screen['vsize']; $r++) {
$newColumns = array();
$emptyScreenRow = true;
// action left cell
if ($this->mode == SCREEN_MODE_EDIT) {
$icon = new CImg('images/general/plus.png', null, null, null, 'pointer');
$icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_row=' . $r . '";');
array_push($newColumns, new CCol($icon));
}
for ($c = 0; $c < $this->screen['hsize']; $c++) {
if (isset($skipedFields[$r][$c])) {
continue;
}
// screen item
$isEditForm = false;
$screenitem = array();
foreach ($screenitems as $tmprow) {
if ($tmprow['x'] == $c && $tmprow['y'] == $r) {
$screenitem = $tmprow;
break;
}
}
if (empty($screenitem)) {
$screenitem = array('screenitemid' => 0, 'resourcetype' => 0, 'resourceid' => 0, 'width' => 0, 'height' => 0, 'colspan' => 1, 'rowspan' => 1, 'elements' => 0, 'valign' => VALIGN_DEFAULT, 'halign' => HALIGN_DEFAULT, 'style' => 0, 'url' => '', 'dynamic' => 0, 'sort_triggers' => SCREEN_SORT_TRIGGERS_DATE_DESC);
}
if (!empty($screenitem['screenitemid'])) {
$emptyScreenRow = false;
$emptyScreenColumns[$c] = 1;
}
// action
if ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] != 0) {
$action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid'];
} elseif ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] == 0) {
$action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r;
} else {
$action = null;
}
// edit form cell
if ($this->mode == SCREEN_MODE_EDIT && (isset($_REQUEST['form']) && $_REQUEST['form'] == 'update') && (isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r || isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitem['screenitemid']) == 0)) {
$screenView = new CView('configuration.screen.constructor.edit', array('screen' => $this->screen));
$item = $screenView->render();
$isEditForm = true;
} elseif (!empty($screenitem['screenitemid']) && isset($screenitem['resourcetype'])) {
$screenBase = CScreenBuilder::getScreen(array('isFlickerfree' => $this->isFlickerfree, 'pageFile' => $this->pageFile, 'mode' => $this->mode, 'timestamp' => $this->timestamp, 'hostid' => $this->hostid, 'profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'timeline' => $this->timeline, 'resourcetype' => $screenitem['resourcetype'], 'screenitem' => $screenitem));
if (!empty($screenBase)) {
if ($this->mode == SCREEN_MODE_EDIT && !empty($screenitem['screenitemid'])) {
$screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid'];
} elseif ($this->mode == SCREEN_MODE_EDIT && empty($screenitem['screenitemid'])) {
$screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r;
}
$item = $screenBase->get();
} else {
$item = null;
}
} else {
$item = array(SPACE);
if ($this->mode == SCREEN_MODE_EDIT) {
array_push($item, BR(), new CLink(_('Change'), $action, 'empty_change_link'));
}
//.........这里部分代码省略.........
示例10: CDiv
array_pop($sub_menu_row);
$sub_menu_div = new CDiv($sub_menu_row);
$sub_menu_div->setAttribute('id', 'sub_' . $label);
$sub_menu_div->addAction('onmouseover', 'javascript: MMenu.submenu_mouseOver();');
$sub_menu_div->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
if (isset($page['menu']) && $page['menu'] == $label) {
$menu_selected = true;
$sub_menu_div->setAttribute('style', 'display: block;');
insert_js('MMenu.def_label = ' . zbx_jsvalue($label));
} else {
$sub_menu_div->setAttribute('style', 'display: none;');
}
$menu_divs[] = $sub_menu_div;
}
$sub_menu_div = new CDiv(SPACE);
$sub_menu_div->setAttribute('id', 'sub_empty');
$sub_menu_div->setAttribute('style', 'display: ' . ($menu_selected ? 'none;' : 'block;'));
$menu_divs[] = $sub_menu_div;
$search_div = null;
if ($page['file'] != 'index.php' && CWebUser::$data['userid'] > 0) {
$searchForm = new CView('general.search');
$search_div = $searchForm->render();
}
$sub_menu_table->addRow(array($menu_divs, $search_div));
$page_menu->addItem($sub_menu_table);
$page_menu->show();
}
// create history
if (isset($page['hist_arg']) && CWebUser::$data['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
$table = new CTable(null, 'history left');
$table->addRow(new CRow(array(new CCol(_('History') . ':', 'caption'), get_user_history())));
示例11: CComboBox
$cmbHosts = new CComboBox('hostid', $PAGE_HOSTS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$url = 'tr_status.php' . ($_REQUEST['fullscreen'] ? '' : '?fullscreen=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 . "';"));
$mute_icon = new CDiv(SPACE, $mute ? 'iconmute' : 'iconsound');
$mute_icon->setAttribute('title', S_SOUND . ' ' . S_ON . '/' . S_OFF);
$mute_icon->addAction('onclick', new CScript("javascript: switch_mute(this);"));
$tr_numrows = new CSpan(null, 'info');
$tr_numrows->setAttribute('name', 'tr_numrows');
$tr_info = array(S_TRIGGERS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $tr_numrows, SPACE . SPACE . SPACE . S_UPDATED . ': ', new CSpan(date(S_DATE_FORMAT_YMDHMS), 'info'));
$trigg_wdgt->addHeader(S_STATUS_OF_TRIGGERS_BIG, array($mute_icon, $fs_icon));
$trigg_wdgt->addHeader($tr_info, $r_form);
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
//,'tr_status.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->setMethod('post');
$filterForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$filterForm->addVar('groupid', $_REQUEST['groupid']);
示例12: CIcon
$addLinkIcon = new CIcon(_('Add link'), 'iconplus');
$addLinkIcon->setAttribute('id', 'linkAdd');
$removeLinkIcon = new CIcon(_('Remove link'), 'iconminus');
$removeLinkIcon->setAttribute('id', 'linkRemove');
$expandMacros = new CSpan($this->data['sysmap']['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink');
$expandMacros->setAttribute('id', 'expand_macros');
$gridShow = new CSpan($this->data['sysmap']['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink');
$gridShow->setAttribute('id', 'gridshow');
$gridAutoAlign = new CSpan($this->data['sysmap']['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$gridSize = new CComboBox('gridsize', $this->data['sysmap']['grid_size']);
$gridSize->addItems(array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100'));
$gridAlignAll = new CSubmit('gridalignall', _('Align icons'));
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('update', _('Update'));
$saveButton->setAttribute('id', 'sysmap_update');
$menuTable = new CTable(null, 'textwhite');
$menuTable->addRow(array(_s('Map "%s"', $this->data['sysmap']['name']), SPACE . SPACE, _('Icon'), SPACE, $addIcon, SPACE, $removeIcon, SPACE . SPACE, _('Link'), SPACE, $addLinkIcon, SPACE, $removeLinkIcon, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton));
$sysmapWidget->addPageHeader($menuTable);
// create map
$backgroundImage = new CImg('images/general/tree/zero.gif', 'Sysmap');
$backgroundImage->setAttribute('id', 'sysmap_img', $this->data['sysmap']['width'], $this->data['sysmap']['height']);
$backgroundImageTable = new CTable();
$backgroundImageTable->addRow($backgroundImage);
$sysmapWidget->addItem($backgroundImageTable);
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$sysmapWidget->addItem($container);
// create elements
示例13: CVisibilityBox
$statusComboBox->addItem(HOST_STATUS_MONITORED, _('Monitored'));
$statusComboBox->addItem(HOST_STATUS_NOT_MONITORED, _('Not monitored'));
$hostFormList->addRow(array(_('Status'), SPACE, new CVisibilityBox('visible[status]', isset($this->data['visible']['status']), 'status', _('Original'))), $statusComboBox);
// append templates table to from list
$templatesTable = new CTable(_('No templates defined.'), 'formElementTable');
$templatesTable->setAttribute('style', 'min-width: 500px;');
$templatesTable->setAttribute('id', 'template_table');
$templatesTable->setHeader(array(_('Name'), _('Action')));
foreach ($this->data['templates'] as $templateid => $templateName) {
$hostForm->addVar('templates[' . $templateid . ']', $templateName);
$row = new CRow(array($templateName, new CButton('remove', _('Remove'), 'javascript: removeTemplate("' . $templateid . '");', 'link_menu')));
$row->setAttribute('id', 'template_row_' . $templateid);
$templatesTable->addRow($row);
}
$templatesDiv = new CDiv(array($templatesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?srctbl=templates&srcfld1=hostid&srcfld2=host' . '&dstfrm=' . $hostForm->getName() . '&dstfld1=new_template&templated_hosts=1' . url_param($this->data['templates'], false, 'existed_templates') . '", 450, 450)', 'link_menu'), BR(), BR(), new CCheckBox('mass_replace_tpls', $this->data['mass_replace_tpls']), SPACE, _('Replace'), BR(), new CCheckBox('mass_clear_tpls', $this->data['mass_clear_tpls']), SPACE, _('Clear when unlinking')), 'objectgroup inlineblock border_dotted ui-corner-all');
$templatesDiv->setAttribute('id', 'templates_div');
$hostFormList->addRow(array(_('Link templates'), SPACE, new CVisibilityBox('visible[template_table]', !empty($this->data['visible']['template_table']) ? 'yes' : 'no', 'templates_div', _('Original'))), $templatesDiv);
// append ipmi to form list
$ipmiAuthtypeComboBox = new CComboBox('ipmi_authtype', $this->data['ipmi_authtype']);
$ipmiAuthtypeComboBox->addItems(ipmiAuthTypes());
$hostFormList->addRow(array(_('IPMI authentication algorithm'), SPACE, new CVisibilityBox('visible[ipmi_authtype]', isset($this->data['visible']['ipmi_authtype']), 'ipmi_authtype', _('Original'))), $ipmiAuthtypeComboBox);
$ipmiPrivilegeComboBox = new CComboBox('ipmi_privilege', $this->data['ipmi_privilege']);
$ipmiPrivilegeComboBox->addItems(ipmiPrivileges());
$hostFormList->addRow(array(_('IPMI privilege level'), SPACE, new CVisibilityBox('visible[ipmi_privilege]', isset($this->data['visible']['ipmi_privilege']), 'ipmi_privilege', _('Original'))), $ipmiPrivilegeComboBox);
$hostFormList->addRow(array(_('IPMI username'), SPACE, new CVisibilityBox('visible[ipmi_username]', isset($this->data['visible']['ipmi_username']), 'ipmi_username', _('Original'))), new CTextBox('ipmi_username', $this->data['ipmi_username'], ZBX_TEXTBOX_SMALL_SIZE));
$hostFormList->addRow(array(_('IPMI password'), SPACE, new CVisibilityBox('visible[ipmi_password]', isset($this->data['visible']['ipmi_password']), 'ipmi_password', _('Original'))), new CTextBox('ipmi_password', $this->data['ipmi_password'], ZBX_TEXTBOX_SMALL_SIZE));
// append inventories to form list
$inventoryModesComboBox = new CComboBox('inventory_mode', $this->data['inventory_mode'], 'submit()');
$inventoryModesComboBox->addItem(HOST_INVENTORY_DISABLED, _('Disabled'));
$inventoryModesComboBox->addItem(HOST_INVENTORY_MANUAL, _('Manual'));
$inventoryModesComboBox->addItem(HOST_INVENTORY_AUTOMATIC, _('Automatic'));
示例14: CCol
$col = new CCol(SPACE, 'unknown_trigger');
$col->setAttribute('style', 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; background-repeat: repeate;');
$help_table->addRow(array($col, S_5_MIN));
$col = new CCol(SPACE, 'unknown_trigger');
$col->setAttribute('style', 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; background-repeat: repeate;');
$help_table->addRow(array($col, S_15_MIN));
$help_table->addRow(array(new CCol(SPACE), S_NO_TRIGGER));
} else {
$help_table->addRow(array(new CCol(SPACE), S_DISABLED . ' ' . S_OR . ' ' . S_NO_TRIGGER));
}
$help->setHint($help_table);
$over_wdgt = new CWidget();
// Header
$url = 'overview.php?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 . "';"));
$over_wdgt->addHeader(S_OVERVIEW_BIG, array($fs_icon, $help));
// 2nd heder
$form_l = new CForm();
$form_l->setMethod('get');
$form_l->addVar('groupid', $_REQUEST['groupid']);
$cmbStyle = new CComboBox('view_style', $_REQUEST['view_style'], 'submit()');
$cmbStyle->addItem(STYLE_TOP, S_TOP);
$cmbStyle->addItem(STYLE_LEFT, S_LEFT);
$form_l->additem(array(S_HOSTS_LOCATION . SPACE, $cmbStyle));
$over_wdgt->addHeader($form_l, $form);
// show_table_header(S_OVERVIEW_BIG,$form);
//-------------
if ($_REQUEST['type'] == SHOW_DATA) {
COpt::profiling_start('get_items_data_overview');
示例15: CDiv
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('save', _('Save'));
$saveButton->setAttribute('id', 'sysmap_save');
$menuRow = array(_s('Map "%s"', $sysmap['name']), SPACE . SPACE, _('Icon'), SPACE, $el_add, SPACE, $el_rmv, SPACE . SPACE, _('Link'), SPACE, $cn_add, SPACE, $cn_rmv, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton);
$elcn_tab = new CTable(null, 'textwhite');
$elcn_tab->addRow($menuRow);
show_table_header($elcn_tab);
$sysmap_img = new CImg('images/general/tree/zero.gif', 'Sysmap');
$sysmap_img->setAttribute('id', 'sysmap_img', $sysmap['width'], $sysmap['height']);
$table = new CTable();
$table->addRow($sysmap_img);
$table->Show();
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$container->Show();
insert_show_color_picker_javascript();
add_elementNames($sysmap['selements']);
foreach ($sysmap['links'] as &$link) {
foreach ($link['linktriggers'] as $lnum => $linktrigger) {
$dbTrigger = API::Trigger()->get(array('triggerids' => $linktrigger['triggerid'], 'output' => array('description', 'expression'), 'selectHosts' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'expandDescription' => true));
$dbTrigger = reset($dbTrigger);
$host = reset($dbTrigger['hosts']);
$link['linktriggers'][$lnum]['desc_exp'] = $host['name'] . ':' . $dbTrigger['description'];
}
order_result($link['linktriggers'], 'desc_exp');
}
unset($link);
if ($sysmap['iconmapid']) {
$iconMaps = API::IconMap()->get(array('iconmapids' => $sysmap['iconmapid'], 'output' => array('default_iconid'), 'preservekeys' => true));