本文整理汇总了PHP中CCol::onClick方法的典型用法代码示例。如果您正苦于以下问题:PHP CCol::onClick方法的具体用法?PHP CCol::onClick怎么用?PHP CCol::onClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCol
的用法示例。
在下文中一共展示了CCol::onClick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_item_data_overview_cells
function get_item_data_overview_cells(&$table_row, &$ithosts, $hostname)
{
$css_class = '';
unset($it_ov_menu);
$value = '-';
$ack = null;
if (isset($ithosts[$hostname])) {
if ($ithosts[$hostname]['tr_value'] == TRIGGER_VALUE_TRUE) {
$css_class = getSeverityStyle($ithosts[$hostname]['severity']);
$ack = get_last_event_by_triggerid($ithosts[$hostname]['triggerid']);
$ack = $ack['acknowledged'] == 1 ? array(SPACE, new CImg('images/general/tick.png', 'ack')) : null;
}
$value = formatItemValue($ithosts[$hostname]);
$it_ov_menu = array(array(_('Values'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('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(_('Graphs'), null, null, array('outer' => array('pum_oheader'), 'inner' => array('pum_iheader'))), array(_('Last hour graph'), 'history.php?period=3600&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(_('Last week graph'), 'history.php?period=604800&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank')), array(_('Last month graph'), 'history.php?period=2678400&action=showgraph&itemid=' . $ithosts[$hostname]['itemid'], array('tw' => '_blank'))), $it_ov_menu);
break;
default:
break;
}
}
if ($value != '-') {
$value = new CSpan($value, 'link');
}
$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());
unset($it_ov_menu);
}
array_push($table_row, $value_col);
return $table_row;
}
示例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;
}