$delay = count_operations_delay($this->data['action']['operations'], $this->data['action']['esc_period']); } else { $operationsTable->setHeader(array(_('Details'), _('Action'))); } foreach ($this->data['action']['operations'] as $operationid => $operation) { if (!str_in_array($operation['operationtype'], $this->data['allowedOperations'])) { continue; } if (!isset($operation['opconditions'])) { $operation['opconditions'] = array(); } if (!isset($operation['mediatypeid'])) { $operation['mediatypeid'] = 0; } $details = new CSpan(get_operation_descr(SHORT_DESCRIPTION, $operation)); $details->setHint(get_operation_descr(LONG_DESCRIPTION, $operation)); if ($this->data['eventsource'] == EVENT_SOURCE_TRIGGERS || $this->data['eventsource'] == EVENT_SOURCE_INTERNAL) { $esc_steps_txt = null; $esc_period_txt = null; $esc_delay_txt = null; if ($operation['esc_step_from'] < 1) { $operation['esc_step_from'] = 1; } $esc_steps_txt = $operation['esc_step_from'] . ' - ' . $operation['esc_step_to']; // display N-N as N $esc_steps_txt = $operation['esc_step_from'] == $operation['esc_step_to'] ? $operation['esc_step_from'] : $operation['esc_step_from'] . ' - ' . $operation['esc_step_to']; $esc_period_txt = $operation['esc_period'] ? $operation['esc_period'] : _('Default'); $esc_delay_txt = $delay[$operation['esc_step_from']] ? convert_units(array('value' => $delay[$operation['esc_step_from']], 'units' => 'uptime')) : _('Immediately'); $operationRow = array($esc_steps_txt, $details, $esc_delay_txt, $esc_period_txt, array(new CSubmit('edit_operationid[' . $operationid . ']', _('Edit'), null, 'link_menu'), SPACE, SPACE, SPACE, array(new CButton('remove', _('Remove'), 'javascript: removeOperation(' . $operationid . ');', 'link_menu'), new CVar('operations[' . $operationid . ']', $operation)))); } else { $operationRow = array($details, array(new CSubmit('edit_operationid[' . $operationid . ']', _('Edit'), null, 'link_menu'), SPACE, SPACE, SPACE, array(new CButton('remove', _('Remove'), 'javascript: removeOperation(' . $operationid . ');', 'link_menu'), new CVar('operations[' . $operationid . ']', $operation))));
$actionForm = new CForm(); $actionForm->setName('actionForm'); // create table $actionTable = new CTableInfo(_('No actions found.')); $actionTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $actionForm->getName() . "', 'all_items', 'g_actionid');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Conditions'), _('Operations'), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder']))); foreach ($this->data['actions'] as $action) { $conditions = array(); order_result($action['filter']['conditions'], 'conditiontype', ZBX_SORT_DOWN); foreach ($action['filter']['conditions'] as $condition) { $conditions[] = get_condition_desc($condition['conditiontype'], $condition['operator'], $condition['value']); $conditions[] = BR(); } sortOperations($this->data['eventsource'], $action['operations']); $operations = array(); foreach ($action['operations'] as $operation) { $operations[] = get_operation_descr(SHORT_DESCRIPTION, $operation); } if ($action['status'] == ACTION_STATUS_DISABLED) { $status = new CLink(_('Disabled'), 'actionconf.php?action=action.massenable&g_actionid[]=' . $action['actionid'] . url_param('eventsource'), 'disabled'); } else { $status = new CLink(_('Enabled'), 'actionconf.php?action=action.massdisable&g_actionid[]=' . $action['actionid'] . url_param('eventsource'), 'enabled'); } $actionTable->addRow(array(new CCheckBox('g_actionid[' . $action['actionid'] . ']', null, null, $action['actionid']), new CLink($action['name'], 'actionconf.php?form=update&actionid=' . $action['actionid']), $conditions, new CCol($operations, 'wraptext'), $status)); } // create go buttons $goComboBox = new CComboBox('action'); $goOption = new CComboItem('action.massenable', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected actions?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('action.massdisable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected actions?'));