public function createComponent($name)
 {
     switch ($name) {
         case 'settingsForm':
             $form = new AppForm($this, $name);
             // basic
             $form->addGroup(__('Basic'));
             $form->addText('shopName', __('Shop name:'))->addRule(Form::FILLED, __('You have to entry shop name.'));
             $form->addText('shopSlogan', __('Shop slogan:'))->addRule(Form::FILLED, __('You have to entry shop slogan.'));
             $form->addText('shopEmail', __('Contact e-mail:'))->addRule(Form::FILLED, __('You have to entry contact e-mail.'));
             // address
             $form->addGroup(__('Shop address'));
             $form->addText('shopAddressCompany', __('Company:'));
             $form->addText('shopAddressName', __('Name:'))->addRule(Form::FILLED, __('You have to entry name.'));
             $form->addText('shopAddressStreet', __('Street:'))->addRule(Form::FILLED, __('You have to entry street.'));
             $form->addText('shopAddressCity', __('City:'))->addRule(Form::FILLED, __('You have to entry city.'));
             $form->addText('shopAddressPostcode', __('Post code:'))->addRule(Form::FILLED, __('You have to entry post code.'));
             // miscellaneous
             $form->addGroup(__('Miscellaneous'));
             $form->addText('metaKeywords', __('META keywords:'))->addRule(Form::FILLED, __('You have to entry META keywords.'));
             $form->addText('metaDescription', __('META description:'))->addRule(Form::FILLED, __('You have to entry META description.'));
             $form->addText('currency', __('Currency:'))->addRule(Form::FILLED, __('You have to entry currency.'));
             $form->addText('itemsPerPage', __('Items per page:'))->addRule(Form::FILLED, __('You have to entry items per page.'))->addRule(Form::FILLED, __('Items per page has to be a number.'));
             $themes = array(0 => __('–––'));
             foreach (new DirectoryIterator(Environment::expand('%themeDir%')) as $_) {
                 if (!$_->isDot() && $_->isDir()) {
                     $themes[$_->getFilename()] = $_->getFilename();
                 }
             }
             $form->addSelect('theme', __('Theme:'), $themes)->skipFirst();
             $form['theme']->addRule(Form::FILLED, __('You have to select theme.'));
             // submit
             $form->setCurrentGroup(NULL);
             $form->addSubmit('ok', '✔ ' . __('Save'));
             $form->onSubmit[] = array($this, 'onSettingsFormSubmit');
             break;
         case 'changeLoginForm':
             $form = new AppForm($this, $name);
             $form->addText('username', __('Username:'******'You have to entry username.'));
             $form->addPassword('old_password', __('Old password:'******'You have to entry old password.'));
             $form->addPassword('new_password', __('New password:'******'You have to entry new password.'));
             $form->addPassword('new_password_again', __('New password (again):'))->addRule(Form::FILLED, __('You have to entry new password again.'))->addRule(Form::EQUAL, __('New passwords have to match.'), $form['new_password']);
             $form->addSubmit('ok', '✔ ' . __('Change'));
             $form->onSubmit[] = array($this, 'onChangeLoginFormSubmit');
             break;
         default:
             parent::createComponent($name);
     }
 }
Esempio n. 2
0
 /**
  * Login form component factory.
  * @return mixed
  */
 protected function createComponentLoginForm()
 {
     $form = new AppForm();
     $form->addText('username', 'Username:'******'Please provide an username.');
     $form->addPassword('password', 'Password:'******'Please provide a password.');
     $form->addSubmit('login', 'Login');
     $form->addProtection('Please submit this form again (security token has expired).');
     /**/
     $form->onSubmit[] = array($this, 'loginFormSubmitted');
     /**/
     /* PHP 5.3
     		$that = $this;
     		$form->onSubmit[] = function($form) use ($that) {
     			try {
     				$user = Environment::getUser();
     				$user->authenticate($form['username']->getValue(), $form['password']->getValue());
     				$that->getApplication()->restoreRequest($that->backlink);
     				$that->redirect('Dashboard:');
     
     			} catch (AuthenticationException $e) {
     				$form->addError($e->getMessage());
     			}
     		};*/
     return $form;
 }
Esempio n. 3
0
 protected function createComponentLoginForm()
 {
     $form = new AppForm();
     $form->addText('userName', 'Uživatelské jméno:')->addRule(Form::FILLED, "Uživatelské jméno musí být zadáno");
     $form->addPassword('password', 'Heslo:')->addRule(Form::FILLED, "Heslo musí být zadáno");
     $form->addSubmit('ok', 'Přihlásit')->onClick[] = array($this, 'okClicked');
     return $form;
 }
Esempio n. 4
0
 public function createComponentLoginForm()
 {
     $form = new AppForm();
     $form->addText('username', 'Uživatelské jméno:')->addRule(Form::FILLED, 'Vyplňte prosím uživatelské jméno.');
     $form->addPassword('password', 'Heslo:')->addRule(Form::FILLED, 'Vyplňte, prosím, heslo.');
     $form->addCheckbox('remember', 'Trvale přihlásit na tomto počítači');
     $form->addSubmit('login', 'Přihlásit se');
     $form->onSuccess[] = callback($this, 'loginFormSubmitted');
     return $form;
 }
 /**
  * Login form component factory.
  * @return mixed
  */
 protected function createComponentLoginForm()
 {
     $form = new AppForm();
     $form->addText('username', 'Username:'******'Please provide a username.');
     $form->addPassword('password', 'Password:'******'Please provide a password.');
     $form->addCheckbox('remember', 'Remember me on this computer');
     $form->addSubmit('login', 'Login');
     $form->onSubmit[] = callback($this, 'loginFormSubmitted');
     return $form;
 }
Esempio n. 6
0
 public function createComponent($name)
 {
     switch ($name) {
         case 'loginForm':
             $form = new AppForm($this, $name);
             $form->addText('username', __('Username:'******'password', __('Password:'******'ok', __('Login'));
             $form->onSubmit[] = array($this, 'onLoginFormSubmit');
             break;
         default:
             return parent::createComponent($name);
     }
 }
Esempio n. 7
0
 protected function createComponentAddEdit($name)
 {
     $mroles = new RolesModel();
     $roles = $mroles->getTreeValues();
     $form = new AppForm($this, $name);
     $renderer = $form->getRenderer();
     $renderer->wrappers['label']['suffix'] = ':';
     //$form->addGroup('Add');
     $form->addText('username', 'Name', 30)->addRule(Form::FILLED, 'You have to fill name.');
     if ($this->getAction() == 'add') {
         $form->addPassword('password', 'Password', 30)->addRule(Form::FILLED, 'You have to fill password.');
         $form->addPassword('password2', 'Reenter password', 30)->addRule(Form::FILLED, 'Reenter your password.')->addRule(Form::EQUAL, 'Passwords do not match.', $form['password']);
     }
     $form->addMultiSelect('roles', 'Roles', $roles, 15);
     if ($this->getAction() == 'add') {
         $form->addSubmit('add', 'Add');
     } else {
         $form->addSubmit('edit', 'Edit');
     }
     $form->onSubmit[] = array($this, 'addEditOnFormSubmitted');
 }