Example #1
0
 /**
  * Construcutor takes the application we want to display
  * @param \Jazzee\Entity\Application $application
  */
 public function __construct(\Jazzee\Entity\Application $application)
 {
     $applicantElements = array('firstName' => 'First Name', 'lastName' => 'Last Name', 'email' => 'Email', 'createdAt' => 'Created At', 'updatedAt' => 'Updated At', 'lastLogin' => 'Last Login', 'percentComplete' => 'Progress', 'isLocked' => 'Locked', 'lockedAt' => 'Last Locked', 'hasPaid' => 'Paid', 'externalId' => 'External ID', 'attachments' => 'Attachments', 'status_declined' => 'Declined', 'status_admitted' => 'Admitted', 'status_denied' => 'Denied', 'status_accepted' => 'Accepted', 'status_nominate_admit' => 'Nominate Admit', 'status_nominate_deny' => 'Nominate Deny');
     foreach ($application->getApplicants() as $applicant) {
         foreach ($applicant->getTags() as $tag) {
             $applicantElements[$tag->getId()] = $tag->getTitle();
         }
     }
     $weight = 0;
     foreach ($applicantElements as $name => $title) {
         $this->_elements[] = new \Jazzee\Display\Element('applicant', $title, $weight++, $name, null);
     }
     $pages = array();
     foreach ($application->getApplicationPages() as $applicationPage) {
         if (is_subclass_of($applicationPage->getPage()->getType()->getClass(), 'Jazzee\\Interfaces\\DataPage')) {
             foreach ($applicationPage->getJazzeePage()->listDisplayElements() as $displayElement) {
                 $this->_elements[] = $displayElement;
                 if ($displayElement->getType() == 'page') {
                     $this->_pageIds[] = $displayElement->getPageId();
                 } else {
                     if ($displayElement->getType() == 'element') {
                         $this->_elementIds[] = $displayElement->getName();
                         $this->_pageIds[] = $application->getElementById($displayElement->getName())->getPage()->getId();
                     }
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * Create a new display element from the Elements of another display
  * @param \Jazzee\Interfaces\DisplayElement $originalElement
  * @param \Jazzee\Entity\Application $application
  * 
  * @return \Jazzee\Interfaces\DisplayElement
  */
 public static function createFromDisplayElement(\Jazzee\Interfaces\DisplayElement $originalElement, \Jazzee\Entity\Application $application)
 {
     $displayElement = new \Jazzee\Entity\DisplayElement($originalElement->getType());
     switch ($originalElement->getType()) {
         case 'element':
             if (!($element = $application->getElementById($originalElement->getName()))) {
                 throw new \Jazzee\Exception("{$originalElement->getName()} is not a valid Jazzee Element ID, so it cannot be used in a 'element' display element.  Element: " . var_export($originalElement, true));
             }
             $displayElement->setElement($element);
             break;
         case 'page':
             if (!($applicationPage = $application->getApplicationPageByPageId($originalElement->getPageId())) and !($applicationPage = $application->getApplicationPageByChildPageId($originalElement->getPageId()))) {
                 throw new \Jazzee\Exception("{$originalElement->getPageId()} is not a valid Page ID, so it cannot be used in a 'page' display element.  Element: " . var_export($originalElement, true));
             }
             $displayElement->setPage($applicationPage->getPage());
         case 'applicant':
             $displayElement->setName($originalElement->getName());
             break;
     }
     $displayElement->setTitle($originalElement->getTitle());
     $displayElement->setWeight($originalElement->getWeight());
     return $displayElement;
 }