2014-09-02 15:39:21 +02:00
|
|
|
<?php
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
|
2014-11-14 10:57:14 +01:00
|
|
|
namespace Icinga\Forms\Config\Resource;
|
2014-09-02 15:39:21 +02:00
|
|
|
|
|
|
|
use Icinga\Web\Form;
|
|
|
|
use Icinga\Web\Form\Validator\ReadablePathValidator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Form class for adding/modifying file resources
|
|
|
|
*/
|
|
|
|
class FileResourceForm extends Form
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Initialize this form
|
|
|
|
*/
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->setName('form_config_resource_file');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Form::createElements()
|
|
|
|
*/
|
|
|
|
public function createElements(array $formData)
|
|
|
|
{
|
2014-09-29 11:20:39 +02:00
|
|
|
$this->addElement(
|
|
|
|
'text',
|
|
|
|
'name',
|
|
|
|
array(
|
|
|
|
'required' => true,
|
|
|
|
'label' => t('Resource Name'),
|
|
|
|
'description' => t('The unique name of this resource')
|
|
|
|
)
|
|
|
|
);
|
2014-09-03 12:21:31 +02:00
|
|
|
$this->addElement(
|
|
|
|
'text',
|
|
|
|
'filename',
|
|
|
|
array(
|
|
|
|
'required' => true,
|
|
|
|
'label' => t('Filepath'),
|
|
|
|
'description' => t('The filename to fetch information from'),
|
|
|
|
'validators' => array(new ReadablePathValidator())
|
2014-09-02 15:39:21 +02:00
|
|
|
)
|
|
|
|
);
|
2014-09-03 12:21:31 +02:00
|
|
|
$this->addElement(
|
|
|
|
'text',
|
|
|
|
'fields',
|
|
|
|
array(
|
|
|
|
'required' => true,
|
|
|
|
'label' => t('Pattern'),
|
|
|
|
'description' => t('The regular expression by which to identify columns')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
return $this;
|
2014-09-02 15:39:21 +02:00
|
|
|
}
|
|
|
|
}
|