本文整理汇总了PHP中CLink类的典型用法代码示例。如果您正苦于以下问题:PHP CLink类的具体用法?PHP CLink怎么用?PHP CLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getContent
public function _getContent($refresh = false)
{
$table = new CTableInfo(_('No web scenarios found.'));
$table->setHeader(array(_('Website'), _('Links'), _('Broken Links')));
$data = array();
// fetch links between HTTP tests and host groups
$result = DbFetchArray(DBselect('SELECT website.*, sum(status LIKE "2%") as links_ok, sum(status != "" AND NOT status LIKE "2%") as links_404, sum(status = "" OR status is null) as links_unchecked FROM zabbix_spider.website LEFT JOIN zabbix_spider.page ON page.website = Website.aid group by page.website;'));
foreach ($result as $row) {
$deadlinks = DbFetchArray(DBselect('SELECT * FROM zabbix_spider.page WHERE NOT status IS NULL AND status != "200" AND status != "" and website = ' . $row['aid']));
$deadlink_output = array();
$link_options = array("target" => "_blank");
foreach ($deadlinks as $deadlink) {
$link_link = new CLink($deadlink['url'] == "" ? "root" : substr($deadlink['url'], 0, 50), ($deadlink['url'] == "" || $deadlink['url'][0] == "/" ? $row['url'] : "") . $deadlink['url']);
$link_link->setTarget("_blank");
$map_link = new CLink("map", $this->reportUrl . "?pid={$deadlink['aid']}");
$map_link->setTarget("_blank");
$info_link = new CLink($deadlink["status"], "http://www.checkupdown.com/status/E{$deadlink['status']}.html");
$info_link->setTarget("_blank");
$deadlink_output[] = new CDiv(array($link_link, " [ ", $map_link, " | ", $info_link, " ]"));
}
$link_link = new CLink($row['name'], $row['url']);
$link_link->setTarget("_blank");
$map_link = new CLink("map", $this->reportUrl . "?wid={$row['aid']}");
$map_link->setTarget("_blank");
$table->addRow(array(new CDiv(array($link_link, " [ ", $map_link, " ]")), new CDiv(array(new CSpan($row['links_ok'], 'green'), " / ", new CSpan($row['links_404'], 'red'), " / ", new CSpan($row['links_unchecked'], 'gray'))), new CDiv($deadlink_output)));
}
return $table;
}
示例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()
{
$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);
}
}
示例4: 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();
}
示例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: 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'), '#');
$caption->setMenuPopup(CMenuPopupHelper::getServiceConfiguration(null, _('root'), false));
$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 is deletable only if it has no hard dependency
$deletable = true;
foreach ($service['dependencies'] as $dep) {
if ($dep['soft'] == 0) {
$deletable = false;
break;
}
}
$caption->setMenuPopup(CMenuPopupHelper::getServiceConfiguration($service['serviceid'], $service['name'], $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;
}
}
示例7: 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();
}
示例8: CTextArea
if ($hostInventoryTable['fields'][$inventoryInfo['db_field']]['type'] == DB::FIELD_TYPE_TEXT) {
$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');
示例9: CComboBox
$deltaComboBox = new CComboBox('delta', $this->data['delta']);
$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');
示例10: getEventAckState
/**
* Create element with event acknowledges info.
* If $event has subarray 'acknowledges', returned link will have hint with acknowledges.
*
* @param array $event event data
* @param int $event['acknowledged']
* @param int $event['eventid']
* @param int $event['objectid']
* @param array $event['acknowledges']
* @param bool|string $backUrl if true, add backurl param to link with current page file name
* @param bool $isLink if true, return link otherwise span
* @param array $params additional params for link
*
* @return array|CLink|CSpan|null|string
*/
function getEventAckState($event, $backUrl = false, $isLink = true, $params = array())
{
$config = select_config();
if (!$config['event_ack_enable']) {
return null;
}
if ($isLink) {
if (!empty($backUrl)) {
if (is_bool($backUrl)) {
global $page;
$backurl = '&backurl=' . $page['file'];
} else {
$backurl = '&backurl=' . $backUrl;
}
} else {
$backurl = '';
}
$additionalParams = '';
foreach ($params as $key => $value) {
$additionalParams .= '&' . $key . '=' . $value;
}
if ($event['acknowledged'] == 0) {
$ack = new CLink(_('No'), 'acknow.php?eventid=' . $event['eventid'] . '&triggerid=' . $event['objectid'] . $backurl . $additionalParams, 'disabled');
} else {
$ackLink = new CLink(_('Yes'), 'acknow.php?eventid=' . $event['eventid'] . '&triggerid=' . $event['objectid'] . $backurl . $additionalParams, 'enabled');
if (is_array($event['acknowledges'])) {
$ackLinkHints = makeAckTab($event);
if (!empty($ackLinkHints)) {
$ackLink->setHint($ackLinkHints, '', '', false);
}
$ack = array($ackLink, ' (' . count($event['acknowledges']) . ')');
} else {
$ack = array($ackLink, ' (' . $event['acknowledges'] . ')');
}
}
} else {
if ($event['acknowledged'] == 0) {
$ack = new CSpan(_('No'), 'on');
} else {
$ack = array(new CSpan(_('Yes'), 'off'), ' (' . (is_array($event['acknowledges']) ? count($event['acknowledges']) : $event['acknowledges']) . ')');
}
}
return $ack;
}
示例11: testDeleteLink
/**
* Tests the delete of a link
*/
public function testDeleteLink()
{
global $AppUI;
$this->obj->bind($this->post_data);
$result = $this->obj->store($AppUI);
$this->assertTrue($result);
$original_id = $this->obj->link_id;
$result = $this->obj->delete($AppUI);
$this->assertTrue($result);
$link = new CLink();
$link->load($original_id);
$this->assertEquals('', $link->link_name);
$this->assertEquals('', $link->link_url);
}
示例12: CNumericBox
$sysmapList->addRow(_('Width'), new CNumericBox('width', $this->data['sysmap']['width'], 5));
$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
示例13: CNumericBox
$userFormList->addRow(_('Refresh (in seconds)'), new CNumericBox('refresh', $this->data['refresh'], 4));
$userFormList->addRow(_('Rows per page'), new CNumericBox('rows_per_page', $this->data['rows_per_page'], 6));
$userFormList->addRow(_('URL (after login)'), new CTextBox('url', $this->data['url'], ZBX_TEXTBOX_STANDARD_SIZE));
/*
* Media tab
*/
if (uint_in_array(CWebUser::$data['type'], array(USER_TYPE_ZABBIX_ADMIN, USER_TYPE_SUPER_ADMIN))) {
$userMediaFormList = new CFormList('userMediaFormList');
$userForm->addVar('user_medias', $this->data['user_medias']);
$mediaTableInfo = new CTableInfo(_('No media found.'));
foreach ($this->data['user_medias'] as $id => $media) {
if (!isset($media['active']) || !$media['active']) {
$status = new CLink(_('Enabled'), '#', 'enabled');
$status->onClick('return create_var("' . $userForm->getName() . '","disable_media",' . $id . ', true);');
} else {
$status = new CLink(_('Disabled'), '#', 'disabled');
$status->onClick('return create_var("' . $userForm->getName() . '","enable_media",' . $id . ', true);');
}
$mediaUrl = '?dstfrm=' . $userForm->getName() . '&media=' . $id . '&mediatypeid=' . $media['mediatypeid'] . '&sendto=' . urlencode($media['sendto']) . '&period=' . $media['period'] . '&severity=' . $media['severity'] . '&active=' . $media['active'];
foreach (getSeverityCaption() as $key => $caption) {
$mediaActive = $media['severity'] & 1 << $key;
$mediaSeverity[$key] = new CSpan(mb_substr($caption, 0, 1), $mediaActive ? 'enabled' : null);
$mediaSeverity[$key]->setHint($caption . ($mediaActive ? ' (on)' : ' (off)'));
}
$mediaTableInfo->addRow(array(new CCheckBox('user_medias_to_del[' . $id . ']', null, null, $id), new CSpan($media['description'], 'nowrap'), new CSpan($media['sendto'], 'nowrap'), new CSpan($media['period'], 'nowrap'), $mediaSeverity, $status, new CButton('edit_media', _('Edit'), 'return PopUp("popup_media.php' . $mediaUrl . '", 550, 400);', 'link_menu')));
}
$userMediaFormList->addRow(_('Media'), array($mediaTableInfo, new CButton('add_media', _('Add'), 'return PopUp("popup_media.php?dstfrm=' . $userForm->getName() . '", 550, 400);', 'link_menu'), SPACE, SPACE, count($this->data['user_medias']) > 0 ? new CSubmit('del_user_media', _('Delete selected'), null, 'link_menu') : null));
}
/*
* Profile fields
*/
示例14: make_favorite_maps
function make_favorite_maps()
{
$favList = new CList(null, 'favorites', _('No maps added.'));
$fav_sysmaps = CFavorite::get('web.favorite.sysmapids');
if (!$fav_sysmaps) {
return $favList;
}
$sysmapids = array();
foreach ($fav_sysmaps as $favorite) {
$sysmapids[$favorite['value']] = $favorite['value'];
}
$sysmaps = API::Map()->get(array('sysmapids' => $sysmapids, 'output' => array('sysmapid', 'name')));
foreach ($sysmaps as $sysmap) {
$sysmapid = $sysmap['sysmapid'];
$link = new CLink(get_node_name_by_elid($sysmapid, null, NAME_DELIMITER) . $sysmap['name'], 'maps.php?sysmapid=' . $sysmapid);
$link->setTarget('blank');
$favList->addItem($link, 'nowrap');
}
return $favList;
}
示例15: dirname
**
** 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.
**/
include dirname(__FILE__) . '/js/configuration.services.child.list.js.php';
$servicesChildWidget = new CWidget();
$servicesChildWidget->addPageHeader(_('IT service dependencies'));
// create form
$servicesChildForm = new CForm();
$servicesChildForm->setName('servicesForm');
if (!empty($this->data['service'])) {
$servicesChildForm->addVar('serviceid', $this->data['service']['serviceid']);
}
// create table
$servicesChildTable = new CTableInfo(_('No IT services found.'));
$servicesChildTable->setHeader(array(new CCheckBox('all_services', null, "javascript: checkAll('" . $servicesChildForm->getName() . "', 'all_services', 'services');"), _('Service'), _('Status calculation'), _('Trigger')));
$prefix = null;
foreach ($this->data['db_cservices'] as $service) {
$description = new CLink($service['name'], '#', 'service-name');
$description->setAttributes(array('id' => 'service-name-' . $service['serviceid'], 'data-name' => $service['name'], 'data-serviceid' => $service['serviceid'], 'data-trigger' => $service['trigger']));
$cb = new CCheckBox('services[' . $service['serviceid'] . ']', null, null, $service['serviceid']);
$cb->addClass('service-select');
$servicesChildTable->addRow(array($cb, array($prefix, $description), serviceAlgorythm($service['algorithm']), $service['trigger']));
}
$servicesChildTable->setFooter(new CCol(new CButton('select', _('Select')), 'right'));
// append table to form
$servicesChildForm->addItem($servicesChildTable);
// append form to widget
$servicesChildWidget->addItem($servicesChildForm);
return $servicesChildWidget;