2014-10-29 15:40:34 +01:00
|
|
|
<?php
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\Form\Setup;
|
|
|
|
|
|
|
|
use Icinga\Web\Form;
|
|
|
|
use Icinga\Module\Monitoring\Form\Config\InstanceConfigForm;
|
|
|
|
|
|
|
|
class InstancePage extends Form
|
|
|
|
{
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->setName('setup_monitoring_instance');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function createElements(array $formData)
|
|
|
|
{
|
2014-11-11 15:27:14 +01:00
|
|
|
$this->addElement(
|
2014-11-14 10:15:11 +01:00
|
|
|
'note',
|
|
|
|
'title',
|
|
|
|
array(
|
|
|
|
'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'),
|
|
|
|
'decorators' => array(
|
|
|
|
'ViewHelper',
|
|
|
|
array('HtmlTag', array('tag' => 'h2'))
|
2014-11-11 15:27:14 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2014-10-29 15:40:34 +01:00
|
|
|
$this->addElement(
|
2014-11-14 10:15:11 +01:00
|
|
|
'note',
|
|
|
|
'description',
|
|
|
|
array(
|
|
|
|
'value' => mt(
|
|
|
|
'monitoring',
|
|
|
|
'Please define the settings specific to your monitoring instance below.'
|
2014-10-29 15:40:34 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (isset($formData['host'])) {
|
|
|
|
$formData['type'] = 'remote'; // This is necessary as the type element gets ignored by Form::getValues()
|
|
|
|
}
|
|
|
|
|
|
|
|
$instanceConfigForm = new InstanceConfigForm();
|
|
|
|
$instanceConfigForm->createElements($formData);
|
|
|
|
$this->addElements($instanceConfigForm->getElements());
|
2014-11-11 12:41:02 +01:00
|
|
|
$this->getElement('name')->setValue('icinga');
|
2014-10-29 15:40:34 +01:00
|
|
|
}
|
|
|
|
}
|