|
@@ -7,6 +7,7 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
use Sonata\AdminBundle\Form\FormMapper;
|
|
use Sonata\AdminBundle\Form\FormMapper;
|
|
use Sonata\AdminBundle\Show\ShowMapper;
|
|
use Sonata\AdminBundle\Show\ShowMapper;
|
|
|
|
+use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
use WorkflowBundle\Utils\WorkFlowEntityClasses;
|
|
use WorkflowBundle\Utils\WorkFlowEntityClasses;
|
|
|
|
|
|
@@ -48,14 +49,14 @@ class WorkflowAdmin extends BaseAdmin
|
|
->add('name')
|
|
->add('name')
|
|
->add('description')
|
|
->add('description')
|
|
->add('enable')
|
|
->add('enable')
|
|
|
|
+ ->add('usedByDefault')
|
|
->add('_action', null, array(
|
|
->add('_action', null, array(
|
|
'actions' => array(
|
|
'actions' => array(
|
|
'show' => array(),
|
|
'show' => array(),
|
|
'edit' => array(),
|
|
'edit' => array(),
|
|
'delete' => array()
|
|
'delete' => array()
|
|
)
|
|
)
|
|
- ))
|
|
|
|
- ;
|
|
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -85,24 +86,42 @@ transitions:
|
|
to: state_one
|
|
to: state_one
|
|
";
|
|
";
|
|
// Create => template_example
|
|
// Create => template_example
|
|
- $tempate_options = array("attr" => array('style' => 'height:500px;'));
|
|
|
|
- if(is_null($this->getSubject()->getId())) {
|
|
|
|
|
|
+ $tempate_options = array(
|
|
|
|
+ "attr" => array(
|
|
|
|
+ 'style' => 'height:500px;',
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ if (is_null($this->getSubject()->getId())) {
|
|
$tempate_options['data'] = $template_example;
|
|
$tempate_options['data'] = $template_example;
|
|
} else {
|
|
} else {
|
|
- $this->parameters = array('workflow_name' => $this->getSubject()->getName(), 'workflow_subject' => $this->getSubject()->getSubject());
|
|
|
|
|
|
+ $this->parameters = array(
|
|
|
|
+ 'workflow_name' => $this->getSubject()->getName(),
|
|
|
|
+ 'workflow_subject' => $this->getSubject()->getSubject());
|
|
}
|
|
}
|
|
|
|
|
|
$formMapper
|
|
$formMapper
|
|
->add('name')
|
|
->add('name')
|
|
->add('description')
|
|
->add('description')
|
|
->add('enable')
|
|
->add('enable')
|
|
- ->add('type', 'choice', array('choices' => array('state_machine' => 'state_machine', 'workflow' => 'workflow')))
|
|
|
|
- ->add('markingType', 'choice', array('choices' => array('single_state' => 'single_state', 'multiple_state' => 'multiple_state')))
|
|
|
|
- ->add('markingName', 'choice', array('choices' => array('currentState' => 'currentState')))
|
|
|
|
- ->add('support', 'choice', array(
|
|
|
|
|
|
+ ->add('usedByDefault')
|
|
|
|
+ ->add('type', ChoiceType::class, array(
|
|
|
|
+ 'choices' => array(
|
|
|
|
+ 'state_machine' => 'state_machine',
|
|
|
|
+ 'workflow' => 'workflow',
|
|
|
|
+ )))
|
|
|
|
+ ->add('markingType', ChoiceType::class, array(
|
|
|
|
+ 'choices' => array(
|
|
|
|
+ 'single_state' => 'single_state',
|
|
|
|
+ 'multiple_state' => 'multiple_state',
|
|
|
|
+ )))
|
|
|
|
+ ->add('markingName', ChoiceType::class, array(
|
|
|
|
+ 'choices' => array(
|
|
|
|
+ 'currentState' => 'currentState',
|
|
|
|
+ )))
|
|
|
|
+ ->add('support', ChoiceType::class, array(
|
|
'choices' => array_filter(WorkFlowEntityClasses::getChoices(), 'class_exists'),
|
|
'choices' => array_filter(WorkFlowEntityClasses::getChoices(), 'class_exists'),
|
|
'multiple' => true,
|
|
'multiple' => true,
|
|
- 'required' => true
|
|
|
|
|
|
+ 'required' => true,
|
|
))
|
|
))
|
|
->add('template', null, $tempate_options)
|
|
->add('template', null, $tempate_options)
|
|
|
|
|
|
@@ -112,15 +131,7 @@ transitions:
|
|
'markingType' => $this->trans("helps.workflow_label_marking_type"),
|
|
'markingType' => $this->trans("helps.workflow_label_marking_type"),
|
|
'markingName' => $this->trans("helps.workflow_label_marking_name"),
|
|
'markingName' => $this->trans("helps.workflow_label_marking_name"),
|
|
'template' => $this->trans("helps.workflow_label_template"),
|
|
'template' => $this->trans("helps.workflow_label_template"),
|
|
- ))
|
|
|
|
- ;
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- if(is_null($this->getSubject()->getId())) {
|
|
|
|
- $formMapper
|
|
|
|
- ->add('subject', null, array('template' => 'WorkflowBundle:Workflow:'));
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -133,14 +144,16 @@ transitions:
|
|
->add('name')
|
|
->add('name')
|
|
->add('description')
|
|
->add('description')
|
|
->add('enable')
|
|
->add('enable')
|
|
|
|
+ ->add('usedByDefault')
|
|
->add('created')
|
|
->add('created')
|
|
->add('updated')
|
|
->add('updated')
|
|
->add('type')
|
|
->add('type')
|
|
->add('markingType')
|
|
->add('markingType')
|
|
->add('markingName')
|
|
->add('markingName')
|
|
->add('support')
|
|
->add('support')
|
|
- ->add('template','string', array('template' => 'WorkflowBundle:Workflow:show_template.html.twig'))
|
|
|
|
- ;
|
|
|
|
|
|
+ ->add('template','string', array(
|
|
|
|
+ 'template' => 'WorkflowBundle:Workflow:show_template.html.twig'
|
|
|
|
+ ));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|