123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- namespace WorkflowBundle\Admin;
- use Base\AdminBundle\Admin\BaseAdmin;
- 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;
- class ActionAdmin extends BaseAdmin
- {
- public function getTemplate($name)
- {
- switch ($name) {
- case 'edit':
- return 'WorkflowBundle:Action:action_edit.html.twig';
- break;
- default:
- return parent::getTemplate($name);
- break;
- }
- }
- /**
- * @param DatagridMapper $datagridMapper
- */
- protected function configureDatagridFilters(DatagridMapper $datagridMapper)
- {
- $datagridMapper
- ->add('name')
- ->add('workflowType')
- ->add('workflowName')
- ->add('objectClass')
- ->add('event')
- ->add('template')
- ;
- }
- /**
- * @param ListMapper $listMapper
- */
- protected function configureListFields(ListMapper $listMapper)
- {
- $listMapper
- ->add('name')
- ->add('workflowType')
- ->add('workflowName')
- ->add('objectClass')
- ->add('event')
- ->add('eventReference')
- ->add('_action', null, array(
- 'actions' => array(
- 'show' => array(),
- 'edit' => array(),
- 'delete' => array()
- )
- ))
- ;
- }
- /**
- * @param FormMapper $formMapper
- */
- protected function configureFormFields(FormMapper $formMapper)
- {
- $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")
- ))
- ;
- }
- /**
- * @param ShowMapper $showMapper
- */
- protected function configureShowFields(ShowMapper $showMapper)
- {
- $showMapper
- ->add('id')
- ->add('name')
- ->add('workflowType')
- ->add('workflowName')
- ->add('objectClass')
- ->add('event')
- ->add('eventReference')
- ->add('template','string', array('template' => 'WorkflowBundle:Action:show_template.html.twig'))
- ;
- }
- }
|