/** * @return Nda */ public function getNda() { if (is_null($this->nda)) { $this->nda = new Nda(); if (!is_null($this->getCall())) { $arrayCollection = new ArrayCollection([$this->getCall()]); $this->nda->setCall($arrayCollection); } } return $this->nda; }
/** * {@inheritDoc} */ public function setUp() { $this->serviceManager = Bootstrap::getServiceManager(); $this->nda = new Nda(); $this->nda->setId(1); $contact = new Contact(); $contact->setId(1234); $this->nda->setContact($contact); $program = new Program(); $program->setId(1); $program->setProgram('Program'); $call = new Call(); $call->setId(1); $call->setCall("Call"); $call->setProgram($program); $this->nda->setCall(new ArrayCollection([$call])); $this->ndaLink = $this->serviceManager->get('viewhelpermanager')->get('ndaLink'); /** * Bootstrap the application to have the other information available */ $application = $this->serviceManager->get('application'); $application->bootstrap(); }
/** * Upload a NDA to the system and store it for the user * * @param array $file * @param Contact $contact * @param Call $call * * @return NdaObject */ public function uploadNda(array $file, Contact $contact, Call $call = null) { $ndaObject = new NdaObject(); $ndaObject->setObject(file_get_contents($file['tmp_name'])); $nda = new Nda(); $nda->setContact($contact); if (!is_null($call)) { $nda->setCall([$call]); } $nda->setSize($file['size']); $contentType = $this->getGeneralService()->findContentTypeByContentTypeName($file['type']); if (is_null($contentType)) { $contentType = $this->getGeneralService()->findEntityById('ContentType', 0); } $nda->setContentType($contentType); $ndaObject->setNda($nda); $this->newEntity($ndaObject); return $ndaObject->getNda(); }
/** * @return \Zend\Stdlib\ResponseInterface */ public function renderAction() { //Create an empty NDA object $nda = new Nda(); $nda->setContact($this->zfcUserAuthentication()->getIdentity()); /* * Add the call when a id is given */ if (!is_null($this->params('callId'))) { $call = $this->getCallService()->setCallId($this->params('callId'))->getCall(); if ($this->getCallService()->isEmpty()) { return $this->notFoundAction(); } $arrayCollection = new ArrayCollection([$call]); $nda->setCall($arrayCollection); $renderNda = $this->renderNda()->renderForCall($nda); } else { $renderNda = $this->renderNda()->render($nda); } $response = $this->getResponse(); $response->getHeaders()->addHeaderLine('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 36000))->addHeaderLine("Cache-Control: max-age=36000, must-revalidate")->addHeaderLine("Pragma: public")->addHeaderLine('Content-Disposition', 'attachment; filename="' . $nda->parseFileName() . '.pdf"')->addHeaderLine('Content-Type: application/pdf')->addHeaderLine('Content-Length', strlen($renderNda->getPDFData())); $response->setContent($renderNda->getPDFData()); return $response; }