コード例 #1
0
 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function listAction(Request $request = null)
 {
     if (!$request->get('filter')) {
         return new RedirectResponse($this->admin->generateUrl('tree'));
     }
     return parent::listAction();
 }
コード例 #2
0
 public function listAction(Request $request = null)
 {
     if (!$this->admin->getRequest()->get('form_id')) {
         return $this->formsListAction();
     }
     return parent::listAction();
 }
コード例 #3
0
 public function testListAction()
 {
     $datagrid = $this->getMock('Sonata\\AdminBundle\\Datagrid\\DatagridInterface');
     $this->admin->expects($this->once())->method('isGranted')->with($this->equalTo('LIST'))->will($this->returnValue(true));
     $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
     $form->expects($this->once())->method('createView')->will($this->returnValue($this->getMock('Symfony\\Component\\Form\\FormView')));
     $this->admin->expects($this->once())->method('getDatagrid')->will($this->returnValue($datagrid));
     $datagrid->expects($this->once())->method('getForm')->will($this->returnValue($form));
     $this->parameters = array();
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $this->controller->listAction());
     $this->assertSame($this->admin, $this->parameters['admin']);
     $this->assertSame('SonataAdminBundle::standard_layout.html.twig', $this->parameters['base_template']);
     $this->assertSame($this->pool, $this->parameters['admin_pool']);
     $this->assertSame('list', $this->parameters['action']);
     $this->assertInstanceOf('Symfony\\Component\\Form\\FormView', $this->parameters['form']);
     $this->assertInstanceOf('Sonata\\AdminBundle\\Datagrid\\DatagridInterface', $this->parameters['datagrid']);
     $this->assertSame('csrf-token-123_sonata.batch', $this->parameters['csrf_token']);
     $this->assertSame(array(), $this->session->getFlashBag()->all());
     $this->assertSame('SonataAdminBundle:CRUD:list.html.twig', $this->template);
 }
コード例 #4
0
 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function listAction()
 {
     $user = \AppKernel::getStaticContainer()->get('security.context')->getToken()->getUser();
     $this->jsSettingsJson(array('isSuperviseur' => $user->hasGroup('Superviseur')));
     return $this->_action(parent::listAction(), 'list');
 }
コード例 #5
0
 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function listAction()
 {
     $this->getLocking();
     $this->_initClientDocuments();
     $action = $this->_action(parent::listAction(), 'list', 'list_layout');
     return $action;
 }
コード例 #6
0
 /**
  * Welcome controller.
  *
  * @Route("/list" , name="project_list")
  * @Method("GET|POST")
  * @Template()
  *    
  */
 public function listAction(Request $request = NULL)
 {
     $_sonata_admin = array();
     parent::listAction($request);
 }