icingaweb2-module-director/application/controllers/DatafieldController.php
Eric Lippmann b6af283732 License source files as GPL-3.0-or-later
Add SPDX license headers and mark source files as GPL-3.0-or-later to
preserve the option to relicense under later GPL versions.
2026-03-24 11:30:06 +01:00

43 lines
1.1 KiB
PHP

<?php
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-3.0-or-later
namespace Icinga\Module\Director\Controllers;
use Icinga\Module\Director\Forms\DirectorDatafieldForm;
use Icinga\Module\Director\Web\Controller\ActionController;
class DatafieldController extends ActionController
{
public function addAction()
{
$this->indexAction();
}
public function editAction()
{
$this->indexAction();
}
public function indexAction()
{
$form = DirectorDatafieldForm::load()
->setDb($this->db());
if ($id = $this->params->get('id')) {
$form->loadObject((int) $id);
$this->addTitle(
$this->translate('Modify %s'),
$form->getObject()->varname
);
$this->addSingleTab($this->translate('Edit a Field'));
} else {
$this->addTitle($this->translate('Add a new Data Field'));
$this->addSingleTab($this->translate('New Field'));
}
$form->handleRequest();
$this->content()->add($form);
}
}