Exemplo n.º 1
0
 /**
  * PDF a full single applicant
  * @param \Jazzee\Entity\Applicant $applicant
  * @return string the PDF buffer suitable for display
  */
 public function pdf(\Jazzee\Entity\Applicant $applicant)
 {
     $this->setFont('p');
     $this->pdf->set_info("Title", $this->pdf->convert_to_unicode('utf8', $applicant->getFullName(), '') . ' Application');
     $this->addText($applicant->getFullName() . "\n", 'h1');
     $this->addText('Email Address: ' . $applicant->getEmail() . "\n", 'p');
     $this->write();
     foreach ($applicant->getApplication()->getApplicationPages(\Jazzee\Entity\ApplicationPage::APPLICATION) as $page) {
         if ($page->getJazzeePage() instanceof \Jazzee\Interfaces\PdfPage) {
             $page->getJazzeePage()->setApplicant($applicant);
             $page->getJazzeePage()->setController($this->_controller);
             $page->getJazzeePage()->renderPdfSection($this);
         }
     }
     $this->write();
     $this->pdf->end_page_ext("");
     $this->attachPdfs();
     $this->pdf->end_document("");
     return $this->pdf->get_buffer();
 }
Exemplo n.º 2
0
 /**
  * PDF a full single applicant
  * @param \Jazzee\Entity\Applicant $applicant
  * @return string the PDF buffer suitable for display
  */
 public function pdf(\Jazzee\Entity\Applicant $applicant)
 {
     $this->pdf->set_info("Title", $this->pdf->convert_to_unicode('utf8', $applicant->getFullName(), '') . ' Application');
     $this->addText($applicant->getFullName() . "\n", 'h1');
     $this->addText('Email Address: ' . $applicant->getEmail() . "\n", 'p');
     if ($applicant->isLocked()) {
         switch ($applicant->getDecision()->status()) {
             case 'finalDeny':
                 $status = 'Denied';
                 break;
             case 'finalAdmit':
                 $status = 'Admited';
                 break;
             case 'acceptOffer':
                 $status = 'Accepted';
                 break;
             case 'declineOffer':
                 $status = 'Declined';
                 break;
             default:
                 $status = 'No Decision';
         }
     } else {
         $status = 'Not Locked';
     }
     $this->addText("Admission Status: {$status}\n", 'p');
     $this->write();
     foreach ($applicant->getApplication()->getApplicationPages(\Jazzee\Entity\ApplicationPage::APPLICATION) as $page) {
         if ($page->getJazzeePage() instanceof \Jazzee\Interfaces\PdfPage) {
             $page->getJazzeePage()->setApplicant($applicant);
             $page->getJazzeePage()->setController($this->_controller);
             $page->getJazzeePage()->renderPdfSection($this);
         }
     }
     $this->write();
     $this->pdf->end_page_ext("");
     foreach ($applicant->getAttachments() as $attachment) {
         $this->addPdf($attachment->getAttachment());
     }
     $this->attachPdfs();
     $this->pdf->end_document("");
     return $this->pdf->get_buffer();
 }
Exemplo n.º 3
0
 /**
  * Get an applicants pdfs
  * @param \Jazzee\Entity\Applicant $applicant
  */
 public function getAttachments(\Jazzee\Entity\Applicant $applicant)
 {
     $attachments = array('attachments' => array(), 'allowAttach' => $this->checkIsAllowed($this->controllerName, 'attachApplicantPdf'), 'allowDelete' => $this->checkIsAllowed($this->controllerName, 'deleteApplicantPdf'));
     foreach ($applicant->getAttachments() as $attachment) {
         $base = $applicant->getFullName() . '_attachment_' . $attachment->getId();
         //remove slashes in path to fix an apache issues with encoding slashes in redirects
         $base = str_replace(array('/', '\\'), 'slash', $base);
         $pdfName = $base . '.pdf';
         $pngName = $base . 'preview.png';
         \Jazzee\Globals::getFileStore()->createSessionFile($pdfName, $attachment->getAttachmentHash());
         if ($attachment->getThumbnailHash() != null) {
             \Jazzee\Globals::getFileStore()->createSessionFile($pngName, $attachment->getThumbnailHash());
             $thumbnailPath = \Jazzee\Globals::path('file/' . \urlencode($pngName));
         } else {
             $thumbnailPath = \Jazzee\Globals::path('resource/foundation/media/default_pdf_logo.png');
         }
         $attachments['attachments'][] = array('id' => $attachment->getId(), 'filePath' => $this->path('file/' . \urlencode($pdfName)), 'previewPath' => $this->path('file/' . $thumbnailPath));
     }
     return $attachments;
 }
Exemplo n.º 4
0
 /**
  * PDF a full single applicant
  * @param \Jazzee\Entity\Applicant $applicant
  * @return string the PDF buffer suitable for display
  */
 public function pdf(\Jazzee\Entity\Applicant $applicant)
 {
     $elements = array('applicant' => array(), 'pages' => array());
     $elements['applicant']['firstName'] = $applicant->getFirstName();
     $elements['applicant']['lastName'] = $applicant->getLastName();
     $elements['applicant']['middleName'] = $applicant->getMiddleName();
     $elements['applicant']['fullName'] = $applicant->getFullName();
     $elements['applicant']['suffix'] = $applicant->getSuffix();
     $elements['applicant']['email'] = $applicant->getEmail();
     $elements['applicant']['id'] = $applicant->getId();
     $elements['applicant']['externalid'] = $applicant->getExternalId();
     if ($applicant->isLocked()) {
         switch ($applicant->getDecision()->status()) {
             case 'finalDeny':
                 $status = 'Denied';
                 break;
             case 'finalAdmit':
                 $status = 'Admited';
                 break;
             case 'acceptOffer':
                 $status = 'Accepted';
                 break;
             case 'declineOffer':
                 $status = 'Declined';
                 break;
             default:
                 $status = 'No Decision';
         }
     } else {
         $status = 'Not Locked';
     }
     $elements['applicant']['status'] = $status;
     foreach ($applicant->getApplication()->getApplicationPages() as $applicationPage) {
         if ($applicationPage->getJazzeePage() instanceof \Jazzee\Interfaces\PdfPage) {
             $applicationPage->getJazzeePage()->setApplicant($applicant);
             $applicationPage->getJazzeePage()->setController($this->_controller);
             $elements['pages'][$applicationPage->getPage()->getId()] = $applicationPage->getJazzeePage()->getPdfTemplateValues();
         }
     }
     return $this->generatePDF($elements);
 }