protected function createComponentAddEdit($name) { $roles[0] = ' '; $mroles = new RolesModel(); $rows = $mroles->getTreeValues(); foreach ($rows as $key => $row) { // function array_merge does't work correctly with integer indexes // manual array merge $roles[$key] = $row; } $form = new NAppForm($this, $name); $renderer = $form->getRenderer(); $renderer->wrappers['label']['suffix'] = ':'; //$form->addGroup('Add'); $form->addText('name', 'Name', 30)->addRule(NForm::FILLED, 'You have to fill name.')->getControlPrototype()->onChange("create_key()"); $form->addText('key_name', 'Key', 30)->addRule(NForm::FILLED, 'You have to fill key.'); $form->addSelect('parent_id', 'Parent', $roles, 15); $form->addTextArea('comment', 'Comment', 40, 4)->addRule(NForm::MAX_LENGTH, 'Comment must be at least %d characters.', 250); if ($this->getAction() == 'add') { $form->addSubmit('add', 'Add'); } else { $form->addSubmit('edit', 'Edit'); } $form->onSuccess[] = array($this, 'addEditOnFormSubmitted'); }
protected function createComponentAddReference() { $form = new NAppForm(); $form->addText('name', 'Jméno reference:'); $form->addText('client', 'Klient:'); $form->addText('scale', 'Rozsah:'); $form->addText('realized', 'Realizováno:'); $form->addText('url', 'SEO url (v rámci webu):'); $form->addSelect('typ', 'Typ:', array('web' => "Webová reference", 'adv' => "Reklama")); // Reference positions $container = $form->addContainer('pos'); $container->addCheckbox(ReferencesManager::REF_T_UVOD, ' Úvod'); $container->addCheckbox(ReferencesManager::REF_T_RWEB, ' Reference (webdesign)'); $container->addCheckbox(ReferencesManager::REF_T_RREK, ' Reference (reklama)'); $container->addCheckbox(ReferencesManager::REF_T_WEBD, ' Webdesign'); $container->addCheckbox(ReferencesManager::REF_T_VENK, ' Venkovní reklama'); $container->addCheckbox(ReferencesManager::REF_T_TISK, ' Tisk'); $container->addCheckbox(ReferencesManager::REF_T_GRAF, ' Grafika a Design'); $container->addCheckbox(ReferencesManager::REF_T_PRED, ' Reklamní předměty'); $container->addCheckbox(ReferencesManager::REF_T_RAZI, ' Razítka'); $container->addCheckbox(ReferencesManager::REF_T_INZE, ' Inzerce'); $container->addCheckbox(ReferencesManager::REF_T_FOTO, ' Fotografie'); $container->addCheckbox(ReferencesManager::REF_T_MARK, ' Marketing'); // Images $size = NEnvironment::getVariable('sizes'); $form->addFile('pic_1', 'Obr. úvodka (' . $size[0][0] . 'x' . $size[0][1] . '):')->addCondition(NForm::FILLED)->addRule(NForm::MIME_TYPE, 'Obrázek musí být ve formátu JPG, PNG nebo GIF.', 'image/*'); $form->addFile('pic_2', 'Obr. náhled (' . $size[1][0] . 'x' . $size[1][1] . '):')->addCondition(NForm::FILLED)->addRule(NForm::MIME_TYPE, 'Obrázek musí být ve formátu JPG, PNG nebo GIF.', 'image/*'); $form->addFile('pic_3', 'Obr. popup: (' . $size[2][0] . 'x' . $size[2][1] . '):')->addCondition(NForm::FILLED)->addRule(NForm::MIME_TYPE, 'Obrázek musí být ve formátu JPG, PNG nebo GIF.', 'image/*'); $form['pic_1']->getControlPrototype()->class('file'); $form['pic_2']->getControlPrototype()->class('file'); $form['pic_3']->getControlPrototype()->class('file'); $form->addSubmit('addref', 'Uložit'); $form->onSubmit[] = callback($this, 'addReferenceSubmited'); return $form; }
/** * 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; }
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'); }
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; } }
protected function createComponentVyhledatForm() { $form = new NAppForm(); $form->addText('vyhledat'); $form->addSubmit('send', ''); $form->onSuccess[] = callback($this, 'vyhledatFormSubmitted'); return $form; }
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; }
public function createComponentReCaptcha() { $form = new NAppForm(); $form->addCaptcha('captcha', 'aa'); $form->addText('text', 'Nejaky textik'); $form->addSubmit('ok', 'odeslat'); $form->onSubmit[] = [$this, 'captchaProcess']; 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 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; }
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; }
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; }
protected function createComponentAddEdit($name) { $form = new NAppForm($this, $name); $renderer = $form->getRenderer(); $renderer->wrappers['label']['suffix'] = ':'; if (ACL_PROG_MODE) { $form->addText('name', 'Name', 30)->addRule(NForm::FILLED, 'You have to fill name.')->getControlPrototype()->onChange("create_key()"); } else { $form->addText('name', 'Name', 30)->addRule(NForm::FILLED, 'You have to fill name.'); } //$form->addGroup('Edit'); $form->addText('key_name', 'Key', 30)->setDisabled(ACL_PROG_MODE ? false : true); $form->addTextArea('comment', 'Comment', 40, 4)->addRule(NForm::MAX_LENGTH, 'Comment must be at least %d characters.', 250); if ($this->getAction() == 'add') { $form->addSubmit('add', 'Add'); } else { $form->addSubmit('edit', 'Edit'); } $form->onSuccess[] = array($this, 'addEditOnFormSubmitted'); }
protected function createComponentLogin($name) { $form = new NAppForm($this, $name); $renderer = $form->getRenderer(); $renderer->wrappers['label']['suffix'] = ':'; //$form->addGroup('Login'); $form->addText('name', 'Name', 30)->addRule(NForm::FILLED, 'You have to fill name.'); $form->addPassword('password', 'Password', 30)->addRule(NForm::FILLED, 'You have to fill password.'); //$form->addProtection('Security token did not match. Possible CSRF attack.'); $form->addSubmit('signon', 'Sign on'); $form->onSuccess[] = array($this, 'SignOnFormSubmitted'); }
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; }
/** * 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 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; }
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; }
/** * Sign in form component factory. * @return NAppForm */ protected function createComponent($name) { switch ($name) { case 'loginForm': $form = new NAppForm(); $form->addText('username', _('Prihlasovacie meno') . ':')->addRule(NForm::FILLED, _('Prihlasovacie meno musí byť vyplnené.')); $form->addPassword('password', _('Heslo') . ':')->addRule(NForm::FILLED, _('Prihlasovacie heslo musí byť vyplnené.')); $form->addSubmit('submit_login', 'Log In'); $renderer = $form->getRenderer(); $renderer->wrappers['controls']['container'] = NULL; $renderer->wrappers['pair']['container'] = 'div'; $renderer->wrappers['label']['container'] = NULL; $renderer->wrappers['control']['container'] = NULL; $form->addProtection(_('Sedenie vypršalo. Proším obnovte prihlasovací formulár a zadajte údaje znovu.'), 1800); $form['submit_login']->getControlPrototype()->class = 'btnLogin'; $form->onSuccess[] = callback($this, 'loginFormSubmitted'); return $form; break; default: return parent::createComponent($name); break; } }
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; } }
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; } }
protected function createComponentAddEdit($login) { $mroles = new RolesModel(); $roles = $mroles->getTreeValues(); $form = new NAppForm($this, $login); $renderer = $form->getRenderer(); $renderer->wrappers['label']['suffix'] = ':'; //$form->addGroup('Add'); $form->addText('login', 'login', 30)->addRule(NForm::FILLED, 'You have to fill login.'); $form->addSelect('activate', 'Aktivovany', array('1' => 'ano', 0 => 'nie')); // if ($this->getAction()=='add') { $form->addPassword('password', 'Password', 30)->addRule(NForm::FILLED, 'You have to fill password.'); $form->addPassword('password2', 'Reenter password', 30)->addRule(NForm::FILLED, 'Reenter your password.')->addRule(NForm::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->onSuccess[] = array($this, 'addEditOnFormSubmitted'); }