2019-12-04 04:17:26 -05:00
|
|
|
<?php
|
|
|
|
|
|
2026-02-23 17:12:09 -05:00
|
|
|
// SPDX-FileCopyrightText: 2019 Icinga GmbH <https://icinga.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2020-03-13 03:38:01 -04:00
|
|
|
|
2019-12-04 04:17:26 -05:00
|
|
|
namespace Icinga\Module\Icingadb\Forms;
|
|
|
|
|
|
|
|
|
|
use Icinga\Data\ResourceFactory;
|
|
|
|
|
use Icinga\Forms\ConfigForm;
|
|
|
|
|
|
|
|
|
|
class DatabaseConfigForm extends ConfigForm
|
|
|
|
|
{
|
|
|
|
|
public function init()
|
|
|
|
|
{
|
2020-04-24 08:36:37 -04:00
|
|
|
$this->setSubmitLabel(t('Save Changes'));
|
2019-12-04 04:17:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createElements(array $formData)
|
|
|
|
|
{
|
|
|
|
|
$dbResources = ResourceFactory::getResourceConfigs('db')->keys();
|
|
|
|
|
|
|
|
|
|
$this->addElement('select', 'icingadb_resource', [
|
2020-04-24 08:36:37 -04:00
|
|
|
'description' => t('Database resource'),
|
|
|
|
|
'label' => t('Database'),
|
2020-03-12 05:32:01 -04:00
|
|
|
'multiOptions' => array_merge(
|
2020-04-24 08:36:37 -04:00
|
|
|
['' => sprintf(' - %s - ', t('Please choose'))],
|
2020-03-12 05:32:01 -04:00
|
|
|
array_combine($dbResources, $dbResources)
|
|
|
|
|
),
|
|
|
|
|
'disable' => [''],
|
|
|
|
|
'required' => true,
|
|
|
|
|
'value' => ''
|
2019-12-04 04:17:26 -05:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|