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; }
/** * 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; }
/** * 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; }