本文整理汇总了PHP中CSpan::SetHint方法的典型用法代码示例。如果您正苦于以下问题:PHP CSpan::SetHint方法的具体用法?PHP CSpan::SetHint怎么用?PHP CSpan::SetHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSpan
的用法示例。
在下文中一共展示了CSpan::SetHint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_event_actions_stat_hints
function get_event_actions_stat_hints($eventid)
{
$actions = new CTable(' - ');
$sql = 'SELECT COUNT(a.alertid) as cnt ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')';
$alerts = DBfetch(DBselect($sql));
if (isset($alerts['cnt']) && $alerts['cnt'] > 0) {
$sql = 'SELECT COUNT(a.alertid) as sent ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_SENT;
$alerts = DBfetch(DBselect($sql));
$alert_cnt = new CSpan($alerts['sent'], 'green');
if ($alerts['sent']) {
$hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_SENT);
$alert_cnt->SetHint($hint);
}
$tdl = new CCol($alerts['sent'] ? $alert_cnt : SPACE);
$tdl->addOption('width', '10');
$sql = 'SELECT COUNT(a.alertid) as inprogress ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_NOT_SENT;
$alerts = DBfetch(DBselect($sql));
$alert_cnt = new CSpan($alerts['inprogress'], 'orange');
if ($alerts['inprogress']) {
$hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_NOT_SENT);
$alert_cnt->setHint($hint);
}
$tdc = new CCol($alerts['inprogress'] ? $alert_cnt : SPACE);
$tdc->addOption('width', '10');
$sql = 'SELECT COUNT(a.alertid) as failed ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_FAILED;
$alerts = DBfetch(DBselect($sql));
$alert_cnt = new CSpan($alerts['failed'], 'red');
if ($alerts['failed']) {
$hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_FAILED);
$alert_cnt->setHint($hint);
}
$tdr = new CCol($alerts['failed'] ? $alert_cnt : SPACE);
$tdr->addOption('width', '10');
$actions->addRow(array($tdl, $tdc, $tdr));
}
return $actions;
}
示例2: get_act_operations_form
function get_act_operations_form($action = null)
{
$tblOper = new CTableInfo(S_NO_OPERATIONS_DEFINED);
$tblOper->addOption('style', 'background-color: #CCC;');
if (isset($_REQUEST['actionid']) && empty($action)) {
$action = get_action_by_actionid($_REQUEST['actionid']);
}
$operations = get_request('operations', array());
if (isset($_REQUEST['actionid']) && !isset($_REQUEST['form_refresh'])) {
$eventsource = $action['eventsource'];
$evaltype = $action['evaltype'];
$esc_period = $action['esc_period'];
/* prepate operations */
$db_operations = DBselect('SELECT * ' . ' FROM operations' . ' WHERE actionid=' . $_REQUEST['actionid'] . ' ORDER BY esc_step_from,operationtype,object,operationid');
while ($operation_data = DBfetch($db_operations)) {
$operation_data = array('operationtype' => $operation_data['operationtype'], 'operationid' => $operation_data['operationid'], 'object' => $operation_data['object'], 'objectid' => $operation_data['objectid'], 'shortdata' => $operation_data['shortdata'], 'longdata' => $operation_data['longdata'], 'esc_period' => $operation_data['esc_period'], 'esc_step_from' => $operation_data['esc_step_from'], 'esc_step_to' => $operation_data['esc_step_to'], 'default_msg' => $operation_data['default_msg'], 'evaltype' => $operation_data['evaltype']);
$operation_data['opconditions'] = array();
$sql = 'SELECT * FROM opconditions WHERE operationid=' . $operation_data['operationid'];
$db_opconds = DBselect($sql);
while ($db_opcond = DBfetch($db_opconds)) {
$operation_data['opconditions'][] = $db_opcond;
}
if (str_in_array($operation_data, $operations)) {
continue;
}
array_push($operations, $operation_data);
}
unset($db_operations, $operation_data);
} else {
$eventsource = get_request('eventsource');
$evaltype = get_request('evaltype');
$esc_period = get_request('esc_period');
}
$esc_step_from = array();
foreach ($operations as $key => $operation) {
$esc_step_from[$key] = $operation['esc_step_from'];
}
array_multisort($esc_step_from, SORT_ASC, $operations);
$tblOper->SetHeader(array(new CCheckBox('all_operations', null, 'CheckAll("' . S_ACTION . '","all_operations","g_operationid");'), isset($_REQUEST['escalation']) ? S_STEPS : null, S_DETAILS, isset($_REQUEST['escalation']) ? S_PERIOD . ' (' . S_SEC_SMALL . ')' : null, isset($_REQUEST['escalation']) ? S_DELAY : null, S_ACTION));
$allowed_operations = get_operations_by_eventsource($eventsource);
zbx_rksort($operations);
$delay = count_operations_delay($operations, $esc_period);
foreach ($operations as $id => $val) {
if (!str_in_array($val['operationtype'], $allowed_operations)) {
continue;
}
if (!isset($val['default_msg'])) {
$val['default_msg'] = 0;
}
if (!isset($val['opconditions'])) {
$val['opconditions'] = array();
}
$oper_details = new CSpan(get_operation_desc(SHORT_DESCRITION, $val));
$oper_details->SetHint(nl2br(get_operation_desc(LONG_DESCRITION, $val)));
$esc_steps_txt = null;
$esc_period_txt = null;
$esc_delay_txt = null;
if ($val['esc_step_from'] < 1) {
$val['esc_step_from'] = 1;
}
if (isset($_REQUEST['escalation'])) {
$esc_steps_txt = $val['esc_step_from'] . ' - ' . $val['esc_step_to'];
$esc_period_txt = $val['esc_period'] ? $val['esc_period'] : S_DEFAULT;
$esc_delay_txt = $delay[$val['esc_step_from']] ? convert_units($delay[$val['esc_step_from']], 'uptime') : S_AT_MOMENT;
}
$tblOper->addRow(array(new CCheckBox("g_operationid[]", 'no', null, $id), $esc_steps_txt, $oper_details, $esc_period_txt, $esc_delay_txt, new CButton('edit_operationid[' . $id . ']', S_EDIT)));
$tblOper->addItem(new CVar('operations[' . $id . '][operationtype]', $val['operationtype']));
$tblOper->addItem(new CVar('operations[' . $id . '][object]', $val['object']));
$tblOper->addItem(new CVar('operations[' . $id . '][objectid]', $val['objectid']));
$tblOper->addItem(new CVar('operations[' . $id . '][shortdata]', $val['shortdata']));
$tblOper->addItem(new CVar('operations[' . $id . '][longdata]', $val['longdata']));
$tblOper->addItem(new CVar('operations[' . $id . '][esc_period]', $val['esc_period']));
$tblOper->addItem(new CVar('operations[' . $id . '][esc_step_from]', $val['esc_step_from']));
$tblOper->addItem(new CVar('operations[' . $id . '][esc_step_to]', $val['esc_step_to']));
$tblOper->addItem(new CVar('operations[' . $id . '][default_msg]', $val['default_msg']));
$tblOper->addItem(new CVar('operations[' . $id . '][evaltype]', $val['evaltype']));
foreach ($val['opconditions'] as $opcondid => $opcond) {
foreach ($opcond as $field => $value) {
$tblOper->addItem(new CVar('operations[' . $id . '][opconditions][' . $opcondid . '][' . $field . ']', $value));
}
}
}
unset($operations);
$tblOperFooter = new CTableInfo(null);
$oper_buttons = array();
if (!isset($_REQUEST['new_operation'])) {
$oper_buttons[] = new CButton('new_operation', S_NEW);
}
if ($tblOper->ItemsCount() > 0) {
$oper_buttons[] = new CButton('del_operation', S_DELETE_SELECTED);
}
$td = new CCol($oper_buttons);
$td->addOption('colspan', isset($_REQUEST['escalation']) ? 6 : 3);
$td->addOption('style', 'text-align: right;');
$tblOperFooter->SetFooter($td);
// end of condition list preparation
return array($tblOper, $tblOperFooter);
}