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; }
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; } }
/** * Create contact form controler * @return NAppForm */ public function createComponentPopForm() { $id = (int) $this->getParam('id'); $form = new NAppForm(); $form->addTextArea('body', 'Zpráva:', 40, 10)->addRule(NForm::FILLED, 'Vyplňte prosím obsah zprávy.'); $form->addText('contact', 'Kontakt na Vás (e-mail nebo telefon):')->addRule(NForm::FILLED, 'Nezapomeňte prosím uvést na sebe kontakt.'); $form->addImage('popsend', NEnvironment::getVariable('baseUri') . 'layout/img/form-send.jpg', 'Odeslat'); $form->addHidden('id', $id); $form->getElementPrototype()->class('ajax'); $form['body']->getControlPrototype()->class('s100 h140px'); $form['contact']->getControlPrototype()->class('s100'); $form->onSubmit[] = callback($this, 'popFormSubmited'); return $form; }
function createComponentBaseForm() { // NForm::extensionMethod('NForm::addCBTree', array('CBTree', 'addCBTree')); // // $tree = new TreeView; // // $tree->primaryKey = 'id_category'; // $tree->parentColumn = 'id_parent'; // $tree->useAjax = false; // $tree->addLink(null, 'name', 'id', true, $this->presenter); // $tree->dataSource = CategoryModel::getDatasource()->where("id_lang = %i",$this->getPresenter()->id_lang); //$form->addCBTree('ctree', _('Kategórie'), $tree); $form = new NAppForm(); $renderer = $form->getRenderer(); // budeme generovat formulář jako definiční seznam $renderer->wrappers['controls']['container'] = NHtml::el('table')->addClass('standard'); $langs = Setting::getLangs(); foreach ($langs as $k => $lang) { $form->addGroup($lang['name'])->setOption('container', 'fieldset class=lang_fieldset id=lang_' . $lang['iso']); $form->addText('name' . self::$_separator . $lang['iso'], _('Názov'))->addRule(NFORM::FILLED, 'Názov ' . $lang['iso'] . ' musí byť vyplnený.'); $form->addTextArea('description' . self::$_separator . $lang['iso'], 'Popis'); $form->addText('link_rewrite' . self::$_separator . $lang['iso'], 'URL link')->setDisabled(); $form->addText('meta_title' . self::$_separator . $lang['iso'], 'Titulok'); // $form->addText('meta_keywords'.self::$_separator.$lang['iso'], 'Kľúčové slová'); $form->addText('meta_description' . self::$_separator . $lang['iso'], 'Meta popis'); } //$form->addText('icon','Názov ikony'); $form->addCheckbox('show_on_bottom', 'Zobraziť v spodnej časti'); $form->addGroup(''); $form->addHidden('id_category'); $c = new CategoryModel($this->getPresenter()->id_lang); $select = array('' => 'root'); /* * todo dorobit, aby sa nedala vybrat samu seba categoria */ $c->generateTreeToSelect($select, NULL, NULL); $form->addSelect('id_parent', 'Rodič', $select); // ->addRule(NForm::FILLED, _('Rodič musí byť vyplnený.') ); $form->addSelect('active', 'Aktívny', array(1 => 'Povolený', 0 => 'Zakázaný')); $form->onSuccess[] = array($this, 'categoryAction'); return $form; }
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; } }