本文整理汇总了PHP中CCol::OnClick方法的典型用法代码示例。如果您正苦于以下问题:PHP CCol::OnClick方法的具体用法?PHP CCol::OnClick怎么用?PHP CCol::OnClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCol
的用法示例。
在下文中一共展示了CCol::OnClick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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->AddOption('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->AddOption('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->AddOption('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->AddOption('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->AddOption('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;
}
示例2: get_item_data_overview_cells
function get_item_data_overview_cells(&$table_row, &$ithosts, $hostname)
{
$css_class = NULL;
unset($it_ov_menu);
$value = '-';
$ack = null;
if (isset($ithosts[$hostname])) {
if ($ithosts[$hostname]['tr_value'] == TRIGGER_VALUE_TRUE) {
$css_class = get_severity_style($ithosts[$hostname]['severity']);
$ack = get_last_event_by_triggerid($ithosts[$hostname]['triggerid']);
if (1 == $ack['acknowledged']) {
$ack = array(SPACE, new CImg('images/general/tick.png', 'ack'));
} else {
$ack = null;
}
}
$value = format_lastvalue($ithosts[$hostname]);
$it_ov_menu = array(array(S_VALUES, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_500_LATEST_VALUES, 'history.php?action=showlatest&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')));
switch ($ithosts[$hostname]['value_type']) {
case ITEM_VALUE_TYPE_UINT64:
case ITEM_VALUE_TYPE_FLOAT:
$it_ov_menu = array_merge(array(array(S_GRAPHS, null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(S_LAST_HOUR_GRAPH, 'history.php?period=3600&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(S_LAST_WEEK_GRAPH, 'history.php?period=604800&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(S_LAST_MONTH_GRAPH, 'history.php?period=2678400&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank'))), $it_ov_menu);
break;
default:
break;
}
}
// if($value == '-') $css_class = 'center';
$value_col = new CCol(array($value, $ack), $css_class);
if (isset($it_ov_menu)) {
$it_ov_menu = new CPUMenu($it_ov_menu, 170);
$value_col->OnClick($it_ov_menu->GetOnActionJS());
$value_col->AddOption('style', 'cursor: pointer;');
$value_col->AddAction('onmouseover', 'this.old_border=this.style.border; this.style.border=\'1px dotted #0C0CF0\'');
$value_col->AddAction('onmouseout', 'this.style.border=this.old_border;');
unset($it_ov_menu);
}
array_push($table_row, $value_col);
return $table_row;
}