Exemplo n.º 1
0
 public function renderPdfSectionFromArray(array $answers, \Jazzee\ApplicantPDF $pdf)
 {
     $pdf->addText($this->_applicationPage->getTitle() . "\n", 'h3');
     if (!$this->_applicationPage->isRequired() and count($answers) and $this->getArrayStatus($answers) == self::SKIPPED) {
         $pdf->addText("Applicant Skipped this page.\n", 'p');
     } else {
         foreach ($answers as $answer) {
             $this->renderPdfAnswerFromArray($this->_applicationPage->getPage(), $pdf, $answer);
             $pdf->addText("\n", 'p');
         }
     }
 }
Exemplo n.º 2
0
 public function pdfValueFromArray(array $answerData, \Jazzee\ApplicantPDF $pdf)
 {
     foreach ($answerData['elements'] as $arr) {
         if ($arr['id'] == $this->_element->getId()) {
             $pdf->addPdf(\Jazzee\Globals::getFileStore()->getFileContents($arr["values"][0]["value"]));
             return 'Attached';
         }
     }
     return null;
 }
Exemplo n.º 3
0
 /**
  * Render a single answer in the PDF
  * @param \Jazzee\ApplicantPDF $pdf
  * @param \Jazzee\Entity\Page $page
  * @param \Jazzee\Entity\Answer $answer
  */
 protected function renderPdfAnswerFromArray(\Jazzee\Entity\Page $page, \Jazzee\ApplicantPDF $pdf, array $answerData)
 {
     $locationSummary = '';
     $schoolName = '';
     $schoolType = '';
     foreach ($answerData['elements'] as $element) {
         if ($element['id'] == 'locationSummary') {
             $locationSummary = $element['displayValue'];
         }
         if ($element['id'] == 'schoolName') {
             $schoolName = $element['displayValue'];
         }
         if ($element['id'] == 'schoolType') {
             $schoolType = $element['displayValue'];
         }
     }
     $pdf->addText("Type: ", 'b');
     $pdf->addText("{$schoolType}\n", 'p');
     $pdf->addText("School: ", 'b');
     $pdf->addText("{$schoolName}\n", 'p');
     $pdf->addText("Location: ", 'b');
     $pdf->addText("{$locationSummary}\n", 'p');
     parent::renderPdfAnswerFromArray($page, $pdf, $answerData);
 }
Exemplo n.º 4
0
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     //several views are controller by the complete action
     if (in_array($action, array('refreshTags', 'refreshPage', 'refreshSirPage'))) {
         $action = 'index';
     }
     if (in_array($action, array('do', 'doAction', 'pageDo', 'doPageAction'))) {
         $action = 'editAnswer';
     }
     if (in_array($action, array('pdf', 'pdftemplate'))) {
         $action = 'pdf';
     }
     //require a working ApplicantPDF class
     if (in_array($action, array('pdf'))) {
         if (!\Jazzee\ApplicantPDF::isAvailable()) {
             return false;
         }
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Exemplo n.º 5
0
 /**
  * Create a table from answers
  * and append any attached PDFs
  * @param \Jazzee\ApplicantPDF $pdf
  */
 public function renderPdfSection(\Jazzee\ApplicantPDF $pdf)
 {
     $pdf->addText($this->_applicationPage->getTitle() . "\n", 'h3');
     foreach ($this->getAnswers() as $answer) {
         foreach ($this->_applicationPage->getPage()->getElements() as $element) {
             $element->getJazzeeElement()->setController($this->_controller);
             $value = $element->getJazzeeElement()->pdfValue($answer, $pdf);
             if (!empty($value)) {
                 $pdf->addText("{$element->getTitle()}: ", 'b');
                 $pdf->addText("{$value}\n", 'p');
             }
         }
         if ($child = $answer->getChildren()->first()) {
             $jazzeePage = $this->_applicationPage->getPage()->getChildren()->first()->getApplicationPageJazzeePage();
             $jazzeePage->setApplicant($this->_applicant);
             $jazzeePage->setController($this->_controller);
             $jazzeePage->renderLorPdfAnswer($pdf, $this->_applicationPage->getPage()->getChildren()->first(), $child);
         }
         if (!$pdf instanceof \Jazzee\RestrictedPDF) {
             if ($attachment = $answer->getAttachment()) {
                 $pdf->addPdf($attachment->getAttachment());
             }
         }
         $pdf->addText("\n", 'p');
     }
 }
Exemplo n.º 6
0
 /**
  * Render standrad LOR pdf section
  * @param \Jazzee\ApplicantPDF $pdf
  * @param \Jazzee\Entity\Page $page
  * @param \Jazzee\Entity\Answer $answer
  */
 public function renderLorPdfAnswer(\Jazzee\ApplicantPDF $pdf, \Jazzee\Entity\Page $page, \Jazzee\Entity\Answer $answer)
 {
     $pdf->addText($page->getTitle() . "\n", 'h5');
     $this->renderPdfAnswer($pdf, $page, $answer);
 }
Exemplo n.º 7
0
 /**
  * Create a table from answers
  * and append any attached PDFs
  * @param \Jazzee\ApplicantPDF $pdf
  */
 public function renderPdfSection(\Jazzee\ApplicantPDF $pdf)
 {
     $pdf->addText($this->_applicationPage->getTitle() . "\n", 'h3');
     if ($this->getStatus() == \Jazzee\Interfaces\Page::SKIPPED) {
         $pdf->addText("Applicant Skipped this page.\n", 'p');
     } else {
         foreach ($this->getAnswers() as $answer) {
             $this->renderPdfAnswer($pdf, $this->_applicationPage->getPage(), $answer);
             if ($answer->getMatchedScore()) {
                 foreach ($answer->getMatchedScore()->getSummary() as $key => $value) {
                     $pdf->addText("{$key}: ", 'b');
                     $pdf->addText("{$value}\n", 'p');
                 }
             } else {
                 $pdf->addText('This score has not been received from ETS.', 'p');
             }
             $pdf->addText("\n", 'p');
         }
     }
 }
Exemplo n.º 8
0
 /**
  * Render branching LOR pdf section
  * @param \Jazzee\ApplicantPDF $pdf
  * @param \Jazzee\Entity\Page $page
  * @param \Jazzee\Entity\Answer $answer
  */
 public function renderLorPdfAnswer(\Jazzee\ApplicantPDF $pdf, \Jazzee\Entity\Page $page, \Jazzee\Entity\Answer $answer)
 {
     $childAnswer = $answer->getChildren()->first();
     $childPage = $childAnswer->getPage();
     $pdf->addText($page->getTitle() . "\n", 'h5');
     $pdf->addText("{$page->getVar('branchingElementLabel')}: ", 'b');
     $pdf->addText("{$childPage->getTitle()}\n", 'p');
     $this->renderPdfAnswer($pdf, $childPage, $childAnswer);
 }