Пример #1
0
 /**
  * Show rack
  *
  * @Route("/show/{id}")
  * @Template()
  *
  * @param mixed $id
  *
  * @return Symfony\Component\HttpFoundation\Response
  */
 public function showAction($id)
 {
     $rack = $this->getEntity($id);
     $response = parent::showAction($rack);
     $form = $this->createForm(new SelectType('VIB\\FliesBundle\\Entity\\Vial'));
     $request = $this->getRequest();
     if ($request->getMethod() == 'POST') {
         $postForm = $request->request->get('select');
         $action = is_array($postForm) ? $postForm['action'] : '';
         if ($action == 'incubate') {
             $form->bind($request);
             if ($form->isValid()) {
                 $data = $form->getData();
                 $this->incubateRack($rack, $data['incubator']);
             }
         } else {
             $this->setBatchActionRedirect();
             $selectResponse = $this->forward('VIBFliesBundle:Vial:select');
             if ($action == 'flip' || $action == 'label' || $action == 'edit' || $action == 'permissions' || $selectResponse->getStatusCode() >= 400) {
                 return $selectResponse;
             }
         }
     }
     return is_array($response) ? array_merge($response, array('form' => $form->createView())) : $response;
 }
Пример #2
0
 /**
  * Show stock
  *
  * @Route("/show/{id}")
  * @Template()
  *
  * @param mixed $id
  *
  * @return Symfony\Component\HttpFoundation\Response
  */
 public function showAction($id)
 {
     $stock = $this->getEntity($id);
     $response = parent::showAction($stock);
     $om = $this->getObjectManager();
     $filter = new VialFilter(null, $this->getSecurityContext());
     $filter->setAccess('private');
     $myVials = $om->getRepository('VIB\\FliesBundle\\Entity\\StockVial')->findLivingVialsByStock($stock, $filter);
     $small = new ArrayCollection();
     $medium = new ArrayCollection();
     $large = new ArrayCollection();
     foreach ($myVials as $vial) {
         switch ($vial->getSize()) {
             case 'small':
                 $small->add($vial);
                 break;
             case 'medium':
                 $medium->add($vial);
                 break;
             case 'large':
                 $large->add($vial);
                 break;
         }
     }
     $vials = array('small' => $small, 'medium' => $medium, 'large' => $large);
     return is_array($response) ? array_merge($response, $vials) : $response;
 }
Пример #3
0
 /**
  * Show vial
  *
  * @Route("/show/{id}")
  * @Template()
  *
  * @param  mixed                                      $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function showAction($id)
 {
     $vial = $this->getEntity($id);
     if ($this->controls($vial)) {
         return parent::showAction($vial);
     } else {
         return $this->getVialRedirect($vial);
     }
 }