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 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'); }
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; }
/** * 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; }
/** * 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; }
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 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; }
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 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; }
function createComponent($name) { switch ($name) { case 'statusForm': $f = new NAppForm($this, $name); $renderer = $f->getRenderer(); $renderer->wrappers['pair']['container'] = ''; $renderer->wrappers['controls']['container'] = ''; $renderer->wrappers['control']['container'] = ''; $renderer->wrappers['label']['container'] = ''; $f->addSelect('order_status', 'Stav: ', OrderModel::getStatus()); $f->addSubmit('btn_submit', 'Uložiť'); $o = OrderModel::get($this->getParam('id')); $f->setDefaults($o); if ($f->isSubmitted() and $f->isValid()) { $values = $f->getValues(); OrderModel::updateStatus($this->getParam('id'), $values['order_status']); $o = OrderModel::get($this->getParam('id')); $template = $this->template; $template->setFile(APP_DIR . '/FrontModule/templates/Order/OrderChangeStatusEmail.phtml'); //print_r($o); $template->o = $o; $template->status = OrderModel::getStatus($o['order_status']); // echo $template->status;exit; $mail = new MyMail(); $mail->addTo($o['email']); $mail->addBcc(NEnvironment::getVariable('client_email')); $mail->setSubject(_('Objednávka č. ') . $o['id_order'] . ' zmena stavu.'); $mail->setTemplate($template); //echo $template;exit; $mail->send(); $this->flashMessage('Bol odoslaný email o zmene statusu.'); $this->redirect('this'); } return $f; break; case 'orderTabella': $grid = new Tabella(OrderModel::getDatasource(), array('sorting' => 'desc', 'order' => 'id_order')); $grid->addColumn("Číslo obj.", "id_order", array("width" => 50)); $grid->addColumn("Meno", "name", array("width" => 100)); $grid->addColumn("Priezvisko", "surname", array("width" => 100)); $grid->addColumn("Mesto", "city", array("width" => 100)); $grid->addColumn("Dátum vytvorenia", "add_date", array("width" => 100)); $grid->addColumn("Celková cena", "total_price", array("width" => 100)); $grid->addColumn("Stav", "order_status", array("width" => 50, 'type' => Tabella::SELECT, "editable" => true, "filter" => OrderModel::getStatus(), 'renderer' => function ($row) { $el = NHtml::el("td")->setHtml(OrderModel::getStatus($row['order_status'])); return $el; })); $grid->addColumn("Spôsob platby", "payment_method", array("width" => 90, 'type' => Tabella::SELECT, "editable" => false, "filter" => OrderModel::getPaymentMethod(), 'renderer' => function ($row) { $el = NHtml::el("td")->setHtml(OrderModel::getPaymentMethod($row['payment_method'])); return $el; })); $grid->addColumn("", "", array("width" => 30, 'filter' => NULL, "options" => '', "renderer" => function ($row) { $el = NHtml::el("td"); /* * link na zmazanie produktu */ $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('deleteOrder!', array('id' => $row->id_order)))->addClass('deleteIcon')); /* * link na editaciu produktu */ $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('view', array('id' => $row->id_order)))->addClass('editIcon')); /* * ikona aktivan polozka, neaktivan polozka */ $span = NHtml::el('span'); $el->add($span); return $el; })); $this->addComponent($grid, $name); break; default: return parent::createComponent($name); break; } }
protected function createComponentDelete($name) { $form = new NAppForm($this, $name); $form->addSubmit('delete', 'Delete'); $form->addSubmit('cancel', 'Cancel'); $form->onSuccess[] = array($this, 'deleteOnFormSubmitted'); }