Ejemplo n.º 1
0
 public function __construct($name, $value)
 {
     parent::__construct();
     $txt = new CTextBox($name, $value);
     $txt->addStyle('width: 6em;');
     $txt->attr('maxlength', 6);
     $txt->attr('id', zbx_formatDomId($name));
     $txt->addAction('onchange', 'set_color_by_name("' . $name . '", this.value)');
     $txt->addStyle('style', 'margin-top: 0px; margin-bottom: 0px;');
     $lbl = new CColorCell('lbl_' . $name, $value, 'javascript: show_color_picker("' . $name . '")');
     $this->addItem(array($txt, $lbl));
     insert_show_color_picker_javascript();
 }
Ejemplo n.º 2
0
 function stage3()
 {
     $table = new CTable(null, 'requirements');
     $table->setAlign('center');
     $DB['TYPE'] = $this->getConfig('DB_TYPE');
     $cmbType = new CComboBox('type', $DB['TYPE'], 'this.form.submit();');
     $frontendSetup = new FrontendSetup();
     $databases = $frontendSetup->getSupportedDatabases();
     foreach ($databases as $id => $name) {
         $cmbType->addItem($id, $name);
     }
     $table->addRow(array(new CCol(_('Database type'), 'header'), $cmbType));
     switch ($DB['TYPE']) {
         case ZBX_DB_SQLITE3:
             $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix'));
             $database->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database file'), 'header'), $database));
             break;
         default:
             $server = new CTextBox('server', $this->getConfig('DB_SERVER', 'localhost'));
             $server->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database host'), 'header'), $server));
             $port = new CNumericBox('port', $this->getConfig('DB_PORT', '0'), 5, 'no', false, false);
             $port->attr('style', '');
             $port->attr('onchange', "disableSetupStepButton('#next_2'); validateNumericBox(this, 'false', 'false');");
             $table->addRow(array(new CCol(_('Database port'), 'header'), array($port, ' 0 - use default port')));
             $database = new CTextBox('database', $this->getConfig('DB_DATABASE', 'zabbix'));
             $database->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Database name'), 'header'), $database));
             if ($DB['TYPE'] == ZBX_DB_DB2) {
                 $schema = new CTextBox('schema', $this->getConfig('DB_SCHEMA', ''));
                 $schema->attr('onchange', "disableSetupStepButton('#next_2')");
                 $table->addRow(array(new CCol(_('Database schema'), 'header'), $schema));
             }
             $user = new CTextBox('user', $this->getConfig('DB_USER', 'root'));
             $user->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('User'), 'header'), $user));
             $password = new CPassBox('password', $this->getConfig('DB_PASSWORD', ''));
             $password->attr('onchange', "disableSetupStepButton('#next_2')");
             $table->addRow(array(new CCol(_('Password'), 'header'), $password));
             break;
     }
     global $ZBX_MESSAGES;
     if (!empty($ZBX_MESSAGES)) {
         $lst_error = new CList(null, 'messages');
         foreach ($ZBX_MESSAGES as $msg) {
             $lst_error->addItem($msg['message'], $msg['type']);
         }
         $table = array($table, $lst_error);
     }
     return array(new CDiv(new CDiv(array('Please create database manually, and set the configuration parameters for connection to this database.', BR(), BR(), 'Press "Test connection" button when done.', BR(), $table), 'vertical_center'), 'table_wraper'), new CDiv(array(isset($_REQUEST['retry']) ? !$this->DISABLE_NEXT_BUTTON ? new CSpan(array(_('OK'), BR()), 'ok') : new CSpan(array(_('Fail'), BR()), 'fail') : null, new CSubmit('retry', 'Test connection')), 'info_bar'));
 }
Ejemplo n.º 3
0
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$proxyWidget = new CWidget();
$proxyWidget->addPageHeader(_('CONFIGURATION OF PROXIES'));
// create form
$proxyForm = new CForm();
$proxyForm->setName('proxyForm');
$proxyForm->addVar('form', $this->data['form']);
$proxyForm->addVar('form_refresh', $this->data['form_refresh']);
if (!empty($this->data['proxyid'])) {
    $proxyForm->addVar('proxyid', $this->data['proxyid']);
}
// create form list
$proxyFormList = new CFormList('proxyFormList');
$nameTextBox = new CTextBox('host', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64);
$nameTextBox->attr('autofocus', 'autofocus');
$proxyFormList->addRow(_('Proxy name'), $nameTextBox);
// append status to form list
$statusBox = new CComboBox('status', $this->data['status'], 'submit()');
$statusBox->addItem(HOST_STATUS_PROXY_ACTIVE, _('Active'));
$statusBox->addItem(HOST_STATUS_PROXY_PASSIVE, _('Passive'));
$proxyFormList->addRow(_('Proxy mode'), $statusBox);
if ($this->data['status'] == HOST_STATUS_PROXY_PASSIVE) {
    if (isset($this->data['interface']['interfaceid'])) {
        $proxyForm->addVar('interface[interfaceid]', $this->data['interface']['interfaceid']);
        $proxyForm->addVar('interface[hostid]', $this->data['interface']['hostid']);
    }
    $interfaceTable = new CTable(null, 'formElementTable');
    $interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port')));
    $connectByComboBox = new CRadioButtonList('interface[useip]', $this->data['interface']['useip']);
    $connectByComboBox->addValue(_('IP'), 1);
Ejemplo n.º 4
0
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
include 'include/views/js/administration.script.edit.js.php';
$scriptsWidget = new CWidget();
$scriptsWidget->addPageHeader(_('CONFIGURATION OF SCRIPTS'));
$scriptForm = new CForm();
$scriptForm->setName('scripts');
$scriptForm->addVar('form', $this->get('form'));
$scriptForm->addVar('form_refresh', $this->get('form_refresh') + 1);
if ($this->get('scriptid')) {
    $scriptForm->addVar('scriptid', $this->get('scriptid'));
}
$scriptFormList = new CFormList('scriptsTab');
// name
$nameTextBox = new CTextBox('name', $this->get('name'), ZBX_TEXTBOX_STANDARD_SIZE);
$nameTextBox->attr('autofocus', 'autofocus');
$nameTextBox->attr('placeholder', _('<Sub-menu/Sub-menu.../>Script'));
$scriptFormList->addRow(_('Name'), $nameTextBox);
// type
$typeComboBox = new CComboBox('type', $this->get('type'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_IPMI, _('IPMI'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT, _('Script'));
$scriptFormList->addRow(_('Type'), $typeComboBox);
// execute on
$typeRadioButton = new CRadioButtonList('execute_on', $this->get('execute_on'));
$typeRadioButton->makeVertical();
$typeRadioButton->addValue(_('Zabbix agent'), ZBX_SCRIPT_EXECUTE_ON_AGENT);
$typeRadioButton->addValue(_('Zabbix server'), ZBX_SCRIPT_EXECUTE_ON_SERVER);
$scriptFormList->addRow(_('Execute on'), new CDiv($typeRadioButton, 'objectgroup inlineblock border_dotted ui-corner-all'), $this->get('type') == ZBX_SCRIPT_TYPE_IPMI);
$scriptFormList->addRow(_('Commands'), new CTextArea('command', $this->get('command')), $this->get('type') == ZBX_SCRIPT_TYPE_IPMI);
$scriptFormList->addRow(_('Command'), new CTextBox('commandipmi', $this->get('commandipmi'), ZBX_TEXTBOX_STANDARD_SIZE), $this->get('type') == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT);
Ejemplo n.º 5
0
     $newOperationsTable->addRow(array(_('Authentication method'), $authTypeComboBox), 'class_authentication_method hidden');
     $newOperationsTable->addRow(array(_('User name'), new CTextBox('new_operation[opcommand][username]', $this->data['new_operation']['opcommand']['username'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_username hidden indent_both');
     $newOperationsTable->addRow(array(_('Public key file'), new CTextBox('new_operation[opcommand][publickey]', $this->data['new_operation']['opcommand']['publickey'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_publickey hidden indent_both');
     $newOperationsTable->addRow(array(_('Private key file'), new CTextBox('new_operation[opcommand][privatekey]', $this->data['new_operation']['opcommand']['privatekey'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_privatekey hidden indent_both');
     $newOperationsTable->addRow(array(_('Password'), new CTextBox('new_operation[opcommand][password]', $this->data['new_operation']['opcommand']['password'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_password hidden indent_both');
     // set custom id because otherwise they are set based on name (sick!) and produce duplicate ids
     $passphraseCB = new CTextBox('new_operation[opcommand][password]', $this->data['new_operation']['opcommand']['password'], ZBX_TEXTBOX_SMALL_SIZE);
     $passphraseCB->attr('id', 'new_operation_opcommand_passphrase');
     $newOperationsTable->addRow(array(_('Key passphrase'), $passphraseCB), 'class_authentication_passphrase hidden');
     // ssh && telnet
     $newOperationsTable->addRow(array(_('Port'), new CTextBox('new_operation[opcommand][port]', $this->data['new_operation']['opcommand']['port'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_opcommand_port hidden indent_both');
     // command
     $commandTextArea = new CTextArea('new_operation[opcommand][command]', $this->data['new_operation']['opcommand']['command']);
     $newOperationsTable->addRow(array(_('Commands'), $commandTextArea), 'class_opcommand_command hidden indent_both');
     $commandIpmiTextBox = new CTextBox('new_operation[opcommand][command]', $this->data['new_operation']['opcommand']['command'], ZBX_TEXTBOX_STANDARD_SIZE);
     $commandIpmiTextBox->attr('id', 'opcommand_command_ipmi');
     $newOperationsTable->addRow(array(_('Commands'), $commandIpmiTextBox), 'class_opcommand_command_ipmi hidden indent_both');
     break;
 case OPERATION_TYPE_HOST_ADD:
 case OPERATION_TYPE_HOST_REMOVE:
 case OPERATION_TYPE_HOST_ENABLE:
 case OPERATION_TYPE_HOST_DISABLE:
     $newOperationsTable->addItem(new CVar('new_operation[object]', 0));
     $newOperationsTable->addItem(new CVar('new_operation[objectid]', 0));
     $newOperationsTable->addItem(new CVar('new_operation[shortdata]', ''));
     $newOperationsTable->addItem(new CVar('new_operation[longdata]', ''));
     break;
 case OPERATION_TYPE_GROUP_ADD:
 case OPERATION_TYPE_GROUP_REMOVE:
     if (!isset($this->data['new_operation']['opgroup'])) {
         $this->data['new_operation']['opgroup'] = array();
     // percent left
     $percentLeftTextBox = new CTextBox('percent_left', $this->data['percent_left'], 6, false, 7);
     $percentLeftCheckbox = new CCheckBox('visible[percent_left]', 1, 'javascript: showHideVisible("percent_left");', 1);
     if (isset($this->data['visible']) && isset($this->data['visible']['percent_left'])) {
         $percentLeftTextBox->attr('style', '');
         $percentLeftCheckbox->setChecked(1);
     } elseif ($this->data['percent_left'] == 0) {
         $percentLeftTextBox->attr('style', 'visibility: hidden;');
         $percentLeftCheckbox->setChecked(0);
     }
     $graphFormList->addRow(_('Percentile line (left)'), array($percentLeftCheckbox, SPACE, $percentLeftTextBox));
     // percent right
     $percentRightTextBox = new CTextBox('percent_right', $this->data['percent_right'], 6, false, 7);
     $percentRightCheckbox = new CCheckBox('visible[percent_right]', 1, 'javascript: showHideVisible("percent_right");', 1);
     if (isset($this->data['visible']) && isset($this->data['visible']['percent_right'])) {
         $percentRightTextBox->attr('style', '');
         $percentRightCheckbox->setChecked(1);
     } elseif ($this->data['percent_right'] == 0) {
         $percentRightTextBox->attr('style', 'visibility: hidden;');
         $percentRightCheckbox->setChecked(0);
     }
     $graphFormList->addRow(_('Percentile line (right)'), array($percentRightCheckbox, SPACE, $percentRightTextBox));
 }
 $yaxisMinData = array();
 $yTypeComboBox = new CComboBox('ymin_type', $this->data['ymin_type']);
 $yTypeComboBox->addItem(GRAPH_YAXIS_TYPE_CALCULATED, _('Calculated'));
 $yTypeComboBox->addItem(GRAPH_YAXIS_TYPE_FIXED, _('Fixed'));
 $yTypeComboBox->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE, _('Item'));
 $yaxisMinData[] = $yTypeComboBox;
 if ($this->data['ymin_type'] == GRAPH_YAXIS_TYPE_FIXED) {
     $yaxisMinData[] = new CTextBox('yaxismin', $this->data['yaxismin'], 7);
    $groups = get_request('groups', array());
    if (isset($_REQUEST['groupid']) && $_REQUEST['groupid'] > 0 && !uint_in_array($_REQUEST['groupid'], $groups)) {
        array_push($groups, $_REQUEST['groupid']);
    }
    $hosts_linked_to = get_request('hosts', array());
}
$clear_templates = array_intersect($clear_templates, array_keys($this->data['original_templates']));
$clear_templates = array_diff($clear_templates, array_keys($templateIds));
natcasesort($templateIds);
$frmHost->addVar('clear_templates', $clear_templates);
// TEMPLATE WIDGET {
$templateList = new CFormList('hostlist');
// FORM ITEM : Template name text box [  ]
$template_nameTB = new CTextBox('template_name', $host, 54);
$template_nameTB->setAttribute('maxlength', 64);
$template_nameTB->attr('autofocus', 'autofocus');
$templateList->addRow(_('Template name'), $template_nameTB);
$visiblenameTB = new CTextBox('visiblename', $visiblename, 54);
$visiblenameTB->setAttribute('maxlength', 64);
$templateList->addRow(_('Visible name'), $visiblenameTB);
// FORM ITEM : Groups tween box [  ] [  ]
// get all Groups
$group_tb = new CTweenBox($frmHost, 'groups', $groups, 10);
$options = array('output' => API_OUTPUT_EXTEND, 'preservekeys' => true);
$all_groups = API::HostGroup()->get($options);
order_result($all_groups, 'name');
$groupsAllowed = API::HostGroup()->get(array('output' => array('groupid', 'name'), 'editable' => true, 'preservekeys' => true));
order_result($groupsAllowed, 'name');
if (getRequest('form') === 'update') {
    // add existing template groups to list and, depending on permissions show name as enabled or disabled
    $groupsInList = array();
/*
** Zabbix
** Copyright (C) 2001-2013 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$workingTimeTab = new CFormList('scriptsTab');
$wtTextBox = new CTextBox('work_period', $this->data['config']['work_period'], ZBX_TEXTBOX_STANDARD_SIZE);
$wtTextBox->attr('autofocus', 'autofocus');
$workingTimeTab->addRow(_('Working time'), $wtTextBox);
$workingTimeView = new CTabView();
$workingTimeView->addTab('workingTime', _('Working time'), $workingTimeTab);
$workingTimeForm = new CForm();
$workingTimeForm->setName('workingTimeForm');
$workingTimeForm->addVar('form_refresh', $this->data['form_refresh'] + 1);
$workingTimeForm->addItem($workingTimeView);
$workingTimeForm->addItem(makeFormFooter(new CSubmit('save', _('Save'))));
return $workingTimeForm;
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
include 'include/views/js/administration.general.iconmap.js.php';
$iconMapTab = new CFormList('scriptsTab');
$name = new CTextBox('iconmap[name]', $this->data['iconmap']['name']);
$name->setAttribute('maxlength', 64);
$name->attr('autofocus', 'autofocus');
$iconMapTab->addRow(_('Name'), $name);
$iconMapTable = new CTable();
$iconMapTable->setAttribute('id', 'iconMapTable');
$iconMapForm = new CForm();
$iconMapForm->addVar('form', 1);
if (isset($this->data['iconmapid'])) {
    $iconMapForm->addVar('iconmapid', $this->data['iconmap']['iconmapid']);
}
// header
$iconMapTable->addRow(array(SPACE, SPACE, _('Inventory field'), _('Expression'), _('Icon'), SPACE, SPACE));
order_result($this->data['iconmap']['mappings'], 'sortorder');
$i = 0;
foreach ($this->data['iconmap']['mappings'] as $mapping) {
    $numSpan = new CSpan($i + 1 . ':');
    $numSpan->addClass('rowNum');
$itemFormList->addRow(_('Keep lost resources period (in days)'), new CTextBox('lifetime', $this->data['lifetime'], ZBX_TEXTBOX_SMALL_SIZE, false, 64));
$itemFormList->addRow(_('Allowed hosts'), new CTextBox('trapper_hosts', $this->data['trapper_hosts'], ZBX_TEXTBOX_STANDARD_SIZE), false, 'row_trapper_hosts');
// append description to form list
$description = new CTextArea('description', $this->data['description']);
$description->addStyle('margin-top: 5px;');
$itemFormList->addRow(_('Description'), $description);
// status
$enabledCheckBox = new CCheckBox('status', !$this->data['status'], null, ITEM_STATUS_ACTIVE);
$itemFormList->addRow(_('Enabled'), $enabledCheckBox);
/*
 * Condition tab
 */
$conditionFormList = new CFormList('conditionlist');
// type of calculation
$formula = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_STANDARD_SIZE);
$formula->attr('id', 'formula');
$formula->attr('placeholder', 'A or (B and C) &hellip;');
if ($this->data['evaltype'] != CONDITION_EVAL_TYPE_EXPRESSION) {
    $formula->addClass('hidden');
}
$conditionFormList->addRow(_('Type of calculation'), array(new CComboBox('evaltype', $this->data['evaltype'], null, array(CONDITION_EVAL_TYPE_AND_OR => _('And/Or'), CONDITION_EVAL_TYPE_AND => _('And'), CONDITION_EVAL_TYPE_OR => _('Or'), CONDITION_EVAL_TYPE_EXPRESSION => _('Custom expression'))), new CSpan('', $this->data['evaltype'] == CONDITION_EVAL_TYPE_EXPRESSION ? 'hidden' : '', 'expression'), $formula), count($this->data['conditions']) < 2, 'conditionRow');
// macros
$conditionTable = new CTable('', 'formElementTable');
$conditionTable->attr('id', 'conditions');
$conditionTable->addRow(array(_('Label'), _('Macro'), SPACE, _('Regular expression'), SPACE));
$conditions = $this->data['conditions'];
if (!$conditions) {
    $conditions = array(array('macro' => '', 'value' => '', 'formulaid' => num2letter(0)));
} else {
    $conditions = CConditionHelper::sortConditionsByFormulaId($conditions);
}
Ejemplo n.º 11
0
function zbxeShowPreferences($id)
{
    //global $ZBXE_VAR;
    global $_SERVER;
    if (strpos($_SERVER["REQUEST_URI"], "users.php?form=update&userid=") > 0) {
        $userid = get_request('userid', 0);
    } else {
        $userid = $id != "" ? 0 : CWebUser::$data['userid'];
    }
    $userFormExtra = new CFormList('userFormExtra' . $id);
    // Interface Web
    $companyTable = new CTable();
    $companyTable->setAttribute('id', 'extrasTab' . $id);
    $companyTable->addRow(array(SPACE, SPACE, _('Name'), _zeT('Color'), SPACE, SPACE));
    //var_dump ('map_company'.$id . " - [$userid]" . zbxeConfigValue('map_company',$userid) . "<br>");
    $mapCompany = new CTextBox('map_company' . $id, zbxeConfigValue('map_company', $userid), ZBX_TEXTBOX_STANDARD_SIZE);
    $mapCompany->attr('autofocus', 'autofocus');
    $mapDateColor = new CColor('map_date_color' . $id, zbxeConfigValue('map_date_color', $userid));
    $companyTable->addRow(array(SPACE, SPACE, $mapCompany, $mapDateColor, SPACE, SPACE));
    $userFormExtra->addRow(_zeT('Company'), new CDiv($companyTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
    $mapBackColor = new CColor('map_background_color' . $id, zbxeConfigValue('map_background_color', $userid));
    $mapTable = new CTable();
    $mapTable->setAttribute('id', 'borderTable');
    $mapTable->addRow(array(SPACE, SPACE, _('Background'), SPACE, _zeT('Border'), SPACE, _('Title'), SPACE, SPACE));
    $mapTable->addRow(array(SPACE, SPACE, $mapBackColor, SPACE, array(new CColor('map_border_color' . $id, zbxeConfigValue('map_border_color', $userid)), $userid == 0 ? new CCheckBox('map_border_show' . $id, zbxeConfigValue('map_border_show', $userid), null, 1) : ""), SPACE, array(new CColor('map_title_color' . $id, zbxeConfigValue('map_title_color', $userid)), $userid == 0 ? new CCheckBox('map_title_show' . $id, zbxeConfigValue('map_title_show', $userid), null, 1) : ""), SPACE, SPACE));
    $userFormExtra->addRow(_zeT('Maps'), new CDiv($mapTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
    if (CWebUser::$data['userid'] > 0) {
        $userFormExtra->addRow(_zeT('Delete User Personalization'), new CCheckBox('xbxe_clean'));
    }
    return $userFormExtra;
}
Ejemplo n.º 12
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 CTextBox($name . '_day', $d, 2, false, 2);
    $day->attr('style', 'text-align: right;');
    $day->attr('placeholder', _('dd'));
    $day->addAction('onchange', 'validateDatePartBox(this, 1, 31, 2);');
    $month = new CTextBox($name . '_month', $m, 2, false, 2);
    $month->attr('style', 'text-align: right;');
    $month->attr('placeholder', _('mm'));
    $month->addAction('onchange', 'validateDatePartBox(this, 1, 12, 2);');
    $year = new CNumericBox($name . '_year', $y, 4);
    $year->attr('placeholder', _('yyyy'));
    $hour = new CTextBox($name . '_hour', $h, 2, false, 2);
    $hour->attr('style', 'text-align: right;');
    $hour->attr('placeholder', _('hh'));
    $hour->addAction('onchange', 'validateDatePartBox(this, 0, 23, 2);');
    $minute = new CTextBox($name . '_minute', $i, 2, false, 2);
    $minute->attr('style', 'text-align: right;');
    $minute->attr('placeholder', _('mm'));
    $minute->addAction('onchange', 'validateDatePartBox(this, 0, 59, 2);');
    $fields = array($year, '-', $month, '-', $day, ' ', $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;
}