2014-11-30 06:20:55 -05:00
|
|
|
<?php
|
|
|
|
|
|
2015-11-17 08:21:59 -05:00
|
|
|
namespace Icinga\Module\Businessprocess\Controllers;
|
|
|
|
|
|
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 06:20:55 -05:00
|
|
|
use Icinga\Web\Url;
|
|
|
|
|
|
2015-03-16 04:08:00 -04:00
|
|
|
/*
|
|
|
|
|
config = <file>
|
|
|
|
|
process = <node>
|
|
|
|
|
|
|
|
|
|
*/
|
2015-11-17 08:21:59 -05:00
|
|
|
class NodeController extends Controller
|
2014-11-30 06:20:55 -05:00
|
|
|
{
|
2015-03-16 04:08:00 -04:00
|
|
|
// rename to config
|
2014-11-30 06:20:55 -05:00
|
|
|
public function editAction()
|
|
|
|
|
{
|
2015-03-16 04:08:00 -04:00
|
|
|
$bp = $this->loadModifiedBpConfig();
|
2014-11-30 06:20:55 -05:00
|
|
|
$node = $bp->getNode($this->getParam('node'));
|
2015-11-17 09:52:19 -05:00
|
|
|
$url = Url::fromPath(
|
|
|
|
|
'businessprocess/process/show?unlocked',
|
|
|
|
|
array('config' => $bp->getName())
|
2015-03-16 04:08:00 -04:00
|
|
|
);
|
2014-11-30 06:20:55 -05:00
|
|
|
|
2015-11-17 09:52:19 -05:00
|
|
|
$this->view->form = $this->loadForm('process')
|
2015-03-16 04:08:00 -04:00
|
|
|
->setProcess($bp)
|
|
|
|
|
->setSession($this->session())
|
|
|
|
|
->setNode($node)
|
2015-11-17 09:52:19 -05:00
|
|
|
->setSuccessUrl($url)
|
2015-03-16 04:08:00 -04:00
|
|
|
->handleRequest();
|
2014-11-30 06:20:55 -05:00
|
|
|
|
|
|
|
|
$this->view->node = $node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function simulateAction()
|
|
|
|
|
{
|
2015-03-16 04:08:00 -04:00
|
|
|
$bp = $this->loadBpConfig();
|
2014-11-30 06:20:55 -05:00
|
|
|
$nodename = $this->getParam('node');
|
2015-11-17 07:10:30 -05:00
|
|
|
$node = $bp->getNode($nodename);
|
2015-11-17 09:52:19 -05:00
|
|
|
$url = Url::fromPath(
|
|
|
|
|
'businessprocess/process/show?unlocked',
|
|
|
|
|
array('config' => $bp->getName())
|
2015-11-17 07:10:30 -05:00
|
|
|
);
|
2014-11-30 06:20:55 -05:00
|
|
|
|
2015-11-17 09:52:19 -05:00
|
|
|
$this->view->form = $this->loadForm('simulation')
|
2015-10-07 10:48:59 -04:00
|
|
|
->setSimulation(new Simulation($bp, $this->session()))
|
2015-11-17 07:10:30 -05:00
|
|
|
->setNode($node)
|
2015-11-17 09:52:19 -05:00
|
|
|
->setSuccessUrl($url)
|
2015-02-06 19:25:37 -05:00
|
|
|
->handleRequest();
|
2015-11-17 09:52:19 -05:00
|
|
|
|
2015-11-17 07:10:30 -05:00
|
|
|
$this->view->node = $node;
|
2014-11-30 06:20:55 -05:00
|
|
|
}
|
2015-03-16 04:08:00 -04:00
|
|
|
|
|
|
|
|
public function addAction()
|
|
|
|
|
{
|
|
|
|
|
$bp = $this->loadBpConfig();
|
|
|
|
|
|
2015-11-17 09:52:19 -05:00
|
|
|
$url = Url::fromPath(
|
2015-03-16 04:08:00 -04:00
|
|
|
'businessprocess/process/show',
|
|
|
|
|
array('config' => $bp->getName())
|
|
|
|
|
);
|
|
|
|
|
|
2015-11-17 09:52:19 -05:00
|
|
|
$this->view->form = $this->loadForm('process')
|
2015-03-16 04:08:00 -04:00
|
|
|
->setProcess($bp)
|
|
|
|
|
->setSession($this->session())
|
2015-11-17 09:52:19 -05:00
|
|
|
->setRedirectUrl($url)
|
2015-03-16 04:08:00 -04:00
|
|
|
->handleRequest();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function deleteAction()
|
|
|
|
|
{
|
|
|
|
|
}
|
2014-11-30 06:20:55 -05:00
|
|
|
}
|