|
@@ -7,7 +7,11 @@ use Sonata\AdminBundle\Datagrid\DatagridMapper;
|
|
|
use Sonata\AdminBundle\Datagrid\ListMapper;
|
|
|
use Sonata\AdminBundle\Form\FormMapper;
|
|
|
use Sonata\AdminBundle\Show\ShowMapper;
|
|
|
-use Symfony\Component\Yaml\Yaml;
|
|
|
+use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
|
+use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
|
+use WorkflowBundle\Utils\WorkFlowEntityClasses;
|
|
|
+use WorkflowBundle\Utils\WorkFlowEvents;
|
|
|
+use WorkflowBundle\Utils\DoctrineEvents;
|
|
|
|
|
|
class ActionAdmin extends BaseAdmin
|
|
|
{
|
|
@@ -32,11 +36,9 @@ class ActionAdmin extends BaseAdmin
|
|
|
{
|
|
|
$datagridMapper
|
|
|
->add('name')
|
|
|
- ->add('workflowType')
|
|
|
->add('workflowName')
|
|
|
->add('objectClass')
|
|
|
->add('event')
|
|
|
- ->add('template')
|
|
|
;
|
|
|
}
|
|
|
|
|
@@ -47,16 +49,17 @@ class ActionAdmin extends BaseAdmin
|
|
|
{
|
|
|
$listMapper
|
|
|
->add('name')
|
|
|
- ->add('workflowType')
|
|
|
->add('workflowName')
|
|
|
->add('objectClass')
|
|
|
- ->add('event')
|
|
|
+ ->add('event', 'html', array(
|
|
|
+ 'template' => 'BaseAdminBundle:Utils:badge_type.html.twig',
|
|
|
+ ))
|
|
|
->add('eventReference')
|
|
|
->add('_action', null, array(
|
|
|
'actions' => array(
|
|
|
'show' => array(),
|
|
|
'edit' => array(),
|
|
|
- 'delete' => array()
|
|
|
+ 'delete' => array(),
|
|
|
)
|
|
|
))
|
|
|
;
|
|
@@ -69,24 +72,43 @@ class ActionAdmin extends BaseAdmin
|
|
|
{
|
|
|
|
|
|
$formMapper
|
|
|
- ->add('name')
|
|
|
- ->add('workflowType', 'choice', array('choices' => array('state_machine' => 'state_machine', 'workflow' => 'workflow')))
|
|
|
- ->add('workflowName')
|
|
|
- ->add('objectClass', 'choice', array('choices' => array('FTTHBundle\Entity\ONU' => 'FTTHBundle\Entity\ONU', 'FTTHBundle\Entity\OLT' => 'FTTHBundle\Entity\OLT')))
|
|
|
- ->add('event', 'choice', array('choices' => array('transition' => 'transition', 'leave' => 'leave', 'enter' => 'enter', 'guard' => 'guard')))
|
|
|
- ->add('eventReference')
|
|
|
- ->add('template', null, array('attr' => array('style' => 'height:500px;')))
|
|
|
-
|
|
|
- ->setHelps(array(
|
|
|
- 'workflowType' => $this->trans("helps.action_label_workflow_type"),
|
|
|
- 'workflowName' => $this->trans("helps.action_label_workflow_name"),
|
|
|
- 'name' => $this->trans("helps.action_label_name"),
|
|
|
- 'objectClass' => $this->trans("helps.action_label_object_class"),
|
|
|
- 'event' => $this->trans("helps.action_label_event"),
|
|
|
- 'eventReference' => $this->trans("helps.action_label_event_reference"),
|
|
|
- 'template' => $this->trans("helps.action_label_template")
|
|
|
- ))
|
|
|
- ;
|
|
|
+ ->add('name')
|
|
|
+ ->add('event', ChoiceType::class, array(
|
|
|
+ 'choices' => array(
|
|
|
+ 'WorkFlow' => WorkFlowEvents::getChoices(),
|
|
|
+ 'Doctrine' => DoctrineEvents::getDoctrineEventChoices(),
|
|
|
+ ),
|
|
|
+ 'required' => false,
|
|
|
+ 'multiple' => true,
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ->add('workflowName', TextType::class, array(
|
|
|
+ 'required' => false,
|
|
|
+ ))
|
|
|
+ ->add('eventReference', TextType::class, array(
|
|
|
+ 'required' => false,
|
|
|
+ ))
|
|
|
+ ->add('objectClass', ChoiceType::class, array(
|
|
|
+ 'choices' => array_filter(WorkFlowEntityClasses::getChoices(), 'class_exists'),
|
|
|
+ 'required' => false,
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ->add('template', null, array(
|
|
|
+ 'attr' => array(
|
|
|
+ 'style' => 'height:500px;',
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ->setHelps(array(
|
|
|
+ 'workflowName' => $this->trans("helps.action_label_workflow_name"),
|
|
|
+ 'name' => $this->trans("helps.action_label_name"),
|
|
|
+ 'objectClass' => $this->trans("helps.action_label_object_class"),
|
|
|
+ 'event' => $this->trans("helps.action_label_event"),
|
|
|
+ 'eventReference' => $this->trans("helps.action_label_event_reference"),
|
|
|
+ 'template' => $this->trans("helps.action_label_template"),
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -97,13 +119,19 @@ class ActionAdmin extends BaseAdmin
|
|
|
$showMapper
|
|
|
->add('id')
|
|
|
->add('name')
|
|
|
- ->add('workflowType')
|
|
|
->add('workflowName')
|
|
|
->add('objectClass')
|
|
|
- ->add('event')
|
|
|
+ ->add('event', 'string', array(
|
|
|
+ 'template' => 'BaseAdminBundle:Utils:badge_field.html.twig',
|
|
|
+ ))
|
|
|
->add('eventReference')
|
|
|
- ->add('template','string', array('template' => 'WorkflowBundle:Action:show_template.html.twig'))
|
|
|
+ ->add('template','string', array(
|
|
|
+ 'template' => 'WorkflowBundle:Action:show_template.html.twig',
|
|
|
+ ))
|
|
|
;
|
|
|
+ $this->parameters = array(
|
|
|
+ 'template_type' => 'show',
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
}
|