示例#1
0
 protected function createComponentAddSupplierForm($name)
 {
     $f = new NAppForm($this, $name);
     $f->addText('name', _('Názov dodávateľa'))->addRule(NForm::FILLED, _('Názov dodávateľa musí byť vyplnený'));
     $f->addSubmit('btn_add_supplier', _('Pridať'));
     $f->onSuccess[] = array($this, 'handleAddSupplier');
 }
示例#2
0
 protected function createComponentEventForm()
 {
     $form = new NAppForm();
     $form->addText('name', 'Name of the event:')->setRequired('Please provide a name.');
     $form->addCheckbox('finished', 'Finished');
     $form->addSubmit('send', 'Create');
     $form->onSuccess[] = callback($this, 'eventFormSubmitted');
     return $form;
 }
示例#3
0
 protected function createComponentGroupForm($id = 0)
 {
     $this->events = $this->getService('model')->getEvents();
     $form = new NAppForm();
     $form->addText('name', 'Name of the group:')->setRequired('Please provide a name.');
     $events = $this->events->fetchPairs('id', 'name');
     $form->addSelect('eventID', 'Group in event', $events)->setDefaultValue((int) $this->getParam('id'));
     $form->addSubmit('send', 'Create');
     $form->onSuccess[] = callback($this, 'groupFormSubmitted');
     return $form;
 }
示例#4
0
 public function captchaProcess(NAppForm $form)
 {
     // vypise chyby z komponenty..
     if ($form['captcha']->hasError()) {
         var_dump($form['captcha']->getErrors());
     }
     if ($form->isSubmitted()) {
         echo "Formular se povedlo odeslat:<br>";
         var_dump($form->values);
     }
 }
示例#5
0
 public function newsFormSubmited(NAppForm $form)
 {
     if ($form['addnews']->isSubmittedBy()) {
         $values = $form->getValues();
         $id = (int) $this->getParam('id');
         $ref = new News(array('id' => $id));
         if ($id > 0) {
             $ref->update($id, $values);
         } else {
             $ref->insert($values);
         }
         $this->flashMessage('Novinka uložena.');
     }
     $this->redirect('News:default');
 }
示例#6
0
 public function __construct($values)
 {
     parent::__construct();
     $this->addHidden('id_osoby', $values['id_osoby']);
     $this->addHidden('klic', $values['klic']);
     $this->addSubmit('send', 'Ano');
 }
示例#7
0
文件: loginForm.php 项目: krecek/nrsn
 public function __construct()
 {
     parent::__construct();
     $this->addText('username', 'Uživatelské jméno:')->setRequired('Vyplňte uživatelské jméno.')->setAttribute('class', 'focus');
     $this->addPassword('password', 'Heslo:')->setRequired('Vyplňte heslo.');
     $this->addSubmit('send', 'Přihlásit');
 }
示例#8
0
 public function __construct($values = null)
 {
     parent::__construct();
     for ($i = 1; $i <= $this->pocet_polozek; $i++) {
         $this->addText("nazev_{$i}", "Název:", 40);
         $this->addText("url_{$i}", "Url:", 40);
         $this->addHidden("poradi_{$i}");
         $this->addHidden("id_{$i}");
     }
     $this->addSubmit('send', 'Uložit');
     if ($values) {
         foreach ($values as $key => $polozka) {
             if (isset($this["nazev_{$key}"])) {
                 $this["nazev_{$key}"]->setDefaultValue($polozka['nazev']);
             }
             if (isset($this["url_{$key}"])) {
                 $this["url_{$key}"]->setDefaultValue($polozka['url']);
             }
             if (isset($this["poradi_{$key}"])) {
                 $this["poradi_{$key}"]->setDefaultValue($polozka['poradi']);
             }
             if (isset($this["id_{$key}"])) {
                 $this["id_{$key}"]->setDefaultValue($polozka['id']);
             }
         }
     }
 }
示例#9
0
 public function __construct($rubriky, $povolene_rubriky = null, $values = null)
 {
     $povolit_zmenu_url = TRUE;
     if (isset($values->zamek) && $values['zamek'] == 'A') {
         $povolit_zmenu_url = FALSE;
     }
     dd($povolit_zmenu_url, 'změna');
     parent::__construct();
     if (!$povolene_rubriky) {
         $polozky = $rubriky;
     } else {
         foreach ($rubriky as $key => $rubrika) {
             $zakazano = in_array($key, $povolene_rubriky) ? FALSE : TRUE;
             $polozky[$key] = NHtml::el('option')->value($key)->setHtml($rubrika)->disabled($zakazano);
         }
     }
     $this->addSelect('rodic', 'Nadřazená rubrika', $polozky)->setPrompt('--- Zvolte rubriku ----')->setRequired('Zvolte nadřazenou rubriku.');
     $this->addText('nazev', 'Název', 30)->setRequired('Zadejte název rubriky.');
     $this->addText('url', 'Url', 30)->addCondition(NForm::FILLED)->addRule(NForm::PATTERN, 'Url obsahuje nepovolené znaky.', '[0-9a-z][0-9a-z\\-]*');
     if (!$povolit_zmenu_url) {
         $this['url']->setDisabled()->setAttribute('title', 'Adresa je chráněna proti přepsání');
     }
     //        $this->addText('url', 'Url', 30)->addRule(NForm::PATTERN, 'Url obsahuje nepovolené znaky.', '[0-9]*');
     $this->addSubmit('send', 'Uložit');
     if ($values) {
         $this->setDefaults($values);
     }
 }
示例#10
0
文件: mailForm.php 项目: krecek/nrsn
 public function __construct()
 {
     parent::__construct();
     $this->addText('subject', 'Předmět')->setRequired('Zadejte předmět zprávy');
     $this->addTextArea('message', 'Zpráva')->setRequired('Vyplňte text zprávy');
     $this->addSubmit('send', 'Odeslat');
 }
示例#11
0
 public function __construct($uzivatelske_jmeno = null)
 {
     parent::__construct();
     $this->addText('jmeno', 'Současné uživatelské jméno: ')->setDefaultValue($uzivatelske_jmeno)->setDisabled();
     $this->addText('username', 'Nové uživatelské jméno: ')->setRequired('Zadejte nové uživatelské jméno')->addRule(NForm::MAX_LENGTH, 'Uživatelské jméno může mít maximálně %d znaků', 50);
     $this->addPassword('password', 'Heslo: ')->setRequired('Zadejte stávající heslo');
     $this->addSubmit('send', 'Uložit');
 }
示例#12
0
 public function __construct()
 {
     parent::__construct();
     $this->addPassword('old_password', 'Zadejte staré heslo: ')->setRequired('Zadejte staré heslo.');
     $this->addPassword('password', 'Zadejte nové heslo: ')->setRequired('Zadejte nové heslo');
     $this->addPassword('confirm_password', 'Potvrďte nové heslo')->setRequired('Nové heslo je nutné zadat ještě jednou pro potvrzení.')->addRule(NForm::EQUAL, 'Zadaná hesla se musí shodovat.', $this['password']);
     $this->addSubmit('send', 'Uložit');
 }
示例#13
0
 public function SignOnFormSubmitted(NAppForm $form)
 {
     // Login form submitted
     try {
         $this->user->login($form['name']->getValue(), $form['password']->getValue());
         $this->user->setExpiration(30 * 60, TRUE, TRUE);
         // set expiration 30 minuts
         if (ACL_CACHING) {
             unset($this->cache['gui_acl']);
             // invalidate cache
         }
         $this->redirect('Default:');
     } catch (NAuthenticationException $e) {
         $form->addError($e->getMessage());
         $form->setValues(array('name' => ''));
     }
 }
示例#14
0
 function createComponent($name)
 {
     switch ($name) {
         case 'loginForm':
             $form = new NAppForm();
             $form->getElementPrototype()->addClass('ajax');
             $form->addText('login', _('Prihlasovacie meno'))->addRule(NFORM::FILLED, _('Prihlasovacie meno musí byť vyplnené'));
             $form->addPassword('password', 'Heslo')->addRule(NFORM::FILLED, _('Heslo musí byť vyplnené.'));
             $form->addSubmit('btn_submit', _('Prihlásiť sa'));
             $form->addHidden('backlink');
             $form->onSuccess[] = array($this, 'onSubmitAuthenticate');
             $this->addComponent($form, $name);
             break;
         case 'cartLoginForm':
             $form = new NAppForm();
             $form->getElementPrototype()->addClass('ajax');
             $form->addText('login', _('Prihlasovacie meno'))->addRule(NFORM::FILLED, _('Prihlasovacie meno musí byť vyplnené'));
             $form->addPassword('password', 'Heslo')->addRule(NFORM::FILLED, _('Heslo musí byť vyplnené.'));
             $form->addSubmit('btn_submit', _('Prihlásiť sa'));
             $form->addHidden('backlink');
             $form->onSuccess[] = array($this, 'onSubmitAuthenticate');
             //				dump($form);exit;
             $this->addComponent($form, $name);
             break;
         default:
             return parent::__construct();
             break;
     }
 }
示例#15
0
 /**
  * Send contact form
  * @return void
  */
 public function popFormSubmited(NAppForm $form)
 {
     if ($form['popsend']->isSubmittedBy()) {
         $values = $form->getValues();
         $this->invalidateControl('popup');
         $this->template->poptavka = $this->thankYou();
         $body = $values['body'] . "\n\nKontakt: " . $values['contact'];
         $addTo = $this->getPerson($values['id']);
         $addTo = $addTo['email'];
         $mail = new NMail();
         $mail->setFrom('Firemni web <*****@*****.**>');
         $mail->addTo($addTo);
         //$mail->addTo('*****@*****.**');
         $mail->setSubject('Zprava z firemniho webu');
         $mail->setBody($body);
         $mail->send();
     }
 }
示例#16
0
 public function __construct($pocet_poli = 5)
 {
     parent::__construct();
     for ($i = 0; $i < $pocet_poli; $i++) {
         $this->addUpload('soubor_' . $i, 'Soubor:');
         //->addRule(NForm::MIME_TYPE, 'Nepovolený typ souboru.', 'image/png');
     }
     $this->addSubmit('send', 'Uložit soubory');
 }
示例#17
0
 /**
  * 
  * @param str Text před vyhledávacím polem
  * @param str třída vyhledávacího pole
  */
 public function __construct($text, $class = null, $focus = TRUE)
 {
     parent::__construct();
     $focus = $focus ? 'focus' : '';
     $this->addText('popis', $text)->setAttribute('class', $focus . ' ' . $class);
     $this->addHidden('id', '');
     $this->addSubmit('send', 'Vyhledat');
     $this->getElementPrototype()->addAttributes(array('class' => 'vyhledat_form'));
 }
示例#18
0
文件: MyForm.php 项目: oaki/demoshop
 function __construct(IComponentContainer $parent = NULL, $name = NULL)
 {
     NForm::extensionMethod('addDateTimePicker', 'MyForm::Form_addDateTimePicker');
     parent::__construct($parent, $name);
     $t = NEnvironment::getApplication()->getPresenter()->getService('translator');
     $t->setLang(NEnvironment::getApplication()->getPresenter()->lang);
     $this->setTranslator($t);
     NFormContainer::extensionMethod('NFormContainer::addRecaptcha', array('reCAPTCHA', 'addRecaptcha'));
 }
示例#19
0
 public function __construct($items = null, $value = null)
 {
     parent::__construct();
     $this->addSelect('prava', 'Oprávnění: ', $items);
     $this->addSubmit('send', 'Uložit');
     if (isset($value)) {
         $this['prava']->setDefaultValue($value);
     }
 }
示例#20
0
 protected function createComponentTeamForm()
 {
     $events = $this->getService('model')->getEvents();
     $groups = array();
     foreach ($events as $event) {
         $g = $this->getService('model')->getGroups()->where('eventID', $event->id);
         $o = array();
         foreach ($g as $group) {
             $o[$group->id] = $group->name;
         }
         $groups[$event->name] = $o;
     }
     $form = new NAppForm();
     $form->addText('name', 'Name of the team:')->setRequired('Please provide a name.');
     $select = $form->addSelect('groupID', 'Group:', $groups)->setDefaultValue((int) $this->getParam('id'));
     $form->addSubmit('send', 'Create');
     $form->onSuccess[] = callback($this, 'teamFormSubmitted');
     return $form;
 }
示例#21
0
 public function __construct($name, $label = null, $items = null, $selected_value = null, $odesilaci_tlacitko = 'Odeslat', $automaticke_odeslani = TRUE, $size = null)
 {
     parent::__construct();
     $select = $this->addSelect($name, $label, $items, $size);
     if ($automaticke_odeslani) {
         $select->setAttribute('onchange', 'submit()');
     }
     if ($selected_value) {
         $select->setDefaultValue($selected_value);
     }
     $this->addSubmit('send', $odesilaci_tlacitko);
 }
示例#22
0
 function createComponentCommentAnswerForm()
 {
     $form = new NAppForm();
     $form->addProtection('Bohužial Váš formulár expiroval. Prosím odošlite formulár znovu.', 360);
     $form->addText('name', 'Meno: ')->addRule(NForm::FILLED, 'Meno musí byť vyplnené.')->getLabelPrototype()->addId('commentAnswerFormNameLabel');
     $form->addTextArea('text', 'Text: ')->addRule(NForm::FILLED, 'Text musí byť vyplnený.')->getLabelPrototype()->addId('commentAnswerFormTextLabel');
     $form->addSubmit('submitComment', 'Pridať');
     //			->onClick[] =  'processCommentForm');
     $form->addHidden('id_node');
     $form->addHidden('comment_parent');
     //			->setValue($id_node);
     $form->onSuccess[] = array($this, 'processCommentForm');
     //		$form->setDefaults(array('name'=>'palo', 'text'=>'tessslks isnks'));
     return $form;
 }
示例#23
0
 protected function createComponent($name)
 {
     switch ($name) {
         case 'lostPasswordForm':
             $form = new NAppForm();
             $form->addText('login', 'Prihlasovacie meno/Email')->addRule(NFORM::FILLED, 'Prihlasovacie meno musí byť vyplnené.');
             //				$form->addText('email', 'Emailová adresa')
             //					->addRule(NFORM::EMAIL,'Emailová adresa nie je v správnom tvare.');
             //
             $form->addSubmit('btn_submit_lost_password', 'Odoslať')->getControlPrototype()->class = 'classic-btn border-radius-2';
             $form->onSuccess[] = array($this, 'sendLostPassword');
             return $form;
             break;
         case 'registrationForm':
             $form = $this->createComponent('userBaseForm');
             $form['password']->addRule(NForm::FILLED, _('Heslo musí byť vyplnené'))->addRule(NForm::MIN_LENGTH, _('Minimálny počet znakov pre heslo je %s'), 5);
             $form->addGroup('');
             $form->addSubmit('btn_user_form', _('Registrovať'))->getControlPrototype()->class = 'classic-btn border-radius-2';
             $form->onSuccess[] = array($this, 'saveRegistration');
             return $form;
             break;
         case 'profilForm':
             $form = $this->createComponent('userBaseForm');
             //				$form['btn_user_form']->setValues('Uložiť');
             $form->setDefaults($this->user->getIdentity()->data);
             //				print_r($this->user->getIdentity()->data);
             $form->addGroup();
             $form->addSubmit('btn_user_form', _('Uložiť'))->getControlPrototype()->class = 'classic-btn border-radius-2';
             $form->onSuccess[] = array($this, 'saveProfil');
             return $form;
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }
示例#24
0
 protected function createComponentLoginForm()
 {
     $form = new NAppForm();
     $form->addText('username', 'Login:'******'Vyplňtě prosím login.');
     $form->addPassword('password', 'Heslo:')->addRule(NForm::FILLED, 'Vyplňte prosím heslo.');
     $form->addCheckbox('remember', 'Zůstat přihlášen na tomto počítači.');
     $form->addSubmit('login', 'Přihlásit');
     $form->onSubmit[] = callback($this, 'loginFormSubmitted');
     return $form;
 }
示例#25
0
 /**
  * Login form component factory.
  * @return mixed
  */
 protected function createComponentLoginForm()
 {
     $form = new NAppForm();
     $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;
 }
示例#26
0
 /**
  * Sign up form component factory.
  * @return NAppForm
  */
 protected function createComponentSignUpForm()
 {
     $form = new NAppForm();
     $form->addText('name', 'Name:')->setRequired('Please provide a name.');
     $form->addText('username', 'Username:'******'Please provide a username.');
     $form->addPassword('password', 'Password:'******'Please provide a password.');
     $form->addSubmit('send', 'Sign up');
     $form->onSuccess[] = callback($this, 'signUpFormSubmitted');
     return $form;
 }
示例#27
0
 public function __construct($values, $prefix = '')
 {
     parent::__construct();
     $this->prefix = $prefix;
     $this->addText($prefix . 'datum', 'Datum')->setAttribute('class', 'datepicker');
     $this->addText($prefix . 'cas', 'Čas')->addRule(NForm::PATTERN, 'Zadejte ve tvaru 04:56', '(([0-1][0-9])|(2[0-3])|([0-9])):([0-5][0-9])');
     $this->addSubmit('send', 'Uložit');
     $this->onValidate[] = callback($this, 'kontrolaDatumu');
     if ($values) {
         foreach ($values as $key => $value) {
             if (isset($this[$prefix . $key])) {
                 $this[$prefix . $key]->setDefaultValue($value);
             }
         }
     }
 }
示例#28
0
 public function __construct($values)
 {
     parent::__construct();
     $this->addCheckbox('galerie', 'Zobazit galerii');
     $this->addCheckbox('prilohy', 'Zobrazit seznam příloh');
     $this->addCheckbox('zobrazit_obr', 'Zobrazit hlavní obrázek článku (pod perexem)');
     $this->addSubmit('send', 'Uložit');
     if (isset($values)) {
         foreach ($values as $key => $value) {
             if ($value == 'A') {
                 $values[$key] = TRUE;
             } elseif ($value == 'N') {
                 $values[$key] = FALSE;
             }
         }
         $this->setDefaults($values);
     }
 }
示例#29
0
 public function __construct($rubriky, $povolene_rubriky = null, $values = null)
 {
     dd($povolene_rubriky, 'povolene_rubriky');
     parent::__construct();
     if (!$povolene_rubriky) {
         $polozky = $rubriky;
     } else {
         foreach ($rubriky as $key => $rubrika) {
             $zakazano = in_array($key, $povolene_rubriky) ? FALSE : TRUE;
             $polozky[$key] = NHtml::el('option')->value($key)->setHtml($rubrika)->disabled($zakazano);
         }
     }
     $this->addSelect('rubrika', 'Rubrika', $polozky)->setPrompt('--- Zvolte rubriku ---')->setRequired('Zvolte rubriku.');
     $this->addText('nadpis', 'Nadpis:', 95)->setDefaultValue('nadpis')->setRequired('Zadejte název článku')->addRule(NForm::MAX_LENGTH, 'Maximálně %d znaků', 250)->addRule(~NForm::EQUAL, 'Zadejte název článku', 'nadpis')->setHtmlId('clanek_form_nadpis');
     $this->addTextArea('perex', 'Perex:', 85, 5)->setDefaultValue('perex')->addRule(NForm::MAX_LENGTH, 'Maximálně %d znaků', 250)->setHtmlId('clanek_form_perex');
     $this->addTextArea('obsah', 'Obsah', 85, 25)->setAttribute('class', 'mceEditor');
     $this->addSubmit('send', 'Uložit');
     if (isset($values)) {
         $this->setDefaults($values);
     }
 }
示例#30
0
 function createComponent($name)
 {
     switch ($name) {
         case 'baseForm':
             $form = new NAppForm();
             $form->getElementPrototype()->addClass('ajax');
             $form->addText('login', _('Prihlasovacie meno'))->addRule(NFORM::FILLED, _('Prihlasovacie meno musí byť vyplnené'));
             /*
              * todo nejaky problem pri odhlaseny
              */
             //				$form->addProtection(_('Bohužial Váš formulár expiroval. Prosím odošlite formulár znovu.') );
             $renderer = $form->getRenderer();
             $renderer->wrappers['controls']['container'] = NULL;
             $renderer->wrappers['pair']['container'] = 'div';
             $renderer->wrappers['label']['container'] = NULL;
             $renderer->wrappers['control']['container'] = NULL;
             $form->addPassword('password', 'Heslo')->addRule(NFORM::FILLED, _('Heslo musí byť vyplnené.'));
             $form->addSubmit('btn_submit', _('Prihlásiť'));
             $form->addHidden('backlink');
             return $form;
             break;
         case 'loginForm':
             $form = $this->createComponent('baseForm');
             $form->onSuccess[] = array($this, 'onSubmitAuthenticate');
             $this->addComponent($form, $name);
             break;
         case 'classicLoginForm':
             $form = $this->createComponent('baseForm');
             $form->onSuccess[] = array($this, 'onSubmitAuthenticate');
             $this->addComponent($form, $name);
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }