本文整理汇总了PHP中CLink::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CLink::setAttribute方法的具体用法?PHP CLink::setAttribute怎么用?PHP CLink::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLink
的用法示例。
在下文中一共展示了CLink::setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: get
/**
* Process screen.
*
* @return CDiv (screen inside container)
*/
public function get()
{
$this->dataId = 'graph_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid'];
$resourceid = !empty($this->screenitem['real_resourceid']) ? $this->screenitem['real_resourceid'] : $this->screenitem['resourceid'];
$containerid = 'graph_container_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid'];
$graphDims = getGraphDims();
$graphDims['graphHeight'] = $this->screenitem['height'];
$graphDims['width'] = $this->screenitem['width'];
// get time control
$timeControlData = array('id' => $this->getDataId(), 'containerid' => $containerid, 'objDims' => $graphDims, 'loadImage' => 1, 'periodFixed' => CProfile::get('web.screens.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD);
// host feature
if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) {
$newitemid = get_same_item_for_host($resourceid, $this->hostid);
$resourceid = !empty($newitemid) ? $newitemid : '';
}
if ($this->mode == SCREEN_MODE_PREVIEW && !empty($resourceid)) {
$this->action = 'history.php?action=' . HISTORY_GRAPH . '&itemids[]=' . $resourceid . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow'] . $this->getProfileUrlParams();
}
if ($resourceid && $this->mode != SCREEN_MODE_EDIT) {
if ($this->mode == SCREEN_MODE_PREVIEW) {
$timeControlData['loadSBox'] = 1;
}
}
$timeControlData['src'] = $resourceid ? 'chart.php?itemids[]=' . $resourceid . '&' . $this->screenitem['url'] . '&width=' . $this->screenitem['width'] . '&height=' . $this->screenitem['height'] : 'chart3.php?';
$timeControlData['src'] .= $this->mode == SCREEN_MODE_EDIT ? '&period=3600&stime=' . date(TIMESTAMP_FORMAT, time()) : '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow'];
$timeControlData['src'] .= $this->getProfileUrlParams();
// output
if ($this->mode == SCREEN_MODE_JS) {
return 'timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ')';
} else {
if ($this->mode == SCREEN_MODE_SLIDESHOW) {
insert_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');');
} else {
zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');');
}
if ($this->mode == SCREEN_MODE_EDIT || $this->mode == SCREEN_MODE_SLIDESHOW) {
$item = new CDiv();
} elseif ($this->mode == SCREEN_MODE_PREVIEW) {
$item = new CLink(null, 'history.php?action=' . HISTORY_GRAPH . '&itemids[]=' . $resourceid . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow']);
}
$item->setAttribute('id', $containerid);
return $this->getOutput($item);
}
}
示例3: bodyToString
function bodyToString($destroy = true)
{
$left = new CDiv(null, 'left');
$left->addItem(new CDiv($this->getList(), 'left_menu'));
$link1 = new CLink('www.zabbix.com', 'http://www.zabbix.com/', null, null, true);
$link1->setAttribute('target', '_blank');
$link2 = new CLink('GPL v2', 'http://www.zabbix.com/license.php', null, null, true);
$link2->setAttribute('target', '_blank');
$licence = new CDiv(array($link1, BR(), ' Licensed under ', $link2), 'setup_wizard_licence');
$left->addItem($licence);
$right = new CDiv(null, 'right');
if ($this->getStep() == 0) {
$right->addItem(new CDiv(null, 'blank_title'));
$right->addItem(new CDiv($this->getState(), 'blank_under_title'));
$container = new CDiv(array($left, $right), 'setup_wizard setup_wizard_welcome');
} else {
$right->addItem(new CDiv($this->stage[$this->getStep()]['title'], 'setup_title'));
$right->addItem(new CDiv($this->getState(), 'under_title'));
$container = new CDiv(array($left, $right), 'setup_wizard');
}
if (isset($this->stage[$this->getStep() + 1])) {
$next = new CSubmit('next[' . $this->getStep() . ']', _('Next') . SPACE . '»');
} else {
$next = new CSubmit('finish', _('Finish'));
}
if (isset($this->HIDE_CANCEL_BUTTON) && $this->HIDE_CANCEL_BUTTON) {
$cancel = null;
} else {
$cancel = new CDiv(new CSubmit('cancel', _('Cancel')), 'footer_left');
}
if ($this->DISABLE_NEXT_BUTTON) {
$next->setEnabled(false);
}
// if the user is not logged in (first setup run) hide the "previous" button on the final step
if ($this->getStep() && (CWebUser::$data && CWebUser::getType() == USER_TYPE_SUPER_ADMIN || $this->getStep() < 5)) {
$back = new CSubmit('back[' . $this->getStep() . ']', '«' . SPACE . _('Previous'));
} else {
$back = null;
}
$footer = new CDiv(array($cancel, new CDiv(array($back, $next), 'footer_right')), 'footer');
$container->addItem($footer);
return parent::bodyToString($destroy) . $container->ToString();
}
示例4: createServiceConfigurationTree
/**
* Creates nodes that can be used to display the service configuration tree using the CTree class.
*
* @see CTree
*
* @param array $services
* @param array $parentService
* @param array $service
* @param array $dependency
* @param array $tree
*/
function createServiceConfigurationTree(array $services, &$tree, array $parentService = array(), array $service = array(), array $dependency = array())
{
if (!$service) {
$caption = new CLink(_('root'), '#', 'service-conf-menu');
$caption->setAttribute('data-menu', array('serviceid' => 0, 'name' => _('root'), 'hasDependencies' => true));
$serviceNode = array('id' => 0, 'parentid' => 0, 'caption' => $caption, 'trigger' => array(), 'algorithm' => SPACE, 'description' => SPACE);
$service = $serviceNode;
$service['serviceid'] = 0;
$service['dependencies'] = array();
$service['trigger'] = array();
// add all top level services as children of "root"
foreach ($services as $topService) {
if (!$topService['parent']) {
$service['dependencies'][] = array('servicedownid' => $topService['serviceid'], 'soft' => 0, 'linkid' => 0);
}
}
$tree = array($serviceNode);
} else {
// caption
$caption = new CLink($service['name'], '#', 'service-conf-menu');
// service is deletable only if it has no hard dependency
$deletable = true;
foreach ($service['dependencies'] as $dep) {
if ($dep['soft'] == 0) {
$deletable = false;
break;
}
}
$caption->setAttribute('data-menu', array('serviceid' => $service['serviceid'], 'name' => $service['name'], 'deletable' => $deletable));
$serviceNode = array('id' => $service['serviceid'], 'caption' => $caption, 'description' => $service['trigger'] ? $service['trigger']['description'] : '-', 'parentid' => $parentService ? $parentService['serviceid'] : 0, 'algorithm' => serviceAlgorythm($service['algorithm']));
}
if (!$dependency || !$dependency['soft']) {
$tree[$serviceNode['id']] = $serviceNode;
foreach ($service['dependencies'] as $dependency) {
$childService = $services[$dependency['servicedownid']];
createServiceConfigurationTree($services, $tree, $service, $childService, $dependency);
}
} else {
$serviceNode['caption'] = new CSpan($serviceNode['caption'], 'service-caption-soft');
$tree[$serviceNode['id'] . '.' . $dependency['linkid']] = $serviceNode;
}
}
示例5: 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);
}
示例6: bodyToString
function bodyToString($destroy = true)
{
$left = new CDiv(null, 'left');
$left->addItem(new CDiv(null, 'setup_logo'));
$left->addItem(new CDiv(ZABBIX_VERSION, 'setup_version'));
$left->addItem(new CDiv($this->getList(), 'left_menu'));
$link1 = new CLink('www.zabbix.com', 'http://www.zabbix.com/', null, null, true);
$link1->setAttribute('target', '_blank');
$link2 = new CLink('GPL v2', 'http://www.zabbix.com/license.php', null, null, true);
$link2->setAttribute('target', '_blank');
$licence = new CDiv(array($link1, BR(), ' Licensed under ', $link2), 'setup_wizard_licence');
$left->addItem($licence);
$right = new CDiv(null, 'right');
if ($this->getStep() == 0) {
$right->addItem(new CDiv(null, 'blank_title'));
$right->addItem(new CDiv($this->getState(), 'blank_under_title'));
$container = new CDiv(array($left, $right), 'setup_wizard setup_wizard_welcome');
} else {
$right->addItem(new CDiv($this->stage[$this->getStep()]['title'], 'setup_title'));
$right->addItem(new CDiv($this->getState(), 'under_title'));
$container = new CDiv(array($left, $right), 'setup_wizard');
}
if (isset($this->stage[$this->getStep() + 1])) {
$next = new CSubmit('next[' . $this->getStep() . ']', _('Next') . ' >>');
} else {
$next = new CSubmit('finish', _('Finish'));
}
if (isset($this->HIDE_CANCEL_BUTTON) && $this->HIDE_CANCEL_BUTTON) {
$cancel = null;
} else {
$cancel = new CDiv(new CSubmit('cancel', _('Cancel')), 'footer_left');
}
if ($this->DISABLE_NEXT_BUTTON) {
$next->setEnabled(false);
}
$footer = new CDiv(array($cancel, new CDiv(array($this->getStep() != 0 ? new CSubmit('back[' . $this->getStep() . ']', '<< ' . _('Previous')) : null, $next), 'footer_right')), 'footer');
$container->addItem($footer);
return parent::bodyToString($destroy) . $container->ToString();
}
示例7: CNumericBox
$sysmapList->addRow(_('Height'), new CNumericBox('height', $this->data['sysmap']['height'], 5));
// append background image to form list
$imageComboBox = new CComboBox('backgroundid', $this->data['sysmap']['backgroundid']);
$imageComboBox->addItem(0, _('No image'));
foreach ($this->data['images'] as $image) {
$imageComboBox->addItem($image['imageid'], $image['name']);
}
$sysmapList->addRow(_('Background image'), $imageComboBox);
// append iconmapping to form list
$iconMappingComboBox = new CComboBox('iconmapid', $this->data['sysmap']['iconmapid']);
$iconMappingComboBox->addItem(0, _('<manual>'));
foreach ($this->data['iconMaps'] as $iconMap) {
$iconMappingComboBox->addItem($iconMap['iconmapid'], $iconMap['name']);
}
$iconMappingsLink = new CLink(_('show icon mappings'), 'adm.iconmapping.php');
$iconMappingsLink->setAttribute('target', '_blank');
$sysmapList->addRow(_('Automatic icon mapping'), array($iconMappingComboBox, SPACE, $iconMappingsLink));
// append multiple checkboxes to form list
$sysmapList->addRow(_('Icon highlight'), new CCheckBox('highlight', $this->data['sysmap']['highlight'], null, 1));
$sysmapList->addRow(_('Mark elements on trigger status change'), new CCheckBox('markelements', $this->data['sysmap']['markelements'], null, 1));
$sysmapList->addRow(_('Expand single problem'), new CCheckBox('expandproblem', $this->data['sysmap']['expandproblem'], null, 1));
$sysmapList->addRow(_('Advanced labels'), new CCheckBox('label_format', $this->data['sysmap']['label_format'], null, 1));
// append hostgroup to form list
$labelTypeHostgroupComboBox = new CComboBox('label_type_hostgroup', $this->data['sysmap']['label_type_hostgroup'], null, $this->data['labelTypesLimited']);
$customLabelHostgroupTextArea = new CTextArea('label_string_hostgroup', $this->data['sysmap']['label_string_hostgroup']);
if ($this->data['sysmap']['label_type_hostgroup'] != MAP_LABEL_TYPE_CUSTOM) {
$customLabelHostgroupTextArea->addClass('hidden');
}
$sysmapList->addRow(_('Host group label type'), array($labelTypeHostgroupComboBox, BR(), $customLabelHostgroupTextArea));
// append host to form list
$labelTypeHostComboBox = new CComboBox('label_type_host', $this->data['sysmap']['label_type_host'], null, $this->data['labelTypes']);
示例8: insert_mass_update_item_form
//.........这里部分代码省略.........
$frmItem->addVar("delay_flex[" . $i . "][delay]", $val['delay']);
$frmItem->addVar("delay_flex[" . $i . "][period]", $val['period']);
$i++;
if ($i >= 7) {
break;
}
/* limit count of intervals
* 7 intervals by 30 symbols = 210 characters
* db storage field is 256
*/
}
if (count($delay_flex_el) == 0) {
array_push($delay_flex_el, S_NO_FLEXIBLE_INTERVALS);
} else {
array_push($delay_flex_el, new CButton('del_delay_flex', S_DELETE_SELECTED));
}
if (count($applications) == 0) {
array_push($applications, 0);
}
$itemTypes = item_type2str();
// http items only for internal processes
unset($itemTypes[ITEM_TYPE_HTTPTEST]);
$cmbType = new CComboBox('type', $type);
$cmbType->addItems($itemTypes);
$frmItem->addRow(array(new CVisibilityBox('type_visible', get_request('type_visible'), 'type', S_ORIGINAL), S_TYPE), $cmbType);
$frmItem->addRow(array(new CVisibilityBox('community_visible', get_request('community_visible'), 'snmp_community', S_ORIGINAL), S_SNMP_COMMUNITY), new CTextBox('snmp_community', $snmp_community, 16));
$frmItem->addRow(array(new CVisibilityBox('securityname_visible', get_request('securityname_visible'), 'snmpv3_securityname', S_ORIGINAL), S_SNMPV3_SECURITY_NAME), new CTextBox('snmpv3_securityname', $snmpv3_securityname, 64));
$cmbSecLevel = new CComboBox('snmpv3_securitylevel', $snmpv3_securitylevel);
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV, "noAuthNoPriv");
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, "authNoPriv");
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, "authPriv");
$frmItem->addRow(array(new CVisibilityBox('securitylevel_visible', get_request('securitylevel_visible'), 'snmpv3_securitylevel', S_ORIGINAL), S_SNMPV3_SECURITY_LEVEL), $cmbSecLevel);
$frmItem->addRow(array(new CVisibilityBox('authpassphrase_visible', get_request('authpassphrase_visible'), 'snmpv3_authpassphrase', S_ORIGINAL), S_SNMPV3_AUTH_PASSPHRASE), new CTextBox('snmpv3_authpassphrase', $snmpv3_authpassphrase, 64));
$frmItem->addRow(array(new CVisibilityBox('privpassphras_visible', get_request('privpassphras_visible'), 'snmpv3_privpassphrase', S_ORIGINAL), S_SNMPV3_PRIV_PASSPHRASE), new CTextBox('snmpv3_privpassphrase', $snmpv3_privpassphrase, 64));
$frmItem->addRow(array(new CVisibilityBox('port_visible', get_request('port_visible'), 'snmp_port', S_ORIGINAL), S_SNMP_PORT), new CNumericBox('snmp_port', $snmp_port, 5));
$cmbValType = new CComboBox('value_type', $value_type);
$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);
$frmItem->addRow(array(new CVisibilityBox('value_type_visible', get_request('value_type_visible'), 'value_type', S_ORIGINAL), S_TYPE_OF_INFORMATION), $cmbValType);
$cmbDataType = new CComboBox('data_type', $data_type);
$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));
$frmItem->addRow(array(new CVisibilityBox('data_type_visible', get_request('data_type_visible'), 'data_type', S_ORIGINAL), S_DATA_TYPE), $cmbDataType);
$frmItem->addRow(array(new CVisibilityBox('units_visible', get_request('units_visible'), 'units', S_ORIGINAL), S_UNITS), new CTextBox('units', $units, 40));
$cmbAuthType = new CComboBox('authtype', $authtype);
$cmbAuthType->addItem(ITEM_AUTHTYPE_PASSWORD, S_PASSWORD);
$cmbAuthType->addItem(ITEM_AUTHTYPE_PUBLICKEY, S_PUBLIC_KEY);
$frmItem->addRow(array(new CVisibilityBox('authtype_visible', get_request('authtype_visible'), 'authtype', S_ORIGINAL), S_AUTHENTICATION_METHOD), $cmbAuthType);
$frmItem->addRow(array(new CVisibilityBox('username_visible', get_request('username_visible'), 'username', S_ORIGINAL), S_USER_NAME), new CTextBox('username', $username, 40));
$frmItem->addRow(array(new CVisibilityBox('publickey_visible', get_request('publickey_visible'), 'publickey', S_ORIGINAL), S_PUBLIC_KEY_FILE), new CTextBox('publickey', $publickey, 40));
$frmItem->addRow(array(new CVisibilityBox('privatekey_visible', get_request('privatekey_visible'), 'privatekey', S_ORIGINAL), S_PRIVATE_KEY_FILE), new CTextBox('privatekey', $privatekey, 40));
$frmItem->addRow(array(new CVisibilityBox('password_visible', get_request('password_visible'), 'password', S_ORIGINAL), S_PASSWORD), new CTextBox('password', $password, 40));
$frmItem->addRow(array(new CVisibilityBox('formula_visible', get_request('formula_visible'), 'formula', S_ORIGINAL), S_CUSTOM_MULTIPLIER . ' (0 - ' . S_DISABLED . ')'), new CTextBox('formula', $formula, 40));
$frmItem->addRow(array(new CVisibilityBox('delay_visible', get_request('delay_visible'), 'delay', S_ORIGINAL), S_UPDATE_INTERVAL_IN_SEC), new CNumericBox('delay', $delay, 5));
$delay_flex_el = new CSpan($delay_flex_el);
$delay_flex_el->setAttribute('id', 'delay_flex_list');
$frmItem->addRow(array(new CVisibilityBox('delay_flex_visible', get_request('delay_flex_visible'), array('delay_flex_list', 'new_delay_flex_el'), S_ORIGINAL), S_FLEXIBLE_INTERVALS), $delay_flex_el);
$new_delay_flex_el = new CSpan(array(S_DELAY, SPACE, new CNumericBox("new_delay_flex[delay]", "50", 5), S_PERIOD, SPACE, new CTextBox("new_delay_flex[period]", "1-7,00:00-23:59", 27), BR(), new CButton("add_delay_flex", S_ADD)));
$new_delay_flex_el->setAttribute('id', 'new_delay_flex_el');
$frmItem->addRow(S_NEW_FLEXIBLE_INTERVAL, $new_delay_flex_el, 'new');
$frmItem->addRow(array(new CVisibilityBox('history_visible', get_request('history_visible'), 'history', S_ORIGINAL), S_KEEP_HISTORY_IN_DAYS), new CNumericBox('history', $history, 8));
$frmItem->addRow(array(new CVisibilityBox('trends_visible', get_request('trends_visible'), 'trends', S_ORIGINAL), S_KEEP_TRENDS_IN_DAYS), new CNumericBox('trends', $trends, 8));
$cmbStatus = new CComboBox('status', $status);
foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED, ITEM_STATUS_NOTSUPPORTED) as $st) {
$cmbStatus->addItem($st, item_status2str($st));
}
$frmItem->addRow(array(new CVisibilityBox('status_visible', get_request('status_visible'), 'status', S_ORIGINAL), S_STATUS), $cmbStatus);
$frmItem->addRow(array(new CVisibilityBox('logtimefmt_visible', get_request('logtimefmt_visible'), 'logtimefmt', S_ORIGINAL), S_LOG_TIME_FORMAT), new CTextBox("logtimefmt", $logtimefmt, 16));
$cmbDelta = new CComboBox('delta', $delta);
$cmbDelta->addItem(0, S_AS_IS);
$cmbDelta->addItem(1, S_DELTA_SPEED_PER_SECOND);
$cmbDelta->addItem(2, S_DELTA_SIMPLE_CHANGE);
$frmItem->addRow(array(new CVisibilityBox('delta_visible', get_request('delta_visible'), 'delta', S_ORIGINAL), S_STORE_VALUE), $cmbDelta);
$cmbMap = new CComboBox('valuemapid', $valuemapid);
$cmbMap->addItem(0, S_AS_IS);
$db_valuemaps = DBselect('SELECT * FROM valuemaps WHERE ' . DBin_node('valuemapid'));
while ($db_valuemap = DBfetch($db_valuemaps)) {
$cmbMap->addItem($db_valuemap["valuemapid"], get_node_name_by_elid($db_valuemap["valuemapid"], null, ': ') . $db_valuemap["name"]);
}
$link = new CLink(S_SHOW_VALUE_MAPPINGS, 'config.php?config=6');
$link->setAttribute('target', '_blank');
$frmItem->addRow(array(new CVisibilityBox('valuemapid_visible', get_request('valuemapid_visible'), 'valuemapid', S_ORIGINAL), S_SHOW_VALUE), array($cmbMap, SPACE, $link));
$frmItem->addRow(array(new CVisibilityBox('trapper_hosts_visible', get_request('trapper_hosts_visible'), 'trapper_hosts', S_ORIGINAL), S_ALLOWED_HOSTS), new CTextBox('trapper_hosts', $trapper_hosts, 40));
$cmbApps = new CListBox('applications[]', $applications, 6);
$cmbApps->addItem(0, '-' . S_NONE . '-');
if (isset($_REQUEST['hostid'])) {
$sql = 'SELECT applicationid,name ' . ' FROM applications ' . ' WHERE hostid=' . $_REQUEST['hostid'] . ' ORDER BY name';
$db_applications = DBselect($sql);
while ($db_app = DBfetch($db_applications)) {
$cmbApps->addItem($db_app["applicationid"], $db_app["name"]);
}
}
$frmItem->addRow(array(new CVisibilityBox('applications_visible', get_request('applications_visible'), 'applications[]', S_ORIGINAL), S_APPLICATIONS), $cmbApps);
$frmItem->addItemToBottomRow(array(new CButton("update", S_UPDATE), SPACE, new CButtonCancel(url_param('groupid') . url_param("hostid") . url_param("config"))));
return $frmItem;
}
示例9: CLink
return null;
}
if (!defined('ZBX_PAGE_NO_MENU')) {
$help = new CLink(_('Help'), 'http://www.zabbix.com/documentation/', 'small_font', null, 'nosid');
$help->setTarget('_blank');
$support = new CLink(_('Get support'), 'http://www.zabbix.com/support.php', 'small_font', null, 'nosid');
$support->setTarget('_blank');
$printview = new CLink(_('Print'), '', 'small_font print-link', null, 'nosid');
$page_header_r_col = array($help, '|', $support, '|', $printview, '|');
if (!CWebUser::isGuest()) {
array_push($page_header_r_col, new CLink(_('Profile'), 'profile.php', 'small_font', null, 'nosid'), '|');
}
if (isset(CWebUser::$data['debug_mode']) && CWebUser::$data['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
$debug = new CLink(_('Debug'), '#debug', 'small_font', null, 'nosid');
$d_script = " if (!isset('state', this)) { this.state = 'none'; }" . " if (this.state == 'none') { this.state = 'block'; }" . " else { this.state = 'none'; }" . " showHideByName('zbx_debug_info', this.state);";
$debug->setAttribute('onclick', 'javascript: ' . $d_script);
array_push($page_header_r_col, $debug, '|');
}
if (CWebUser::isGuest()) {
$page_header_r_col[] = array(new CLink(_('Login'), 'index.php?reconnect=1', 'small_font', null, null));
} else {
// it is not possible to logout from HTTP authentication
$chck = $page['file'] == 'authentication.php' && isset($_REQUEST['save'], $_REQUEST['config']);
if ($chck && $_REQUEST['config'] == ZBX_AUTH_HTTP || !$chck && isset($config) && $config['authentication_type'] == ZBX_AUTH_HTTP) {
$logout = new CLink(_('Logout'), '', 'small_font', null, 'nosid');
$logout->setHint(_s('It is not possible to logout from HTTP authentication.'), null, null, false);
} else {
$logout = new CLink(_('Logout'), 'index.php?reconnect=1', 'small_font', null, null);
}
array_push($page_header_r_col, $logout);
}
示例10: CTextBox
$deltaComboBox->addItems($deltaOptions);
}
$itemFormList->addRow(_('Store value'), $deltaComboBox, false, 'row_delta');
// append valuemap to form list
if ($this->data['limited']) {
$itemForm->addVar('valuemapid', $this->data['valuemapid']);
$valuemapComboBox = new CTextBox('valuemap_name', !empty($this->data['valuemaps']) ? $this->data['valuemaps'] : _('As is'), ZBX_TEXTBOX_SMALL_SIZE, 'yes');
} else {
$valuemapComboBox = new CComboBox('valuemapid', $this->data['valuemapid']);
$valuemapComboBox->addItem(0, _('As is'));
foreach ($this->data['valuemaps'] as $valuemap) {
$valuemapComboBox->addItem($valuemap['valuemapid'], get_node_name_by_elid($valuemap['valuemapid'], null, NAME_DELIMITER) . CHtml::encode($valuemap['name']));
}
}
$link = new CLink(_('show value mappings'), 'adm.valuemapping.php');
$link->setAttribute('target', '_blank');
$itemFormList->addRow(_('Show value'), array($valuemapComboBox, SPACE, $link), null, 'row_valuemap');
$itemFormList->addRow(_('Allowed hosts'), new CTextBox('trapper_hosts', $this->data['trapper_hosts'], ZBX_TEXTBOX_STANDARD_SIZE), false, 'row_trapper_hosts');
// append applications to form list
$itemFormList->addRow(_('New application'), new CTextBox('new_application', $this->data['new_application'], ZBX_TEXTBOX_STANDARD_SIZE), false, null, 'new');
$applicationComboBox = new CListBox('applications[]', $this->data['applications'], 6);
$applicationComboBox->addItem(0, '-' . _('None') . '-');
foreach ($this->data['db_applications'] as $application) {
$applicationComboBox->addItem($application['applicationid'], CHtml::encode($application['name']));
}
$itemFormList->addRow(_('Applications'), $applicationComboBox);
// append populate host to form list
if (empty($this->data['parent_discoveryid'])) {
$itemCloned = isset($_REQUEST['clone']);
$hostInventoryFieldComboBox = new CComboBox('inventory_link');
$hostInventoryFieldComboBox->addItem(0, '-' . _('None') . '-', $this->data['inventory_link'] == '0' ? 'yes' : null);
示例11: CTextArea
$input = new CTextArea('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]);
$input->addStyle('width: 64em;');
} else {
$fieldLength = $hostInventoryTable['fields'][$inventoryInfo['db_field']]['length'];
$input = new CTextBox('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]);
$input->setAttribute('maxlength', $fieldLength);
$input->addStyle('width: ' . ($fieldLength > 64 ? 64 : $fieldLength) . 'em;');
}
if ($inventory_mode == HOST_INVENTORY_DISABLED) {
$input->setAttribute('disabled', 'disabled');
}
// link to populating item at the right side (if any)
if (isset($hostItemsToInventory[$inventoryNo])) {
$itemName = itemName($hostItemsToInventory[$inventoryNo]);
$populatingLink = new CLink($itemName, 'items.php?form=update&itemid=' . $hostItemsToInventory[$inventoryNo]['itemid']);
$populatingLink->setAttribute('title', _s('This field is automatically populated by item "%s".', $itemName));
$populatingItemCell = array(' ← ', $populatingLink);
$input->addClass('linked_to_item');
// this will be used for disabling fields via jquery
if ($inventory_mode == HOST_INVENTORY_AUTOMATIC) {
$input->setAttribute('disabled', 'disabled');
}
} else {
$populatingItemCell = '';
}
$input->addStyle('float: left;');
$populatingItem = new CSpan($populatingItemCell, 'populating_item');
if ($inventory_mode != HOST_INVENTORY_AUTOMATIC) {
// those links are visible only in automatic mode
$populatingItem->addStyle('display: none');
}
示例12: insert_mass_update_item_form
function insert_mass_update_item_form($elements_array_name)
{
global $USER_DETAILS;
$frmItem = new CFormTable(S_ITEM, null, 'post');
$frmItem->SetHelp('web.items.item.php');
$frmItem->SetTitle(S_MASS_UPDATE);
$frmItem->addVar('form_mass_update', 1);
$frmItem->addVar('group_itemid', get_request('group_itemid', array()));
$frmItem->addVar('config', get_request('config', 0));
if ($_REQUEST['groupid'] > 0) {
$frmItem->addVar('groupid', $_REQUEST['groupid']);
}
$frmItem->addVar('hostid', $_REQUEST['hostid']);
$description = get_request('description', '');
$key = get_request('key', '');
$host = get_request('host', null);
$delay = get_request('delay', 30);
$history = get_request('history', 90);
$status = get_request('status', 0);
$type = get_request('type', 0);
$snmp_community = get_request('snmp_community', 'public');
$snmp_oid = get_request('snmp_oid', 'interfaces.ifTable.ifEntry.ifInOctets.1');
$snmp_port = get_request('snmp_port', 161);
$value_type = get_request('value_type', ITEM_VALUE_TYPE_UINT64);
$data_type = get_request('data_type', ITEM_DATA_TYPE_DECIMAL);
$trapper_hosts = get_request('trapper_hosts', '');
$units = get_request('units', '');
$valuemapid = get_request('valuemapid', 0);
$delta = get_request('delta', 0);
$trends = get_request('trends', 365);
$applications = get_request('applications', array());
$delay_flex = get_request('delay_flex', array());
$snmpv3_securityname = get_request('snmpv3_securityname', '');
$snmpv3_securitylevel = get_request('snmpv3_securitylevel', 0);
$snmpv3_authpassphrase = get_request('snmpv3_authpassphrase', '');
$snmpv3_privpassphrase = get_request('snmpv3_privpassphrase', '');
$formula = get_request('formula', '1');
$logtimefmt = get_request('logtimefmt', '');
$add_groupid = get_request('add_groupid', get_request('groupid', 0));
$delay_flex_el = array();
$i = 0;
foreach ($delay_flex as $val) {
if (!isset($val['delay']) && !isset($val['period'])) {
continue;
}
array_push($delay_flex_el, array(new CCheckBox('rem_delay_flex[]', 'no', null, $i), $val['delay'], ' sec at ', $val['period']), BR());
$frmItem->addVar("delay_flex[" . $i . "][delay]", $val['delay']);
$frmItem->addVar("delay_flex[" . $i . "][period]", $val['period']);
$i++;
if ($i >= 7) {
break;
}
/* limit count of intervals
* 7 intervals by 30 symbols = 210 characters
* db storage field is 256
*/
}
if (count($delay_flex_el) == 0) {
array_push($delay_flex_el, "No flexible intervals");
} else {
array_push($delay_flex_el, new CButton('del_delay_flex', S_DELETE_SELECTED));
}
if (count($applications) == 0) {
array_push($applications, 0);
}
$cmbType = new CComboBox('type', $type);
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_AGGREGATE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR) as $it) {
$cmbType->addItem($it, item_type2str($it));
}
$frmItem->addRow(array(new CVisibilityBox('type_visible', get_request('type_visible'), 'type', S_ORIGINAL), S_TYPE), $cmbType);
$frmItem->addRow(array(new CVisibilityBox('community_visible', get_request('community_visible'), 'snmp_community', S_ORIGINAL), S_SNMP_COMMUNITY), new CTextBox('snmp_community', $snmp_community, 16));
$frmItem->addRow(array(new CVisibilityBox('securityname_visible', get_request('securityname_visible'), 'snmpv3_securityname', S_ORIGINAL), S_SNMPV3_SECURITY_NAME), new CTextBox('snmpv3_securityname', $snmpv3_securityname, 64));
$cmbSecLevel = new CComboBox('snmpv3_securitylevel', $snmpv3_securitylevel);
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV, "NoAuthPriv");
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, "AuthNoPriv");
$cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, "AuthPriv");
$frmItem->addRow(array(new CVisibilityBox('securitylevel_visible', get_request('securitylevel_visible'), 'snmpv3_securitylevel', S_ORIGINAL), S_SNMPV3_SECURITY_LEVEL), $cmbSecLevel);
$frmItem->addRow(array(new CVisibilityBox('authpassphrase_visible', get_request('authpassphrase_visible'), 'snmpv3_authpassphrase', S_ORIGINAL), S_SNMPV3_AUTH_PASSPHRASE), new CTextBox('snmpv3_authpassphrase', $snmpv3_authpassphrase, 64));
$frmItem->addRow(array(new CVisibilityBox('privpassphras_visible', get_request('privpassphras_visible'), 'snmpv3_privpassphrase', S_ORIGINAL), S_SNMPV3_PRIV_PASSPHRASE), new CTextBox('snmpv3_privpassphrase', $snmpv3_privpassphrase, 64));
$frmItem->addRow(array(new CVisibilityBox('port_visible', get_request('port_visible'), 'snmp_port', S_ORIGINAL), S_SNMP_PORT), new CNumericBox('snmp_port', $snmp_port, 5));
$cmbValType = new CComboBox('value_type', $value_type);
$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);
$frmItem->AddRow(array(new CVisibilityBox('value_type_visible', get_request('value_type_visible'), 'value_type', S_ORIGINAL), S_TYPE_OF_INFORMATION), $cmbValType);
$cmbDataType = new CComboBox('data_type', $data_type);
$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));
$frmItem->addRow(array(new CVisibilityBox('data_type_visible', get_request('data_type_visible'), 'data_type', S_ORIGINAL), S_DATA_TYPE), $cmbDataType);
$frmItem->addRow(array(new CVisibilityBox('units_visible', get_request('units_visible'), 'units', S_ORIGINAL), S_UNITS), new CTextBox('units', $units, 40));
$frmItem->addRow(array(new CVisibilityBox('formula_visible', get_request('formula_visible'), 'formula', S_ORIGINAL), S_CUSTOM_MULTIPLIER . ' (0 - ' . S_DISABLED . ')'), new CTextBox('formula', $formula, 40));
$frmItem->addRow(array(new CVisibilityBox('delay_visible', get_request('delay_visible'), 'delay', S_ORIGINAL), S_UPDATE_INTERVAL_IN_SEC), new CNumericBox('delay', $delay, 5));
$delay_flex_el = new CSpan($delay_flex_el);
$delay_flex_el->setAttribute('id', 'delay_flex_list');
$frmItem->addRow(array(new CVisibilityBox('delay_flex_visible', get_request('delay_flex_visible'), array('delay_flex_list', 'new_delay_flex_el'), S_ORIGINAL), S_FLEXIBLE_INTERVALS), $delay_flex_el);
$new_delay_flex_el = new CSpan(array(S_DELAY, SPACE, new CNumericBox("new_delay_flex[delay]", "50", 5), S_PERIOD, SPACE, new CTextBox("new_delay_flex[period]", "1-7,00:00-23:59", 27), BR(), new CButton("add_delay_flex", S_ADD)));
$new_delay_flex_el->setAttribute('id', 'new_delay_flex_el');
//.........这里部分代码省略.........
示例13: DBselect
$dep_res = DBselect($sql_dep);
while ($dep_row = DBfetch($dep_res)) {
$dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_down']));
$dependency = true;
}
if ($dependency) {
$img = new Cimg('images/general/up_icon.png', 'DEP_UP');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->setHint($dep_table);
$description = array($img, SPACE, $description);
}
unset($img, $dep_table, $dependency);
//------------------------
if (time(NULL) - $row['lastchange'] < TRIGGER_BLINK_PERIOD) {
$tr_status = new CLink(trigger_value2str($row['value']));
$tr_status->setAttribute('name', 'blink');
} else {
$tr_status = trigger_value2str($row['value']);
}
$value = new CSpan($tr_status, get_trigger_value_style($row['value']));
if ($_REQUEST['show_actions']) {
$actions = array(new CLink(S_CHANGE, 'triggers.php?form=update&triggerid=' . $row['triggerid'] . url_param('hostid'), 'action'));
} else {
$actions = NULL;
}
// JS menu
$host = null;
if ($_REQUEST['hostid'] < 1) {
$menus = '';
$host_nodeid = id2nodeid($row['hostid']);
foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {
示例14: SLA
$goodslaTextBox->setAttribute('disabled', 'disabled');
}
$servicesFormList->addRow(_('Calculate SLA, acceptable SLA (in %)'), array($showslaCheckbox, $goodslaTextBox));
// append trigger to form list
$servicesFormList->addRow(_('Trigger'), array(new CTextBox('trigger', $this->data['trigger'], ZBX_TEXTBOX_STANDARD_SIZE, true), new CButton('btn1', _('Select'), 'return PopUp("popup.php?' . 'dstfrm=' . $servicesForm->getName() . '&dstfld1=triggerid' . '&dstfld2=trigger' . '&srctbl=triggers' . '&srcfld1=triggerid' . '&srcfld2=description' . '&real_hosts=1' . '&with_triggers=1");', 'formlist')));
$servicesFormList->addRow(_('Sort order (0->999)'), new CTextBox('sortorder', $this->data['sortorder'], 3, false, 3));
/*
* Dependencies tab
*/
$servicesChildTable = new CTable(_('No dependencies defined.'), 'formElementTable');
$servicesChildTable->setAttribute('style', 'min-width:500px;');
$servicesChildTable->setAttribute('id', 'service_children');
$servicesChildTable->setHeader(array(_('Services'), _('Soft'), _('Trigger'), _('Action')));
foreach ($this->data['children'] as $child) {
$childrenLink = new CLink($child['name'], 'services.php?form=1&serviceid=' . $child['serviceid']);
$childrenLink->setAttribute('target', '_blank');
$row = new CRow(array(array($childrenLink, new CVar('children[' . $child['serviceid'] . '][name]', $child['name']), new CVar('children[' . $child['serviceid'] . '][serviceid]', $child['serviceid'])), new CCheckBox('children[' . $child['serviceid'] . '][soft]', isset($child['soft']) && !empty($child['soft']) ? 'checked' : 'no', null, 1), !empty($child['trigger']) ? $child['trigger'] : '-', new CButton('remove', _('Remove'), 'javascript: removeDependentChild(\'' . $child['serviceid'] . '\');', 'link_menu')));
$row->setAttribute('id', 'children_' . $child['serviceid']);
$servicesChildTable->addRow($row);
}
$servicesDependenciesFormList = new CFormList('servicesDependensiesFormList');
$servicesDependenciesFormList->addRow(_('Depends on'), new CDiv(array($servicesChildTable, new CButton('add_child_service', _('Add'), "javascript: openWinCentered('services.php?cservices=1" . url_param('serviceid') . "', 'ZBX_Services_List', 640, 520, 'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all'));
/*
* Service times tab
*/
$servicesTimeFormList = new CFormList('servicesTimeFormList');
$servicesTimeTable = new CTable(_('No times defined. Work 24x7.'), 'formElementTable');
$servicesTimeTable->setAttribute('style', 'min-width: 500px;');
$servicesTimeTable->setHeader(array(_('Type'), _('Interval'), _('Note'), _('Action')));
$i = 0;
foreach ($this->data['times'] as $serviceTime) {
示例15: CTable
if (empty($this->data['parent_discoveryid'])) {
$dependenciesTable = new CTable(_('No dependencies defined.'), 'formElementTable');
$dependenciesTable->setAttribute('style', 'min-width: 500px;');
$dependenciesTable->setAttribute('id', 'dependenciesTable');
$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);