2011-06-21 10:24:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
|
|
|
|
{
|
|
|
|
public function init()
|
|
|
|
{
|
2021-10-11 16:10:47 +02:00
|
|
|
$this->setDecorators([
|
|
|
|
['ViewScript', ['viewScript' => 'form/preferences_watched_dirs.phtml']],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->addElement('text', 'storageFolder', [
|
|
|
|
'class' => 'input_text',
|
|
|
|
'label' => _('Import Folder:'),
|
|
|
|
'required' => false,
|
|
|
|
'filters' => ['StringTrim'],
|
2011-06-21 14:58:38 +02:00
|
|
|
'value' => '',
|
2021-10-11 16:10:47 +02:00
|
|
|
'decorators' => [
|
|
|
|
'ViewHelper',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->addElement('text', 'watchedFolder', [
|
|
|
|
'class' => 'input_text',
|
|
|
|
'label' => _('Watched Folders:'),
|
|
|
|
'required' => false,
|
|
|
|
'filters' => ['StringTrim'],
|
2011-06-21 10:24:02 +02:00
|
|
|
'value' => '',
|
2021-10-11 16:10:47 +02:00
|
|
|
'decorators' => [
|
|
|
|
'ViewHelper',
|
|
|
|
],
|
|
|
|
]);
|
2011-06-21 10:24:02 +02:00
|
|
|
}
|
|
|
|
|
2012-08-29 05:04:55 +02:00
|
|
|
public function verifyChosenFolder($p_form_element_id)
|
|
|
|
{
|
2011-06-21 14:58:38 +02:00
|
|
|
$element = $this->getElement($p_form_element_id);
|
2011-06-21 10:24:02 +02:00
|
|
|
|
|
|
|
if (!is_dir($element->getValue())) {
|
2021-10-11 16:10:47 +02:00
|
|
|
$element->setErrors([_('Not a valid Directory')]);
|
2012-08-29 05:04:55 +02:00
|
|
|
|
2011-06-21 10:24:02 +02:00
|
|
|
return false;
|
|
|
|
}
|
2021-10-11 16:10:47 +02:00
|
|
|
$element->setValue('');
|
2011-06-21 10:24:02 +02:00
|
|
|
|
2021-10-11 16:10:47 +02:00
|
|
|
return true;
|
2011-06-21 10:24:02 +02:00
|
|
|
}
|
|
|
|
}
|