/** * Get the template pdf values of the element from array data * Takes all the answers and returns a single string that sumerizes the data * * @param array $answers * @return string */ function pdfTemplateValueFromArray(array $answers) { $values = array(); foreach ($answers as $answer) { if (array_key_exists($this->_element->getId(), $answer['elements'])) { $arr = $this->formatApplicantArray($answer['elements'][$this->_element->getId()]); foreach ($arr['values'] as $arr2) { $values[] = $arr2['value']; } } } return implode("\n", $values); }
/** * Should an Element be displayed * @param \Jazzee\Entity\Element $element * * @return boolean */ public function displayElement(\Jazzee\Entity\Element $element) { return in_array($element->getId(), $this->_elementIds); }
/** * Add element * * @param Entity\Element $element */ public function addElement(\Jazzee\Entity\Element $element) { $this->elements[] = $element; if ($element->getPage() != $this) { $element->setPage($this); } }
/** * Crate a generic element to use in previewing a page * @param \Jazzee\Entity\Element $element that we are workign with * @param stdClass $obj */ protected function genericElement(\Jazzee\Entity\Element $element, \stdClass $obj) { $element->tempId(); $element->setType($this->_em->getRepository('\\Jazzee\\Entity\\ElementType')->find($obj->typeId)); $element->setTitle($obj->title); $element->setTitle($obj->title); $element->setFormat(empty($obj->format) ? null : $obj->format); $element->setInstructions(empty($obj->instructions) ? null : $obj->instructions); $element->setDefaultValue(empty($obj->defaultValue) ? null : $obj->defaultValue); if ($obj->isRequired) { $element->required(); } else { $element->optional(); } $element->setMin(empty($obj->min) ? null : $obj->min); $element->setMax(empty($obj->max) ? null : $obj->max); foreach ($obj->list as $i) { $item = new \Jazzee\Entity\ElementListItem(); $item->tempId(); $element->addItem($item); $item->setValue($i->value); if ($item->isActive()) { $item->activate(); } else { $item->deActivate(); } } }