// create new operation table
if (!empty($this->data['new_operation'])) {
    $newOperationsTable = new CTable(null, 'formElementTable');
    $newOperationsTable->addItem(new CVar('new_operation[action]', $this->data['new_operation']['action']));
    if (isset($this->data['new_operation']['id'])) {
        $newOperationsTable->addItem(new CVar('new_operation[id]', $this->data['new_operation']['id']));
    }
    if (isset($this->data['new_operation']['operationid'])) {
        $newOperationsTable->addItem(new CVar('new_operation[operationid]', $this->data['new_operation']['operationid']));
    }
    if ($this->data['eventsource'] == EVENT_SOURCE_TRIGGERS || $this->data['eventsource'] == EVENT_SOURCE_INTERNAL) {
        $stepFrom = new CNumericBox('new_operation[esc_step_from]', $this->data['new_operation']['esc_step_from'], 5);
        $stepFrom->attr('size', 6);
        $stepFrom->addAction('onchange', 'javascript:' . $stepFrom->getAttribute('onchange') . ' if (this.value == 0) this.value = 1;');
        $stepTo = new CNumericBox('new_operation[esc_step_to]', $this->data['new_operation']['esc_step_to'], 5);
        $stepTo->attr('size', 6);
        $stepTable = new CTable();
        $stepTable->addRow(array(_('From'), $stepFrom), 'indent_both');
        $stepTable->addRow(array(_('To'), new CCol(array($stepTo, SPACE, _('(0 - infinitely)')))), 'indent_both');
        $stepTable->addRow(array(_('Step duration'), new CCol(array(new CNumericBox('new_operation[esc_period]', $this->data['new_operation']['esc_period'], 6), SPACE, _('(minimum 60 seconds, 0 - use action default)')))), 'indent_both');
        $newOperationsTable->addRow(array(_('Step'), $stepTable));
    }
    // if multiple operation types are available, display a select
    if (count($this->data['allowedOperations']) > 1) {
        $operationTypeComboBox = new CComboBox('new_operation[operationtype]', $this->data['new_operation']['operationtype'], 'submit()');
        foreach ($this->data['allowedOperations'] as $operation) {
            $operationTypeComboBox->addItem($operation, operation_type2str($operation));
        }
        $newOperationsTable->addRow(array(_('Operation type'), $operationTypeComboBox), 'indent_both');
    } else {
        $operation = $this->data['allowedOperations'][0];
Example #2
0
 function stage4()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $table->addRow(array(new CCol(_('Host'), 'header'), new CTextBox('zbx_server', $this->getConfig('ZBX_SERVER', 'localhost'))));
     $port = new CNumericBox('zbx_server_port', $this->getConfig('ZBX_SERVER_PORT', '10051'), 20, 'no', false, false);
     $port->attr('style', '');
     $table->addRow(array(new CCol(_('Port'), 'header'), $port));
     $table->addRow(array(new CCol(_('Name'), 'header'), new CTextBox('zbx_server_name', $this->getConfig('ZBX_SERVER_NAME', ''))));
     return array('Please enter host name or host IP address', BR(), 'and port number of Zabbix server,', BR(), 'as well as the name of the installation (optional).', BR(), BR(), $table);
 }
Example #3
0
/**
 * Create array with all inputs required for date selection and calendar.
 *
 * @param string      $name
 * @param int|array   $date unix timestamp/date array(Y,m,d,H,i)
 * @param string|null $relatedCalendar name of the calendar which must be closed when this calendar opens
 *
 * @return array
 */
function createDateSelector($name, $date, $relatedCalendar = null)
{
    $calendarIcon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
    $onClick = 'var pos = getPosition(this); pos.top += 10; pos.left += 16; CLNDR["' . $name . '_calendar"].clndr.clndrshow(pos.top, pos.left);';
    if ($relatedCalendar) {
        $onClick .= ' CLNDR["' . $relatedCalendar . '_calendar"].clndr.clndrhide();';
    }
    $calendarIcon->onClick($onClick);
    if (is_array($date)) {
        $y = $date['y'];
        $m = $date['m'];
        $d = $date['d'];
        $h = $date['h'];
        $i = $date['i'];
    } else {
        $y = date('Y', $date);
        $m = date('m', $date);
        $d = date('d', $date);
        $h = date('H', $date);
        $i = date('i', $date);
    }
    $day = new CNumericBox($name . '_day', $d, 2);
    $day->attr('placeholder', _('dd'));
    $month = new CNumericBox($name . '_month', $m, 2);
    $month->attr('placeholder', _('mm'));
    $year = new CNumericBox($name . '_year', $y, 4);
    $year->attr('placeholder', _('yyyy'));
    $hour = new CNumericBox($name . '_hour', $h, 2);
    $hour->attr('placeholder', _('hh'));
    $minute = new CNumericBox($name . '_minute', $i, 2);
    $minute->attr('placeholder', _('mm'));
    $fields = array($day, '/', $month, '/', $year, SPACE, $hour, ':', $minute, $calendarIcon);
    zbx_add_post_js('create_calendar(null,' . '["' . $name . '_day","' . $name . '_month","' . $name . '_year","' . $name . '_hour","' . $name . '_minute"],' . '"' . $name . '_calendar",' . '"' . $name . '");');
    return $fields;
}