示例#1
0
 /**
  * @return Nette\Application\UI\Form
  */
 protected function createComponentTaskForm()
 {
     $userPairs = $this->userRepository->findAll()->fetchPairs('id', 'name');
     $form = new Form();
     $form->addText('text', 'Úkol:', 40, 100)->addRule(Form::FILLED, 'Je nutné zadat text úkolu.');
     $form->addSelect('userId', 'Pro:', $userPairs)->setPrompt('- Vyberte -')->addRule(Form::FILLED, 'Je nutné vybrat, komu je úkol přiřazen.')->setDefaultValue($this->getUser()->getId());
     $form->addSubmit('create', 'Vytvořit');
     $form->onSuccess[] = $this->taskFormSubmitted;
     return $form;
 }
示例#2
0
 public function actionEdit($id = NULL)
 {
     $this->template->username = '';
     $this->template->users = $this->userRepository->findAll();
     if ($id != NULL) {
         $this->editedUser = $this->userRepository->findById($id)->fetch();
         $this->template->username = $this->editedUser->username;
     }
     $this->invalidateControl('selecting');
 }