diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
commit | f66ab8dae2f3d0418759f81a3a64dc9517a62449 (patch) | |
tree | fbff2135e7013f196b891bbde54618eb050e4aaf /application/forms/DirectorDatalistForm.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.tar.xz icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.zip |
Adding upstream version 1.10.2.upstream/1.10.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/forms/DirectorDatalistForm.php')
-rw-r--r-- | application/forms/DirectorDatalistForm.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/application/forms/DirectorDatalistForm.php b/application/forms/DirectorDatalistForm.php new file mode 100644 index 0000000..91c0ea7 --- /dev/null +++ b/application/forms/DirectorDatalistForm.php @@ -0,0 +1,45 @@ +<?php + +namespace Icinga\Module\Director\Forms; + +use Icinga\Module\Director\Web\Form\DirectorObjectForm; +use Icinga\Authentication\Auth; + +class DirectorDatalistForm extends DirectorObjectForm +{ + public function setup() + { + $this->addElement('text', 'list_name', array( + 'label' => $this->translate('List name'), + 'description' => $this->translate( + 'Data lists are mainly used as data providers for custom variables' + . ' presented as dropdown boxes boxes. You can manually manage' + . ' their entries here in place, but you could also create dedicated' + . ' sync rules after creating a new empty list. This would allow you' + . ' to keep your available choices in sync with external data providers' + ), + 'required' => true, + )); + $this->addSimpleDisplayGroup(array('list_name'), 'list', array( + 'legend' => $this->translate('Data list') + )); + + $this->setButtons(); + } + + public function onSuccess() + { + $this->object()->set('owner', self::username()); + parent::onSuccess(); + } + + protected static function username() + { + $auth = Auth::getInstance(); + if ($auth->isAuthenticated()) { + return $auth->getUser()->getUsername(); + } else { + return '<unknown>'; + } + } +} |