icingaweb2-module-businessp.../application/controllers/NodeController.php

92 lines
2.5 KiB
PHP
Raw Normal View History

<?php
2014-11-30 09:56:58 -05:00
use Icinga\Module\Businessprocess\Controller;
2015-03-16 04:08:00 -04:00
use Icinga\Module\Businessprocess\Simulation;
2014-11-30 09:56:58 -05:00
use Icinga\Module\Businessprocess\Forms\ProcessForm;
use Icinga\Module\Businessprocess\Forms\SimulationForm;
use Icinga\Web\Url;
2015-03-16 04:08:00 -04:00
/*
config = <file>
process = <node>
*/
2014-11-30 09:56:58 -05:00
class Businessprocess_NodeController extends Controller
{
2015-03-16 04:08:00 -04:00
// rename to config
public function editAction()
{
2015-03-16 04:08:00 -04:00
$bp = $this->loadModifiedBpConfig();
$node = $bp->getNode($this->getParam('node'));
2015-03-16 04:08:00 -04:00
$detail = Url::fromPath(
'businessprocess/node/edit',
array(
'config' => $this->view->configName,
'node' => $node
)
);
2015-03-16 04:08:00 -04:00
$this->view->form = ProcessForm::construct()
->setProcess($bp)
->setSession($this->session())
->setNode($node)
->setRedirectUrl(
sprintf(
'businessprocess/process/show?config=%s&unlocked#!%s',
$bp->getName(),
$detail->getAbsoluteUrl()
)
)
->handleRequest();
$this->view->node = $node;
}
public function simulateAction()
{
2015-03-16 04:08:00 -04:00
$bp = $this->loadBpConfig();
$nodename = $this->getParam('node');
$node = $bp->getNode($nodename);
$details = Url::fromPath(
'businessprocess/node/simulate',
array(
'config' => $this->view->configName,
'node' => $nodename
)
);
$url = sprintf(
'businessprocess/process/show?unlocked&config=%s#!%s',
$bp->getName(),
$details->getAbsoluteUrl()
);
$this->view->form = SimulationForm::construct()
2015-10-07 10:48:59 -04:00
->setSimulation(new Simulation($bp, $this->session()))
->setNode($node)
// TODO: find a better way to handle redirects
->setRedirectUrl($url)
2015-02-06 19:25:37 -05:00
->handleRequest();
$this->view->node = $node;
}
2015-03-16 04:08:00 -04:00
public function addAction()
{
$bp = $this->loadBpConfig();
$redirectUrl = Url::fromPath(
'businessprocess/process/show',
array('config' => $bp->getName())
);
$this->view->form = ProcessForm::construct()
->setProcess($bp)
->setSession($this->session())
->setRedirectUrl($redirectUrl)
->handleRequest();
}
public function deleteAction()
{
}
}