本文整理汇总了PHP中CTable::addRow方法的典型用法代码示例。如果您正苦于以下问题:PHP CTable::addRow方法的具体用法?PHP CTable::addRow怎么用?PHP CTable::addRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTable
的用法示例。
在下文中一共展示了CTable::addRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDoubleHeader
public function setDoubleHeader($left, $right)
{
$table = new CTable();
$table->addStyle('width: 100%;');
$lCol = new CCol($left);
$lCol->addStyle('text-align: left; border: 0;');
$rCol = new CCol($right);
$rCol->addStyle('text-align: right; border: 0;');
$table->addRow(array($lCol, $rCol));
$this->_header = new CDiv(null, 'nowrap ui-corner-all ui-widget-header ' . $this->css_class);
$this->_header->addItem($table);
return $this->_header;
}
示例2: get
public function get($caption_l = null, $caption_r = null)
{
if (empty($caption_l)) {
$caption_l = _('In');
}
if (empty($caption_r)) {
$caption_r = _('Other');
}
$grp_tab = new CTable();
$grp_tab->attr('name', $this->name);
$grp_tab->attr('id', zbx_formatDomId($this->name));
$grp_tab->setCellSpacing(0);
$grp_tab->setCellPadding(0);
if (!is_null($caption_l) || !is_null($caption_r)) {
$grp_tab->addRow(array($caption_l, SPACE, $caption_r));
}
$add_btn = new CButton('add', ' « ', null, 'formlist');
$add_btn->setAttribute('onclick', 'javascript: moveListBoxSelectedItem("' . $this->form->getName() . '", "' . $this->varname . '", "' . $this->id_r . '", "' . $this->id_l . '", "add");');
$rmv_btn = new CButton('remove', ' » ', null, 'formlist');
$rmv_btn->setAttribute('onclick', 'javascript: moveListBoxSelectedItem("' . $this->form->getName() . '", "' . $this->varname . '", "' . $this->id_l . '", "' . $this->id_r . '", "rmv");');
$grp_tab->addRow(array($this->lbox, new CCol(array($add_btn, BR(), $rmv_btn), 'top'), $this->rbox));
return $grp_tab;
}
示例3: makeRow
private function makeRow($id)
{
$table = new CTable();
$tr = $this->makeSImgStr($id);
$tr->addItem($this->tree[$id]['caption']);
$table->addRow($tr);
$tr = new CRow();
$tr->addItem($table);
$tr->setAttribute('id', 'id_' . $id);
$tr->setAttribute('style', $this->tree[$id]['parentid'] != '0' ? 'display: none;' : '');
foreach ($this->fields as $value) {
$tr->addItem($this->makeCol($id, $value));
}
return $tr;
}
示例4: get
public function get($caption_l = S_IN, $caption_r = S_OTHER)
{
$grp_tab = new CTable();
$grp_tab->addOption('name', $this->name);
$grp_tab->addOption('id', $this->name);
$grp_tab->setCellSpacing(0);
$grp_tab->setCellPadding(0);
if (!is_null($caption_l) || !is_null($caption_r)) {
$grp_tab->addRow(array($caption_l, SPACE, $caption_r));
}
$add_btn = new CButton('add', ' « ');
//S_ADD);//
$add_btn->setType('button');
$add_btn->setAction('javascript: moveListBoxSelectedItem("' . $this->form->GetName() . '","' . $this->varname . '","' . $this->id_r . '","' . $this->id_l . '","add");');
$rmv_btn = new CButton('remove', ' » ');
//S_REMOVE);//
$rmv_btn->setType('button');
$rmv_btn->setAction('javascript: moveListBoxSelectedItem("' . $this->form->GetName() . '","' . $this->varname . '","' . $this->id_l . '","' . $this->id_r . '","rmv");');
$grp_tab->addRow(array($this->lbox, new CCol(array($add_btn, BR(), $rmv_btn), 'top'), $this->rbox));
return $grp_tab;
}
示例5: makeRow
private function makeRow($id)
{
$table = new CTable();
$tr = $this->makeSImgStr($id);
$tr->addItem($this->tree[$id]['caption']);
$table->addRow($tr);
$tr = new CRow();
$tr->addItem($table);
$tr->setAttribute('id', 'id_' . $id);
$tr->setAttribute('style', $this->tree[$id]['parentid'] != '0' ? 'display: none;' : '');
foreach ($this->fields as $key => $value) {
$style = null;
if ($value == 'status' && $this->tree[$id]['serviceid'] > 0) {
switch ($this->tree[$id][$value]) {
case TRIGGER_SEVERITY_DISASTER:
$this->tree[$id][$value] = S_DISASTER;
$style = 'disaster';
break;
case TRIGGER_SEVERITY_HIGH:
$this->tree[$id][$value] = S_HIGH;
$style = 'high';
break;
case TRIGGER_SEVERITY_AVERAGE:
$this->tree[$id][$value] = S_AVERAGE;
$style = 'average';
break;
case TRIGGER_SEVERITY_WARNING:
$this->tree[$id][$value] = S_WARNING;
$style = 'warning';
break;
case TRIGGER_SEVERITY_INFORMATION:
default:
$this->tree[$id][$value] = new CSpan(S_OK_BIG, 'green');
break;
}
}
$tr->addItem(new CCol($this->tree[$id][$value], $style));
}
return $tr;
}
示例6: dirname
require_once dirname(__FILE__) . '/include/services.inc.php';
$page['title'] = _('IT services');
$page['file'] = 'srv_status.php';
$page['hist_arg'] = array();
define('ZBX_PAGE_DO_REFRESH', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
$periods = array('today' => _('Today'), 'week' => _('This week'), 'month' => _('This month'), 'year' => _('This year'), 24 => _('Last 24 hours'), 24 * 7 => _('Last 7 days'), 24 * 30 => _('Last 30 days'), 24 * DAY_IN_YEAR => _('Last 365 days'));
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('serviceid' => array(T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, null), 'showgraph' => array(T_ZBX_INT, O_OPT, P_SYS, IN('1'), 'isset({serviceid})'), 'period' => array(T_ZBX_STR, O_OPT, P_SYS, IN('"' . implode('","', array_keys($periods)) . '"'), null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null));
check_fields($fields);
if (isset($_REQUEST['serviceid']) && isset($_REQUEST['showgraph'])) {
$service = API::Service()->get(array('output' => array('serviceid'), 'serviceids' => getRequest('serviceid')));
$service = reset($service);
if ($service) {
$table = new CTable(null, 'chart');
$table->addRow(new CImg('chart5.php?serviceid=' . $service['serviceid'] . url_param('path')));
$table->show();
} else {
access_deny();
}
} else {
$period = getRequest('period', 7 * 24);
$period_end = time();
switch ($period) {
case 'today':
$period_start = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
break;
case 'week':
$period_start = strtotime('last sunday');
break;
case 'month':
示例7: foreach
$dependenciesTable->setHeader(array(_('Name'), _('Action')));
foreach ($this->data['dependencies'] as $dependency) {
$triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']);
$hostNames = array();
foreach ($dependency['hosts'] as $host) {
$hostNames[] = CHtml::encode($host['name']);
$hostNames[] = ', ';
}
array_pop($hostNames);
if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
$description = new CLink(array($hostNames, NAME_DELIMITER, CHtml::encode($dependency['description'])), 'triggers.php?form=update&hostid=' . $dependency['hostid'] . '&triggerid=' . $dependency['triggerid']);
$description->setAttribute('target', '_blank');
} else {
$description = array($hostNames, NAME_DELIMITER, $dependency['description']);
}
$row = new CRow(array($description, new CButton('remove', _('Remove'), 'javascript: removeDependency(\'' . $dependency['triggerid'] . '\');', 'link_menu')));
$row->setAttribute('id', 'dependency_' . $dependency['triggerid']);
$dependenciesTable->addRow($row);
}
$dependenciesDiv = new CDiv(array($dependenciesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?' . 'dstfrm=massupdate' . '&dstact=add_dependency' . '&reference=deptrigger' . '&dstfld1=new_dependency' . '&srctbl=triggers' . '&objname=triggers' . '&srcfld1=triggerid' . '&multiselect=1' . '&with_triggers=1", 1000, 700);', 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all');
$dependenciesDiv->setAttribute('id', 'dependencies_div');
$triggersFormList->addRow(array(_('Replace dependencies'), SPACE, new CVisibilityBox('visible[dependencies]', isset($this->data['visible']['dependencies']), 'dependencies_div', _('Original'))), $dependenciesDiv);
}
// append tabs to form
$triggersTab = new CTabView();
$triggersTab->addTab('triggersTab', _('Mass update'), $triggersFormList);
$triggersForm->addItem($triggersTab);
// append buttons to form
$triggersForm->addItem(makeFormFooter(new CSubmit('massupdate', _('Update')), new CButtonCancel(url_params(array('groupid', 'hostid', 'parent_discoveryid')))));
$triggersWidget->addItem($triggersForm);
return $triggersWidget;
示例8: evalExpressionData
$res_table->setOddRowClass('even_row');
$res_table->setEvenRowClass('even_row');
$res_table->setHeader(array(_('Expression'), _('Result')));
ksort($rplcts, SORT_NUMERIC);
foreach ($eHTMLTree as $e) {
$result = '-';
if ($allowedTesting && $test && isset($e['expression'])) {
$result = evalExpressionData($e['expression']['value'], $macrosData, $octet);
}
$style = 'text-align: center;';
if ($result != '-') {
$style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
if ($allowedTesting && $test) {
$result = evalExpressionData($expression, $macrosData, $octet);
}
$style = 'text-align: center;';
if ($result != '-') {
$style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->setFooter(array($outline, $col), $res_table->headerClass);
$frm_test->addRow(_('Result'), $res_table);
// action buttons
$btn_test = new CSubmit('test_expression', _('Test'));
示例9: count
$groups_count = CHostGroup::get($params);
$overalCount = $groups_count['rowscount'];
$viewCount = count($hostGroups);
$header = array(is_show_all_nodes() ? new CCol(S_NODE) : null, new CCol(S_HOST_GROUP), new CCol(S_LATEST_DATA), new CCol(S_TRIGGERS), new CCol(S_EVENTS), $admin ? new CCol(S_EDIT) : null);
$table = new CTableInfo();
$table->setHeader($header);
foreach ($hostGroups as $num => $group) {
$hostgroupid = $group['groupid'];
$caption = make_decoration($group['name'], $search);
$admin_link = $admin ? new CLink(S_GO, 'hosts.php?config=1&groupid=' . $hostgroupid . '&hostid=0') : null;
$table->addRow(array(get_node_name_by_elid($hostgroupid), $caption, new CLink(S_GO, 'latest.php?groupid=' . $hostgroupid . '&hostid=0'), new CLink(S_GO, 'tr_status.php?groupid=' . $hostgroupid . '&hostid=0'), new CLink(S_GO, 'events.php?groupid=' . $hostgroupid . '&hostid=0'), $admin_link));
}
$table->setFooter(new CCol(S_DISPLAYING . SPACE . $viewCount . SPACE . S_OF_SMALL . SPACE . $overalCount . SPACE . S_FOUND_SMALL));
$wdgt_hgroups = new CWidget('search_hostgroup', $table);
$wdgt_hgroups->addHeader(S_HOST_GROUPS, SPACE);
$right_tab->addRow($wdgt_hgroups);
//----------------
// FIND Templates
if ($admin) {
$params = array('nodeid' => get_current_nodeid(), 'extendoutput' => 1, 'pattern' => $search, 'limit' => $rows_per_page, 'order' => 'host', 'editable' => 1);
$db_templates = CTemplate::get($params);
$templates = selectByPattern($db_templates, 'host', $search, $rows_per_page);
$templateids = array_keys($templates);
$hostsgroups = array();
$sql = 'SELECT * FROM hosts_groups hg WHERE ' . DBcondition('hg.hostid', $templateids);
$res = DBselect($sql);
while ($templategroup = DBfetch($res)) {
$hostsgroups[$templategroup['hostid']] = $templategroup['groupid'];
}
$params = array('nodeids' => get_current_nodeid(), 'pattern' => $search, 'count' => 1, 'editable' => 1);
$hosts_count = CTemplate::get($params);
示例10: foreach
foreach ($allowedOpConditions as $opcondition) {
$conditionTypeComboBox->addItem($opcondition, condition_type2str($opcondition));
}
array_push($rowCondition, $conditionTypeComboBox);
$operationConditionComboBox = new CComboBox('new_opcondition[operator]');
foreach (get_operators_by_conditiontype($new_opcondition['conditiontype']) as $operationCondition) {
$operationConditionComboBox->addItem($operationCondition, condition_operator2str($operationCondition));
}
array_push($rowCondition, $operationConditionComboBox);
if ($new_opcondition['conditiontype'] == CONDITION_TYPE_EVENT_ACKNOWLEDGED) {
$operationConditionValueComboBox = new CComboBox('new_opcondition[value]', $new_opcondition['value']);
$operationConditionValueComboBox->addItem(0, _('Not Ack'));
$operationConditionValueComboBox->addItem(1, _('Ack'));
$rowCondition[] = $operationConditionValueComboBox;
}
$newOperationConditionTable->addRow($rowCondition);
$newOperationConditionFooter = array(new CSubmit('add_opcondition', _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_opcondition', _('Cancel'), null, 'link_menu'));
$newOperationsTable->addRow(array(_('Operation condition'), new CDiv(array($newOperationConditionTable, $newOperationConditionFooter), 'objectgroup inlineblock border_dotted ui-corner-all')));
}
$footer = array(new CSubmit('add_operation', $this->data['new_operation']['action'] == 'update' ? _('Update') : _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_operation', _('Cancel'), null, 'link_menu'));
$operationFormList->addRow(_('Operation details'), new CDiv(array($newOperationsTable, $footer), 'objectgroup inlineblock border_dotted ui-corner-all'));
}
// append tabs to form
$actionTabs = new CTabView();
if (!isset($_REQUEST['form_refresh'])) {
$actionTabs->setSelected(0);
}
$actionTabs->addTab('actionTab', _('Action'), $actionFormList);
$actionTabs->addTab('conditionTab', _('Conditions'), $conditionFormList);
$actionTabs->addTab('operationTab', _('Operations'), $operationFormList);
$actionForm->addItem($actionTabs);
示例11: CDiv
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
//-------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->addOption('border', 0);
$left_tab->addRow(create_hat(S_EVENT . SPACE . S_SOURCE . SPACE . S_DETAILS, make_trigger_details($_REQUEST['triggerid'], $trigger_data), null, 'hat_triggerdetails'));
$left_tab->addRow(create_hat(S_EVENT_DETAILS, make_event_details($_REQUEST['eventid']), null, 'hat_eventdetails'));
$right_tab = new CTable();
$right_tab->setCellPadding(3);
$right_tab->setCellSpacing(3);
$right_tab->addOption('border', 0);
$right_tab->addRow(create_hat(S_ACKNOWLEDGES, make_acktab_by_eventid($_REQUEST['eventid']), null, 'hat_eventack', get_profile('web.tr_events.hats.hat_eventack.state', 1)));
$right_tab->addRow(create_hat(S_MESSAGE_ACTIONS, get_action_msgs_for_event($_REQUEST['eventid']), null, 'hat_eventactionmsgs', get_profile('web.tr_events.hats.hat_eventactionmsgs.state', 1)));
$right_tab->addRow(create_hat(S_COMMAND_ACTIONS, get_action_cmds_for_event($_REQUEST['eventid']), null, 'hat_eventactioncmds', get_profile('web.tr_events.hats.hat_eventactioncmds.state', 1)));
$right_tab->addRow(create_hat(S_EVENTS . SPACE . S_LIST . SPACE . '[' . S_LAST . ' 20]', make_small_eventlist($_REQUEST['triggerid'], $trigger_data), null, 'hat_eventlist', get_profile('web.tr_events.hats.hat_eventlist.state', 1)));
$td_l = new CCol($left_tab);
$td_l->addOption('valign', 'top');
$td_r = new CCol($right_tab);
$td_r->addOption('valign', 'top');
$outer_table = new CTable();
$outer_table->addOption('border', 0);
$outer_table->setCellPadding(1);
$outer_table->setCellSpacing(1);
$outer_table->addRow(array($td_l, $td_r));
$p_elements[] = $outer_table;
$latest_hat = create_hat($text, $p_elements, array($fs_icon), 'hat_tr_events', get_profile('web.tr_events.hats.hat_tr_events.state', 1));
$latest_hat->show();
include_once 'include/page_footer.php';
示例12: array
CArrayHelper::sort($linkedTemplates, array('name'));
// templates for normal hosts
if (!$isDiscovered) {
$linkedTemplateTable->setHeader(array(_('Name'), _('Action')));
$ignoredTemplates = array();
foreach ($linkedTemplates as $template) {
$tmplList->addVar('templates[]', $template['templateid']);
$linkedTemplateTable->addRow(array($template['name'], array(new CSubmit('unlink[' . $template['templateid'] . ']', _('Unlink'), null, 'link_menu'), SPACE, SPACE, isset($original_templates[$template['templateid']]) ? new CSubmit('unlink_and_clear[' . $template['templateid'] . ']', _('Unlink and clear'), null, 'link_menu') : SPACE)), null, 'conditions_' . $template['templateid']);
$ignoredTemplates[$template['templateid']] = $template['name'];
}
$tmplList->addRow(_('Linked templates'), new CDiv($linkedTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// create new linked template table
$newTemplateTable = new CTable(null, 'formElementTable');
$newTemplateTable->attr('id', 'newTemplateTable');
$newTemplateTable->attr('style', 'min-width: 400px;');
$newTemplateTable->addRow(array(new CMultiSelect(array('name' => 'add_templates[]', 'objectName' => 'templates', 'ignored' => $ignoredTemplates))));
$newTemplateTable->addRow(array(new CSubmit('add_template', _('Add'), null, 'link_menu')));
$tmplList->addRow(_('Link new templates'), new CDiv($newTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
} else {
$linkedTemplateTable->setHeader(array(_('Name')));
foreach ($linkedTemplates as $template) {
$linkedTemplateTable->addRow(array($template['name']), null, 'conditions_' . $template['templateid']);
}
$tmplList->addRow(_('Linked templates'), new CDiv($linkedTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
}
$divTabs->addTab('templateTab', _('Templates'), $tmplList);
/*
* IPMI
*/
$ipmiList = new CFormList('ipmilist');
// normal hosts
示例13: bodyToString
public function bodyToString()
{
$res = parent::bodyToString();
$tbl = new CTable(null, $this->tableclass);
$tbl->setCellSpacing(0);
$tbl->setCellPadding(1);
$tbl->setAlign($this->align);
// add first row
if (!is_null($this->title)) {
$col = new CCol(null, 'form_row_first');
$col->setColSpan(2);
if (isset($this->help)) {
$col->addItem($this->help);
}
if (isset($this->title)) {
$col->addItem($this->title);
}
$tbl->setHeader($col);
}
// add last row
$tbl->setFooter($this->bottom_items);
// add center rows
foreach ($this->center_items as $item) {
$tbl->addRow($item);
}
return $res . $tbl->toString();
}
示例14: CVisibilityBox
$frmPd->addVar('config', $config);
$frmPd->addVar('report_timesince', $report_timesince);
$frmPd->addVar('report_timetill', $report_timetill);
if (isset($_REQUEST['period_id'])) {
$frmPd->addVar('period_id', $_REQUEST['period_id']);
}
$frmPd->addRow(array(new CVisibilityBox('caption_visible', !zbx_empty($caption), 'caption', S_DEFAULT), S_CAPTION), new CTextBox('caption', $caption, 10));
// $frmPd->addRow(S_CAPTION, new CTextBox('caption',$caption,10));
//*
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_since'].clndr.clndrshow(pos.top,pos.left);");
$reporttimetab = new CTable(null, 'calendar');
$reporttimetab->setAttribute('width', '10%');
$reporttimetab->setCellPadding(0);
$reporttimetab->setCellSpacing(0);
$reporttimetab->addRow(array(S_FROM, new CNumericBox('report_since_day', $report_timesince > 0 ? date('d', $report_timesince) : '', 2), '/', new CNumericBox('report_since_month', $report_timesince > 0 ? date('m', $report_timesince) : '', 2), '/', new CNumericBox('report_since_year', $report_timesince > 0 ? date('Y', $report_timesince) : '', 4), SPACE, new CNumericBox('report_since_hour', $report_timesince > 0 ? date('H', $report_timesince) : '', 2), ':', new CNumericBox('report_since_minute', $report_timesince > 0 ? date('i', $report_timesince) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,' . '["report_since_day","report_since_month","report_since_year","report_since_hour","report_since_minute"],' . '"avail_report_since",' . '"report_timesince");');
$clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_till'].clndr.clndrshow(pos.top,pos.left);");
$reporttimetab->addRow(array(S_TILL, new CNumericBox('report_till_day', $report_timetill > 0 ? date('d', $report_timetill) : '', 2), '/', new CNumericBox('report_till_month', $report_timetill > 0 ? date('m', $report_timetill) : '', 2), '/', new CNumericBox('report_till_year', $report_timetill > 0 ? date('Y', $report_timetill) : '', 4), SPACE, new CNumericBox('report_till_hour', $report_timetill > 0 ? date('H', $report_timetill) : '', 2), ':', new CNumericBox('report_till_minute', $report_timetill > 0 ? date('i', $report_timetill) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,' . '["report_till_day","report_till_month","report_till_year","report_till_hour","report_till_minute"],' . '"avail_report_till",' . '"report_timetill");');
$frmPd->addRow(S_PERIOD, $reporttimetab);
//*/
if ($config != 1) {
$frmPd->addRow(S_COLOR, new CColor('color', $color));
} else {
$frmPd->addVar('color', $color);
}
$frmPd->addItemToBottomRow(new CButton('save', isset($_REQUEST['period_id']) ? S_UPDATE : S_ADD));
$frmPd->addItemToBottomRow(new CButtonCancel(null, 'close_window();'));
$frmPd->Show();
}
示例15: 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;
}