public function resumeView(\Nethgui\View\ViewInterface $view) { $session = $this->getParent()->getSession(); $vs = new \ArrayObject(); $this->state->resume($session)->copyTo($vs, iterator_to_array($session->retrieve(__CLASS__))); call_user_func($this->resumeCallback, $view, $vs); }
public function process() { if ($this->getRequest()->isMutation() && $this->getRequest()->hasParameter('Submit')) { // create the DB key: $this->getPlatform()->getDatabase('fwrules')->setKey($this->workflow->getRuleId(), 'rule', array()); $this->worker->process(); $this->getParent()->fixOrderedSetPositions(); } else { $this->worker->process(); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view->setTemplate('NethServer/Template/FirewallObjects/HostGroups/Modify'); if (!$this->getRequest()->isValidated()) { return; } if ($this->getRequest()->isMutation()) { $view->getCommandList()->sendQuery($view->getModuleUrl('../' . $this->state->getReturnPath())); } else { $view->getCommandList()->show(); } }
public function bind(\Nethgui\Controller\RequestInterface $request) { $ruleId = \Nethgui\array_head($request->getPath()); if (!$this->getAdapter()->offsetExists($ruleId)) { throw new \Nethgui\Exception\HttpException('Not found', 404, 1399992975); } $this->worker->ruleId = $ruleId; $this->worker->bind($request); $subrequest = $request->spawnRequest($ruleId); if ($subrequest->hasParameter('f') || $subrequest->hasParameter('Submit')) { // resume values from $this->workflow->resume($this->getParent()->getSession())->copyTo($this->worker->parameters, array('SrcRaw', 'DstRaw', 'ServiceRaw', 'status', 'Description', 'LogType', 'Action')); } else { // start new workflow $defaults = array(); foreach (array('SrcRaw', 'DstRaw', 'ServiceRaw', 'status', 'Description', 'LogType', 'Action') as $f) { if ($request->hasParameter($f)) { $defaults[$f] = $request->getParameter($f); } } $this->workflow->start($this->getParent()->getSession(), $this->getIdentifier(), 'Edit/' . $ruleId, $ruleId, $defaults); } }
public function prepareView(\Nethgui\View\ViewInterface $view) { parent::prepareView($view); $view->setTemplate('NethServer/Template/FirewallObjects/Services/Modify'); $view['ProtocolDatasource'] = array_map(function ($fmt) use($view) { return array($fmt, $view->translate($fmt . '_label')); }, $this->protocols); if (!$this->getRequest()->isValidated()) { return; } if ($this->getRequest()->isMutation()) { $view->getCommandList()->sendQuery($view->getModuleUrl('../' . $this->state->getReturnPath())); } else { $view->getCommandList()->show(); } }