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