Ejemplo n.º 1
0
 /**
  * By default list the elements on a page
  * 
  * @return array
  */
 public function listDisplayElements()
 {
     $elements = array();
     $weight = 0;
     foreach ($this->_applicationPage->getPage()->getElements() as $element) {
         $elements[] = new \Jazzee\Display\Element('element', $element->getTitle(), $weight++, $element->getId(), $element->getPage()->getId());
     }
     $elements[] = new \Jazzee\Display\Element('page', $this->_applicationPage->getTitle() . ' Attacment', $weight++, 'attachment', $this->_applicationPage->getPage()->getId());
     $elements[] = new \Jazzee\Display\Element('page', $this->_applicationPage->getTitle() . ' Public Answer Status', $weight++, 'publicAnswerStatus', $this->_applicationPage->getPage()->getId());
     $elements[] = new \Jazzee\Display\Element('page', $this->_applicationPage->getTitle() . ' Private Answer Status', $weight++, 'privateAnswerStatus', $this->_applicationPage->getPage()->getId());
     return $elements;
 }
Ejemplo n.º 2
0
 /**
  * Compare this page to another page and list the differences
  *
  * @param \Jazzee\Entity\ApplicationPage $applicationPage
  */
 public function compareWith(\Jazzee\Entity\ApplicationPage $applicationPage)
 {
     $differences = array('different' => false, 'title' => $this->_applicationPage->getTitle(), 'properties' => array(), 'elements' => array('new' => array(), 'removed' => array(), 'same' => array(), 'changed' => array()), 'children' => array('new' => array(), 'removed' => array(), 'same' => array(), 'changed' => array()));
     $arr = array('title' => 'Title', 'name' => 'Name', 'instructions' => 'Instructions', 'leadingText' => 'Leading Text', 'trailingText' => 'Trailing Text');
     foreach ($arr as $name => $niceName) {
         $func = 'get' . ucfirst($name);
         if ($this->_applicationPage->{$func}() != $applicationPage->{$func}()) {
             $differences['different'] = true;
             $differences['properties'][] = array('name' => $niceName, 'type' => 'textdiff', 'this' => $this->_applicationPage->{$func}(), 'other' => $applicationPage->{$func}());
         }
     }
     return $differences;
 }
Ejemplo n.º 3
0
 /**
  * Make the form for the page
  * @return \Foundation\Form
  */
 public function makeForm()
 {
     $form = new \Foundation\Form();
     $form->setCSRFToken($this->_controller->getCSRFToken());
     $form->setAction($this->_controller->getActionPath());
     $field = $form->newField();
     $field->setLegend($this->_applicationPage->getTitle());
     $field->setInstructions($this->_applicationPage->getInstructions());
     $element = $field->newElement('TextInput', 'externalId');
     $element->setLabel($this->_applicationPage->getPage()->getVar('externalIdLabel'));
     $element->setValue($this->_applicant->getExternalId());
     $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
     $element->addValidator(new \Foundation\Form\Validator\SpecialObject($element, array('object' => $this->_applicationPage->getApplication(), 'method' => 'validateExternalId', 'errorMessage' => 'This is not a valid External ID.')));
     $form->newButton('submit', 'Save');
     return $form;
 }