Example #1
0
 public function getForm()
 {
     if (is_null($this->_form)) {
         $this->_form = $this->makeForm();
     }
     //reset the CSRF token on every request so when submission fails token validation doesn't even if the session has timed out
     $this->_form->setCSRFToken($this->_controller->getCSRFToken());
     return $this->_form;
 }
Example #2
0
 /**
  * Get the login form
  *
  * @return \Foundation\Form
  */
 public function getLoginForm()
 {
     if (is_null($this->_form)) {
         $this->_form = new \Foundation\Form();
         $this->_form->setCSRFToken($this->_controller->getCSRFToken());
         $this->_form->setAction($this->_controller->path("login"));
         $field = $this->_form->newField();
         $field->setLegend('Select a user');
         $element = $field->newElement('TextInput', 'apiKey');
         $element->setLabel('API Key');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $this->_form->newButton('submit', 'Login');
     }
     return $this->_form;
 }
Example #3
0
 public function getForm()
 {
     if (is_null($this->_form)) {
         $this->_form = new \Foundation\Form();
         $this->_form->setCSRFToken($this->_controller->getCSRFToken());
         $this->_form->setAction($this->_controller->getActionPath());
         $field = $this->_form->newField();
         $field->setLegend($this->_applicationPage->getTitle());
         $field->setInstructions($this->_applicationPage->getInstructions());
         $element = $field->newElement('RadioList', 'lock');
         $element->setLabel('Do you wish to lock your application?');
         $element->newItem(0, 'No');
         $element->newItem(1, 'Yes');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         $this->_form->newButton('submit', 'Submit Application');
     }
     return $this->_form;
 }
Example #4
0
 /**
  * Get the login form
  *
  * @return \Foundation\Form
  */
 public function getLoginForm()
 {
     if (is_null($this->_form)) {
         $this->_form = new \Foundation\Form();
         $this->_form->setCSRFToken($this->_controller->getCSRFToken());
         $this->_form->setAction($this->_controller->path("login"));
         $field = $this->_form->newField();
         $field->setLegend('Select a user');
         $element = $field->newElement('SelectList', 'userid');
         $element->setLabel('User');
         $element->addValidator(new \Foundation\Form\Validator\NotEmpty($element));
         foreach ($this->_controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\User')->findByName('%', '%') as $user) {
             if ($user->isActive()) {
                 $element->newItem($user->getId(), "{$user->getLastName()}, {$user->getFirstName()} - {$user->getEmail()}");
             }
         }
         $this->_form->newButton('submit', 'Login');
     }
     return $this->_form;
 }
Example #5
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;
 }