Beispiel #1
0
 public function __invoke($variables = null, $options = null, $template = null)
 {
     $viewModel = new JsonModel($variables, $options);
     if ($template) {
         $viewModel->setTemplate($template);
     }
     return $viewModel;
 }
 public function getjurisdictionproductformAction()
 {
     //$response = new \Zend\Http\Response();
     //$response->getHeaders()->addHeaderLine('Content-Type', 'text/xml; charset=utf-8');
     //$response->setContent($xml);
     $marketid = (int) $this->params()->fromQuery('marketid', 0);
     $marketproductId = (int) $this->params()->fromQuery('marketproductId', 0);
     $form = new \Zend\Form\Form();
     $marketJurisdictions = $this->getEntityManager()->getRepository('GDI\\Entity\\RMarketJurisdiction')->findByMarket($marketid);
     foreach ($marketJurisdictions as $key => $marketJurisdiction) {
         $jurisAbbr = $marketJurisdiction->getJurisdiction()->getJurisdictionAbbr();
         //$form->setHydrator(new DoctrineHydrator($this->getEntityManager(), 'GDI\Entity\TJurisdictionProduct'));
         $jurisdictionProduct = $this->getEntityManager()->getRepository('GDI\\Entity\\TJurisdictionProduct')->findOneBy(array('marketProduct' => $marketproductId, 'jurisdiction' => $marketJurisdiction->getJurisdiction()->getJurisdictionId()));
         //var_dump($jurisdictionProduct->getRSubmissionDate());
         //exit;
         //var_dump($jurisdictionProduct);
         //$form->bind($jurisdictionProduct);
         $form->setName('jurisdictionProduct');
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eSubmissionDate]", 'options' => array('label' => 'Submission (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getESubmissionDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eApprovalDate]", 'options' => array('label' => 'Approval (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getEApprovalDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eReleaseDate]", 'options' => array('label' => 'Master Release (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getEReleaseDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eLaunchDate]", 'options' => array('label' => 'Launch (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getELaunchDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eRegulatorDate]", 'options' => array('label' => 'Regulator (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getERegulatorDate(), 'class' => 'form-control')));
         // result
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rSubmissionDate]", 'options' => array('label' => 'Submission (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRSubmissionDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rApprovalDate]", 'options' => array('label' => 'Approval (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRApprovalDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rReleaseDate]", 'options' => array('label' => 'Master Release (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRReleaseDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rLaunchDate]", 'options' => array('label' => 'Launch (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRLaunchDate(), 'class' => 'form-control')));
         $form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rRegulatorDate]", 'options' => array('label' => 'Regulator (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRRegulatorDate(), 'class' => 'form-control')));
         /*if ($key>0) {
               var_dump($key);
               break;
           }*/
     }
     $request = $this->getRequest();
     if ($request->isPost()) {
         $form->setData($request->getPost());
         if ($form->isValid()) {
             //var_dump($product);
         }
     }
     $view = new JsonModel(array('form' => $form, 'marketJurisdictions' => $marketJurisdictions));
     //$view->setTemplate('Application/InputProductInformation/jurisdictionproductform.phtml'); // path to phtml file under view folder
     $view->setTemplate('GDI/Index2/jurisdictionproductform.phtml');
     // path to phtml file under view folder
     return $view;
 }