public function createComponentForm() { $form = new \RequestButton\RequestButtonReceiver(); $form->setTranslator($this->translator); $form->addGroup('User'); /* if ($this->user->isAllowed('users','edit')) { $form->addText('login', 'Login:'******'username', 'Login:'******'Prosím, vlož username'); //} $form->addText('name', 'Name:')->addRule(Form::FILLED, 'Prosím, vlož jméno'); $form->addText('surname', 'Surname:')->addRule(Form::FILLED, 'Prosím, vlož příjmení'); $form->addSelect('role', 'Role:', $this->items->getRolesToSelect())->addRule(Form::FILLED, 'Please, select right user role.'); $form->addCheckbox('active', 'Active:'); $form->addSelect('country_id', 'Country:', $this->system->getCountriesToSelect())->addRule(Form::FILLED, 'Prosím, vlož stát')->setValue(208); $form->addRadioList('sex', 'Sex:', $this->system->getSexToSelect())->addRule(Form::FILLED, 'Prosím, vyber pohlaví'); $form->addGroup('Additional data'); $form->addText('email', 'E-mail:')->setEmptyValue('@')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'E-mail is not valid'); $form->addText('homepage', 'Homepage:')->addCondition(Form::FILLED)->addRule(Form::URL, 'Homepage is not valid'); $form->addText('telephone', 'telephone:'); $form->addText('street', 'Street:'); $form->addText('city', 'City:'); $form->addText('zip', 'Zip:'); $form->addText('icq', 'ICQ:'); $form->addText('aim', 'AIM:'); $form->addText('skype', 'Skype:'); $form->addText('jabber', 'Jabber:'); $form->addText('birthday', 'Birthday:'); $form->addTextArea('description', 'Description:'); $form->addGroup('Password'); $form->addPassword('heslokreslo', 'Password:'******'password1', 'Password again:')->addConditionOn($form['heslokreslo'], Form::FILLED, TRUE)->addRule(Form::FILLED, 'Prosím, vlož heslo znovu'); /* if ($this->user->isAllowed('users')) { $this['form']->addPassword('heslokreslo', 'Heslo:'); } else { $this['form']->addPassword('password', 'Heslo:')->addRule(Form::FILLED, 'Prosím, vlož heslo'); } $this['form']->addPassword('password1', 'Heslo znovu:') ->addConditionOn($this['form']['heslokreslo'], Form::FILLED, TRUE) ->addRule(Form::FILLED, 'Prosím, vlož heslo znovu'); */ /* if ($this->getView() == 'add') { $form->addSubmit('add', 'Save & Add next'); $form->addSubmit('leave', 'Save & Leave'); } else { $form->addHidden('id'); $form->addSubmit('leave', 'Save & Leave'); $form->addSubmit('add', 'Save & Add new'); } $form->addSubmit('save', 'Save'); $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked'; $form['cancel']->getControlPrototype()->class('cancel'); */ if (!$this->isRequestButton) { if ($this->getView() == 'add') { $form->addSubmit('add', 'Save & Add next')->getControlPrototype()->class('primary'); $form->addSubmit('leave', 'Save & Leave'); } else { $form->addHidden('id'); $form->addSubmit('leave', 'Save & Leave')->getControlPrototype()->class('primary'); $form->addSubmit('add', 'Save & Add new'); } $form->addSubmit('save', 'Save'); $form->addRequestButtonBack('back', 'Cancel & Back')->getControlPrototype(); $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE)->onClick[] = 'CancelClicked'; $form['cancel']->getControlPrototype()->class('cancel'); } else { $form->addSubmit('save', 'Save')->getControlPrototype()->class('primary'); $form->addRequestButtonBack('back', 'Cancel')->getControlPrototype()->class('cancel'); } $form->onSuccess[] = array($this, 'saveItem'); return $form; }