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; }
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; }
/** * Sign in form component factory. * @return NAppForm */ protected function createComponentSignInForm() { $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('send', 'Sign in'); $form->onSuccess[] = callback($this, 'signInFormSubmitted'); return $form; }
/** * 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; }
protected function createComponentAddNews() { $form = new NAppForm(); $form->addText('title', 'Titulek:')->addRule(NForm::FILLED, 'Vyplňtě prosím titulek novinky.'); $form->addTextArea('content', 'Obsah:', 40, 20)->addRule(NForm::FILLED, 'Vyplňte prosím obsah novinky.'); $form->addCheckbox('active', 'Aktivní novinka'); $form->addSubmit('addnews', 'Uložit'); // Set control class $form['title']->getControlPrototype()->class('s100'); $form['content']->getControlPrototype()->class('s100'); $form->onSubmit[] = callback($this, 'newsFormSubmited'); 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; }