ObjectController: distinct templates and objects

This commit is contained in:
Thomas Gelf 2015-07-30 09:26:02 +02:00
parent 5a3fead131
commit 03436efa29
1 changed files with 10 additions and 6 deletions

View File

@ -102,15 +102,19 @@ abstract class ObjectController extends ActionController
$ltype = strtolower($type); $ltype = strtolower($type);
$url = sprintf('director/%ss', $ltype); $url = sprintf('director/%ss', $ltype);
$this->view->form = $this->loadForm('icinga' . ucfirst($type)) $form = $this->view->form = $this->loadForm('icinga' . ucfirst($type))
->setDb($this->db()) ->setDb($this->db())
->setSuccessUrl($url); ->setSuccessUrl($url);
$this->view->title = sprintf( if ($this->params->get('type') === 'template') {
$this->translate('Add new Icinga %s'), $form->setObjectType('template');
ucfirst($ltype) $title = $this->translate('Add new Icinga %s');
); } else {
$this->view->form->handleRequest(); $title = $this->translate('Add new Icinga %s template');
}
$this->view->title = sprintf($title, ucfirst($ltype));
$form->handleRequest();
$this->render('object/form', null, true); $this->render('object/form', null, true);
} }