本文整理汇总了PHP中CCol::addClass方法的典型用法代码示例。如果您正苦于以下问题:PHP CCol::addClass方法的具体用法?PHP CCol::addClass怎么用?PHP CCol::addClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCol
的用法示例。
在下文中一共展示了CCol::addClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTriggerOverviewCells
/**
* Creates and returns a trigger status cell for the trigger overview table.
*
* @see getTriggersOverview()
*
* @param array $trigger
* @param string $pageFile the page where the element is displayed
* @param string $screenid
*
* @return CCol
*/
function getTriggerOverviewCells($trigger, $pageFile, $screenid = null)
{
$ack = null;
$css = null;
$desc = [];
$acknowledge = [];
// for how long triggers should blink on status change (set by user in administration->general)
$config = select_config();
if ($trigger) {
$css = getSeverityStyle($trigger['priority'], $trigger['value'] == TRIGGER_VALUE_TRUE);
// problem trigger
if ($trigger['value'] == TRIGGER_VALUE_TRUE) {
$ack = null;
if ($config['event_ack_enable']) {
if ($event = get_last_event_by_triggerid($trigger['triggerid'])) {
if ($screenid !== null) {
$acknowledge = ['eventid' => $event['eventid'], 'backurl' => $pageFile . '?screenid=' . $screenid];
} else {
$acknowledge = ['eventid' => $event['eventid'], 'backurl' => $pageFile];
}
if ($event['acknowledged'] == 1) {
$ack = (new CSpan())->addClass(ZBX_STYLE_ICON_ACKN);
}
}
}
}
// dependency: triggers on which depends this
$triggerId = empty($trigger['triggerid']) ? 0 : $trigger['triggerid'];
// trigger dependency DOWN
$dependencyTable = (new CTableInfo())->setAttribute('style', 'width: 200px;')->addRow(bold(_('Depends on') . ':'));
$isDependencyFound = false;
$dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . zbx_dbstr($triggerId));
while ($dbDependency = DBfetch($dbDependencies)) {
$dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_up']));
$isDependencyFound = true;
}
if ($isDependencyFound) {
$desc[] = (new CSpan())->addClass(ZBX_STYLE_ICON_DEPEND_DOWN)->setHint($dependencyTable, '', false);
}
// trigger dependency UP
$dependencyTable = (new CTableInfo())->setAttribute('style', 'width: 200px;')->addRow(bold(_('Dependent') . ':'));
$isDependencyFound = false;
$dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . zbx_dbstr($triggerId));
while ($dbDependency = DBfetch($dbDependencies)) {
$dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_down']));
$isDependencyFound = true;
}
if ($isDependencyFound) {
$desc[] = (new CSpan())->addClass(ZBX_STYLE_ICON_DEPEND_UP)->setHint($dependencyTable, '', false);
}
}
$column = new CCol([$desc, $ack]);
if ($css !== null) {
$column->addClass($css)->addClass(ZBX_STYLE_CURSOR_POINTER);
}
if ($trigger && $config['blink_period'] > 0 && time() - $trigger['lastchange'] < $config['blink_period']) {
$column->addClass('blink');
$column->setAttribute('data-toggle-class', $css);
}
if ($trigger) {
$column->setMenuPopup(CMenuPopupHelper::getTrigger($trigger, $acknowledge));
}
return $column;
}