本文整理汇总了PHP中CCol::addAction方法的典型用法代码示例。如果您正苦于以下问题:PHP CCol::addAction方法的具体用法?PHP CCol::addAction怎么用?PHP CCol::addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCol
的用法示例。
在下文中一共展示了CCol::addAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zbx_construct_menu
/**
* NOTE - menu array format:
* first level:
* 'label' = main menu title.
* 'default_page_id = default page url from 'pages' then opened menu.
* 'pages' = collection of pages which are displayed from this menu.
* these pages are saved a last visited submenu of main menu.
*
* second level (pages):
* 'url' = real url for this page
* 'label' = submenu title, if missing, menu skipped, but remembered as last visited page.
* 'sub_pages' = collection of pages for displaying but not remembered as last visited.
*/
function zbx_construct_menu(&$main_menu, &$sub_menus, &$page)
{
global $ZBX_MENU;
$denied_page_requested = false;
$page_exists = false;
$deny = !defined('ZBX_PAGE_NO_AUTHORIZATION');
foreach ($ZBX_MENU as $label => $menu) {
$show_menu = true;
if (isset($menu['user_type'])) {
$show_menu &= $menu['user_type'] <= CWebUser::$data['type'];
}
if ($label == 'login') {
$show_menu = false;
}
$menu_class = 'horizontal_menu_n';
$sub_menus[$label] = array();
foreach ($menu['pages'] as $sub_page) {
$show_sub_menu = true;
// show check
if (!isset($sub_page['label'])) {
$show_sub_menu = false;
}
if (!isset($sub_page['user_type'])) {
$sub_page['user_type'] = $menu['user_type'];
}
if (CWebUser::$data['type'] < $sub_page['user_type']) {
$show_sub_menu = false;
}
$row = array('menu_text' => isset($sub_page['label']) ? $sub_page['label'] : '', 'menu_url' => $sub_page['url'], 'class' => 'highlight', 'selected' => false);
$sub_menu_active = $page['file'] == $sub_page['url'];
$sub_menu_active |= isset($sub_page['sub_pages']) && str_in_array($page['file'], $sub_page['sub_pages']);
if ($sub_menu_active) {
// permition check
$deny &= CWebUser::$data['type'] < $menu['user_type'] || CWebUser::$data['type'] < $sub_page['user_type'];
$menu_class = 'active';
$page_exists = true;
$page['menu'] = $label;
$row['selected'] = true;
if (!defined('ZBX_PAGE_NO_MENU')) {
CProfile::update('web.menu.' . $label . '.last', $sub_page['url'], PROFILE_TYPE_STR);
}
}
if ($show_sub_menu) {
$sub_menus[$label][] = $row;
}
}
if ($page_exists && !defined('ZBX_NOT_ALLOW_ALL_NODES') && (isset($menu['force_disable_all_nodes']) || isset($sub_page['force_disable_all_nodes']))) {
define('ZBX_NOT_ALLOW_ALL_NODES', 1);
}
if ($page_exists && $deny) {
$denied_page_requested = true;
}
if (!$show_menu) {
unset($sub_menus[$label]);
continue;
}
$menu_url = $sub_menus[$label][$menu['default_page_id']]['menu_url'];
$mmenu_entry = new CCol($menu['label'], $menu_class);
$mmenu_entry->setAttribute('id', $label);
$mmenu_entry->addAction('onclick', 'javascript: redirect(\'' . $menu_url . '\');');
$mmenu_entry->addAction('onmouseover', 'javascript: MMenu.mouseOver(\'' . $label . '\');');
$mmenu_entry->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
array_push($main_menu, $mmenu_entry);
}
if (!$page_exists && $page['type'] != PAGE_TYPE_XML && $page['type'] != PAGE_TYPE_CSV && $page['type'] != PAGE_TYPE_TEXT_FILE) {
$denied_page_requested = true;
}
return $denied_page_requested;
}
示例2: get_trigger_overview_cells
//.........这里部分代码省略.........
$ack = new CImg('images/general/tick.png', 'ack');
}
}
}
} else {
$css_class = 'normal';
}
$style = 'cursor: pointer; ';
// set blinking gif as background if trigger age is less then $config['blink_period']
if ($config['blink_period'] > 0 && time() - $triggerHosts[$hostName]['lastchange'] < $config['blink_period']) {
$style .= 'background-image: url(images/gradients/blink.gif); background-position: top left; background-repeat: repeat;';
}
unset($item_menu);
$tr_ov_menu = array(array(_('Trigger'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Events'), 'events.php?triggerid=' . $triggerHosts[$hostName]['triggerid'], array('tw' => '_blank')));
if (isset($ack_menu)) {
$tr_ov_menu[] = $ack_menu;
}
$dbItems = DBselect('SELECT DISTINCT i.itemid,i.name,i.key_,i.value_type' . ' FROM items i,functions f' . ' WHERE f.itemid=i.itemid' . ' AND f.triggerid=' . $triggerHosts[$hostName]['triggerid']);
while ($item = DBfetch($dbItems)) {
$description = itemName($item);
switch ($item['value_type']) {
case ITEM_VALUE_TYPE_UINT64:
case ITEM_VALUE_TYPE_FLOAT:
$action = 'showgraph';
$status_bar = _('Show graph of item') . ' \'' . $description . '\'';
break;
case ITEM_VALUE_TYPE_LOG:
case ITEM_VALUE_TYPE_STR:
case ITEM_VALUE_TYPE_TEXT:
default:
$action = 'showlatest';
$status_bar = _('Show values of item') . ' \'' . $description . '\'';
break;
}
if (zbx_strlen($description) > 25) {
$description = zbx_substr($description, 0, 22) . '...';
}
$item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar));
}
if (isset($item_menu['showgraph'])) {
$tr_ov_menu[] = array(_('Graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
$tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']);
}
if (isset($item_menu['showlatest'])) {
$tr_ov_menu[] = array(_('Values'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
$tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']);
}
unset($item_menu);
// dependency: triggers on which depends this
$triggerid = !empty($triggerHosts[$hostName]['triggerid']) ? $triggerHosts[$hostName]['triggerid'] : 0;
$dep_table = new CTableInfo();
$dep_table->setAttribute('style', 'width: 200px;');
$dep_table->addRow(bold(_('Depends on') . ':'));
$dependency = false;
$dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . $triggerid);
while ($dep_row = DBfetch($dep_res)) {
$dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_up']));
$dependency = true;
}
if ($dependency) {
$img = new Cimg('images/general/arrow_down2.png', 'DEP_DOWN');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->setHint($dep_table, '', '', false);
array_push($desc, $img);
}
unset($img, $dep_table, $dependency);
// triggers that depend on this
$dep_table = new CTableInfo();
$dep_table->setAttribute('style', 'width: 200px;');
$dep_table->addRow(bold(_('Dependent') . ':'));
$dependency = false;
$dep_res = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . $triggerid);
while ($dep_row = DBfetch($dep_res)) {
$dep_table->addRow(SPACE . '-' . SPACE . CTriggerHelper::expandDescriptionById($dep_row['triggerid_down']));
$dependency = true;
}
if ($dependency) {
$img = new Cimg('images/general/arrow_up2.png', 'DEP_UP');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->setHint($dep_table, '', '', false);
array_push($desc, $img);
}
unset($img, $dep_table, $dependency);
}
if (is_array($desc) && count($desc) > 0 || $ack) {
$tableColumn = new CCol(array($desc, $ack), $css_class . ' hosts');
} else {
$tableColumn = new CCol(SPACE, $css_class . ' hosts');
}
if (isset($style)) {
$tableColumn->setAttribute('style', $style);
}
if (isset($tr_ov_menu)) {
$tr_ov_menu = new CPUMenu($tr_ov_menu, 170);
$tableColumn->onClick($tr_ov_menu->getOnActionJS());
$tableColumn->addAction('onmouseover', 'jQuery(this).css({border: "1px dotted #0C0CF0", padding: "0 2px"})');
$tableColumn->addAction('onmouseout', 'jQuery(this).css({border: "", padding: "1px 3px"})');
}
return $tableColumn;
}
示例3: define
if ($page_exists && !defined('ZBX_DISABLE_SUBNODES') && (isset($menu['forse_disable_subnodes']) || isset($sub_page['forse_disable_subnodes']))) {
define('ZBX_DISABLE_SUBNODES', 1);
}
//SDI($label.' : '.$show_menu.' : '.$deny);
if ($page_exists && $deny) {
$denyed_page_requested = true;
}
if (!$show_menu) {
unset($sub_menus[$label]);
continue;
}
$menu_url = get_profile('web.menu.' . $label . '.last', false);
// if(ZBX_DISABLE_MENU_CACHE == 1) $menu_url = $menu['pages'][$sub_menus['default_page_id']]['url'];
$mmenu_entry = new CCol($menu['label'], $menu_class);
$mmenu_entry->addOption('id', $label);
$mmenu_entry->addAction('onclick', "javascript: location.href = '{$menu_url}';");
$mmenu_entry->addAction('onmouseover', 'javascript: MMenu.mouseOver("' . $label . '");');
$mmenu_entry->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
array_push($main_menu, $mmenu_entry);
}
if (!isset($page_exists) && $page['type'] != PAGE_TYPE_XML) {
$denyed_page_requested = true;
}
zbx_flush_post_cookies(isset($denyed_page_requested));
if ($page['type'] == PAGE_TYPE_HTML) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php
echo $page['title'];
示例4: zbx_construct_menu
function zbx_construct_menu(&$main_menu, &$sub_menus)
{
global $page, $ZBX_MENU, $USER_DETAILS;
$denyed_page_requested = false;
/* NOTE - menu array format:
first level:
'label' = main menu title.
'default_page_id = default page url from 'pages' then opened menu.
'pages' = collection of pages which are displayed from this menu.
these pages are saved a last visited submenu of main menu.
second level (pages):
'url' = real url for this page
'label' = submenu title, if missing, menu skipped, but remembered as last visited page.
'sub_pages' = collection of pages for displaying but not remembered as last visited.
*/
//SDI($USER_DETAILS);
$page_exists = false;
$deny = !defined('ZBX_PAGE_NO_AUTHERIZATION');
foreach ($ZBX_MENU as $label => $menu) {
// Check to show menu or not
$show_menu = true;
if (isset($menu['user_type'])) {
$show_menu &= $menu['user_type'] <= $USER_DETAILS['type'];
}
if ($label == 'login') {
$show_menu = false;
}
//---
$menu_class = 'horizontal_menu_n';
$sub_menus[$label] = array();
foreach ($menu['pages'] as $id => $sub_page) {
$show_sub_menu = true;
// show check
if (!isset($sub_page['label'])) {
$show_sub_menu = false;
}
if (isset($sub_page['user_type']) && $USER_DETAILS['type'] < $sub_page['user_type']) {
$show_sub_menu = false;
}
//----------
$row = array('menu_text' => isset($sub_page['label']) ? $sub_page['label'] : '', 'menu_url' => $sub_page['url'], 'class' => 'highlight', 'selected' => false);
$sub_menu_active = $page['file'] == $sub_page['url'];
$sub_menu_active |= isset($sub_page['sub_pages']) && str_in_array($page['file'], $sub_page['sub_pages']);
if ($sub_menu_active) {
// PERMISSION CHECK
$deny &= $USER_DETAILS['type'] < $menu['user_type'];
// END OF PERMISSION CHECK
$menu_class = 'active';
$page_exists = true;
$page['menu'] = $label;
$row['selected'] = true;
if (!defined('ZBX_PAGE_NO_MENU')) {
update_profile('web.menu.' . $label . '.last', $sub_page['url'], PROFILE_TYPE_STR);
}
}
if ($show_sub_menu) {
$sub_menus[$label][] = $row;
}
}
if ($page_exists && !defined('ZBX_NOT_ALLOW_ALL_NODES') && (isset($menu['forse_disable_all_nodes']) || isset($sub_page['forse_disable_all_nodes']))) {
define('ZBX_NOT_ALLOW_ALL_NODES', 1);
}
//SDI($label.' : '.$show_menu.' : '.$deny);
if ($page_exists && $deny) {
$denyed_page_requested = true;
}
if (!$show_menu) {
unset($sub_menus[$label]);
continue;
}
// $menu_url = get_profile('web.menu.'.$label.'.last',false);
$menu_url = $menu['pages'][$menu['default_page_id']]['url'];
$mmenu_entry = new CCol($menu['label'], $menu_class);
$mmenu_entry->setAttribute('id', $label);
$mmenu_entry->addAction('onclick', "javascript: redirect('{$menu_url}');");
$mmenu_entry->addAction('onmouseover', 'javascript: MMenu.mouseOver("' . $label . '");');
$mmenu_entry->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
array_push($main_menu, $mmenu_entry);
}
if (!$page_exists && $page['type'] != PAGE_TYPE_XML) {
$denyed_page_requested = true;
}
return $denyed_page_requested;
}
示例5: get_trigger_overview_cells
//.........这里部分代码省略.........
$style = 'cursor: pointer; ';
if (time(NULL) - $trhosts[$hostname]['lastchange'] < 300) {
$style .= 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;';
} else {
if (time(NULL) - $trhosts[$hostname]['lastchange'] < 900) {
$style .= 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; ' . 'background-repeat: repeat;';
}
}
unset($item_menu);
$tr_ov_menu = array(array(S_TRIGGER, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_EVENTS, 'events.php?triggerid=' . $trhosts[$hostname]['triggerid'], array('tw' => '_blank')));
if (isset($ack_menu)) {
$tr_ov_menu[] = $ack_menu;
}
$db_items = DBselect('select distinct i.itemid, i.description, i.key_, i.value_type ' . ' from items i, functions f ' . ' where f.itemid=i.itemid and f.triggerid=' . $trhosts[$hostname]['triggerid']);
while ($item_data = DBfetch($db_items)) {
$description = item_description($item_data);
switch ($item_data['value_type']) {
case ITEM_VALUE_TYPE_UINT64:
case ITEM_VALUE_TYPE_FLOAT:
$action = 'showgraph';
$status_bar = S_SHOW_GRAPH_OF_ITEM . ' \'' . $description . '\'';
break;
case ITEM_VALUE_TYPE_LOG:
case ITEM_VALUE_TYPE_STR:
case ITEM_VALUE_TYPE_TEXT:
default:
$action = 'showlatest';
$status_bar = S_SHOW_VALUES_OF_ITEM . ' \'' . $description . '\'';
break;
}
if (strlen($description) > 25) {
$description = substr($description, 0, 22) . '...';
}
$item_menu[$action][] = array($description, 'history.php?action=' . $action . '&itemid=' . $item_data['itemid'] . '&period=3600', array('tw' => '', 'sb' => $status_bar));
}
if (isset($item_menu['showgraph'])) {
$tr_ov_menu[] = array(S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
$tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showgraph']);
}
if (isset($item_menu['showlatest'])) {
$tr_ov_menu[] = array(S_VALUES, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader')));
$tr_ov_menu = array_merge($tr_ov_menu, $item_menu['showlatest']);
}
unset($item_menu);
}
// dependency
// TRIGGERS ON WHICH DEPENDS THIS
$desc = array();
if (isset($trhosts[$hostname])) {
$triggerid = $trhosts[$hostname]['triggerid'];
$dependency = false;
$dep_table = new CTableInfo();
$dep_table->setAttribute('style', 'width: 200px;');
$dep_table->addRow(bold(S_DEPENDS_ON . ':'));
$sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_down=' . $triggerid;
$dep_res = DBselect($sql_dep);
while ($dep_row = DBfetch($dep_res)) {
$dep_table->addRow(SPACE . '-' . SPACE . expand_trigger_description($dep_row['triggerid_up']));
$dependency = true;
}
if ($dependency) {
$img = new Cimg('images/general/down_icon.png', 'DEP_DOWN');
$img->setAttribute('style', 'vertical-align: middle; border: 0px;');
$img->SetHint($dep_table);
array_push($desc, $img);
}
unset($img, $dep_table, $dependency);
// TRIGGERS THAT DEPEND ON THIS
$dependency = false;
$dep_table = new CTableInfo();
$dep_table->setAttribute('style', 'width: 200px;');
$dep_table->addRow(bold(S_DEPENDENT . ':'));
$sql_dep = 'SELECT * FROM trigger_depends WHERE triggerid_up=' . $triggerid;
$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);
array_push($desc, $img);
}
unset($img, $dep_table, $dependency);
}
//------------------------
$status_col = new CCol(array($desc, $ack), $css_class);
if (isset($style)) {
$status_col->setAttribute('style', $style);
}
if (isset($tr_ov_menu)) {
$tr_ov_menu = new CPUMenu($tr_ov_menu, 170);
$status_col->OnClick($tr_ov_menu->GetOnActionJS());
$status_col->addAction('onmouseover', 'this.old_border=this.style.border; this.style.border=\'1px dotted #0C0CF0\'');
$status_col->addAction('onmouseout', 'this.style.border=this.old_border;');
}
array_push($table_row, $status_col);
return $table_row;
}