public function runConfigureWorkflows(TBGRequest $request) { $this->workflows = TBGWorkflow::getAll(); if ($request->isMethod(TBGRequest::POST)) { try { $workflow_name = $request->getParameter('workflow_name'); $workflow = new TBGWorkflow(); $workflow->setName($workflow_name); $workflow->save(); $step = new TBGWorkflowStep(); $step->setName(TBGContext::getI18n()->__('New')); $step->setWorkflow($workflow); $step->save(); $this->forward(TBGContext::getRouting()->generate('configure_workflow')); } catch (Exception $e) { $this->error = $e->getMessage(); } } }
<select name="workflow_id[<?php echo $issuetype->getID(); ?> ]"> <option value=""<?php if (!$workflow_scheme->hasWorkflowAssociatedWithIssuetype($issuetype)) { ?> selected<?php } ?> ><?php echo __('No workflow selected - will use default workflow'); ?> </option> <?php foreach (TBGWorkflow::getAll() as $workflow) { ?> <option value="<?php echo $workflow->getID(); ?> "<?php if ($workflow_scheme->hasWorkflowAssociatedWithIssuetype($issuetype) && $workflow_scheme->getWorkflowForIssuetype($issuetype)->getID() == $workflow->getID()) { ?> selected<?php } ?> ><?php echo $workflow->getName(); ?> </option> <?php
public function runConfigureWorkflows(TBGRequest $request) { $this->workflows = TBGWorkflow::getAll(); if ($request->isPost()) { try { $workflow_name = $request['workflow_name']; $workflow = new TBGWorkflow(); $workflow->setName($workflow_name); $workflow->save(); $step = new TBGWorkflowStep(); $step->setName($this->getI18n()->__('New')); $step->setWorkflow($workflow); $step->save(); $transition = new TBGWorkflowTransition(); $transition->setOutgoingStep($step); $transition->setName('Issue created'); $transition->setWorkflow($workflow); $transition->setDescription('This is the initial transition for issues using this workflow'); $transition->save(); $workflow->setInitialTransition($transition); $workflow->save(); $this->forward(TBGContext::getRouting()->generate('configure_workflow')); } catch (Exception $e) { $this->error = $e->getMessage(); } } }