icingaweb2-module-director/application/controllers/DatafieldController.php

41 lines
1.0 KiB
PHP
Raw Permalink Normal View History

<?php
2015-10-20 22:34:04 +02:00
namespace Icinga\Module\Director\Controllers;
use Icinga\Module\Director\Forms\DirectorDatafieldForm;
use Icinga\Module\Director\Web\Controller\ActionController;
2015-10-20 22:34:04 +02:00
class DatafieldController extends ActionController
{
2015-07-03 14:20:47 +02:00
public function addAction()
{
$this->indexAction();
2015-07-03 14:20:47 +02:00
}
public function editAction()
{
$this->indexAction();
2015-07-03 14:20:47 +02:00
}
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
);
2017-07-20 15:10:12 +02:00
$this->addSingleTab($this->translate('Edit a Field'));
} else {
$this->addTitle($this->translate('Add a new Data Field'));
2017-07-20 15:10:12 +02:00
$this->addSingleTab($this->translate('New Field'));
}
2015-07-03 14:20:47 +02:00
$form->handleRequest();
$this->content()->add($form);
}
}