function createComponentForm($name) { $f = new MyForm(); $f->addText('name', 'Názov')->addRule(NForm::FILLED, 'Názov musí byť vyplnená'); $f->addText('value', 'Hodnota')->addRule(NForm::FILLED, 'Hodnota musí byť vyplnená'); $f->addSelect('is_default', 'Prednastavená?', array(0 => 'nie', 1 => 'áno')); $f->addSubmit('btn', 'Pridať'); $f->onSuccess[] = array($this, 'handleSave'); return $f; }
function createComponentForm($name) { $f = new MyForm(); $f->addText('key', 'Názov')->addRule(NForm::FILLED, 'Názov musí byť vyplnený'); $f->addTextArea('text', 'Popis')->getControlPrototype()->class = 'long'; $f->addHidden('id_helps'); $f->addSubmit('btn', 'Uložiť')->getControlPrototype()->class = 'submit'; $f->onSuccess[] = array($this, 'handleSave'); return $f; }
function createComponentPaymentAndDelivetyForm($name) { $f = new MyForm(); $f->addRadioList('id_delivery', 'Doprava', $this->getService('Delivery')->fetchPairs('name'))->addRule(NForm::FILLED, 'Musíte vybrať dopravu'); $f->addRadioList('id_payment', 'Platby', $this->getService('Payment')->fetchPairs('name'))->addRule(NForm::FILLED, 'Musíte vybrať spôsob platby.'); $f->addSubmit('btn', 'Pokračovať'); $f->onSuccess[] = array($this, 'handleSavePaymentAndDelivery'); $f->setDefaults(array('id_delivery' => $this->getService('Delivery')->getDefault(), 'id_payment' => $this->getService('Payment')->getDefault())); return $f; }
function createComponentForm($name) { $f = new MyForm(); $f->addText('name', 'Názov')->addRule(NForm::FILLED, 'Názov musí byť vyplnený'); $f->addText('price', 'Cena')->addRule(NForm::FILLED, 'Cena musí byť vyplená')->addRule(NForm::FLOAT, 'Cena musí byť číslo'); $f->addTextArea('description', 'Popis')->getControlPrototype()->class = 'long'; $f->addHidden($this->model->getTableIdName()); $f->addSubmit('btn', 'Uložiť')->getControlPrototype()->class = 'submit'; $f->onSuccess[] = array($this, 'handleSave'); return $f; }
function createComponentWidgetForm($name) { $f = new MyForm(); $f->addText('identifier', 'Identifikátor')->addRule(NForm::FILLED, 'Identifikátor musí byť vyplnený'); $f->addText('name', 'Názov'); $f->addTextarea('template', 'Šablóna')->getControlPrototype()->class = 'long'; $f->addHidden('id_widget'); $f->addContainer('params'); $f->addSubmit('save', 'Uložiť'); $f->addSubmit('addNewParam', 'Pridať parameter')->onClick[] = callback($this, 'handleAddNewParam'); $f->onSuccess[] = array($this, 'handleSaveForm'); $values = (array) $this->getService('Widget')->get($this->getParam('id')); foreach ($values['params'] as $k => $p) { $container = $f['params']->addContainer($k); $container->addText('name', 'Názov'); $container->addText('value', 'Hodnota'); //->setDefaultValue(array($p['value'])); $container->setDefaults((array) $p); } // unset($values['params']); return $f; }
function createComponentForm($name) { $form = new MyForm($this, $name); $form->addText('name', 'Meno:')->addRule(NForm::FILLED, 'Meno a priezvisko musia byť vyplnené.'); $form->addText('surname', 'Priezvisko:')->addRule(NForm::FILLED, 'Meno a priezvisko musia byť vyplnené.'); $form->addText('company', 'Firma:'); $form->addText('email', 'Email:'); $form->addText('tel', 'Telefón:'); $form->addTextarea('text', 'Textová správa:')->addRule(NForm::FILLED, 'Správa musí byť vyplnená.'); $form->addSubmit('btn_form', 'Odoslať správu'); $form->addHidden('id_node'); $form->onSuccess[] = callback($this, 'handleSend'); return $form; }
protected function createComponentAddToCartForm() { $presenter = $this; return new NMultiplier(function ($id) use($presenter) { /* @var $f NForm */ $f = new MyForm(); $f->getElementPrototype()->class = 'ajax'; $f->addText('count', 'Počet')->addRule(NForm::FILLED, 'Počet musí byť vyplnený.')->addRule(NForm::INTEGER, 'Musíte zadať číslo.'); $f->addSubmit('btn', 'DO KOŠÍKA'); $f->addHidden('id', $id); $f->onSuccess[] = array($presenter, 'handleAddToCart'); $f->setDefaults(array('count' => 1)); return $f; }); }
function createComponentRequestBtn($name) { $f = new MyForm(); $f->getElementPrototype()->class = 'ajax'; $f->addText('keywords', 'Klúčové slovo')->addRule(NForm::FILLED, 'Klúčové slovo musí byť vyplnené')->addRule(NForm::MIN_LENGTH, "Klúčové slovo musí byť dlhšie", 3); $count = array(); for ($i = 1; $i < 30; $i++) { if (!($i % 5)) { $count[$i] = $i; } } $f->addSelect('google_num_result', 'Počet stránok', $count); $f->addSubmit('btn', 'Zobraziť príbuzné klúčové slová'); $f->onSuccess[] = array($this, 'handleShowKeywords'); return $f; }
protected function createComponentSettingForm($name) { $article = $this->getService('Article'); $f = new MyForm(); $f->addGroup('Nastavenie eshopu'); $f->addSelect('SHOP_ENABLE', 'Zapnúť obchod', array(0 => 'nie', 1 => 'áno'))->addRule(NForm::FILLED, 'Musí byť vyplené'); $f->addSelect('SHOW_PRICE_WITH_TAX', 'Cena sa bude zadávať i zobrazovať s DPH?', array(0 => 'nie', 1 => 'áno'))->addRule(NForm::FILLED, 'Musí byť vyplené'); $f->addSelect('SHOW_TAX_FOR_PRODUCT', 'Zobraziť priradenie dane pri produkte', array(0 => 'nie', 1 => 'áno'))->addRule(NForm::FILLED, 'Musí byť vyplené'); // $f->addSelect('SHOW_PRICE_WITH_DPH', 'Cena sa zobraz s DPH', array(0=>'nie', 1=>'áno')) // ->addRule( NForm::FILLED, 'Musí byť vyplené'); $f->addSelect('CONDITIONS_CMS_ID', 'Obchodné podmienky, použitie CMS stránky', $article->getFluent()->fetchPairs('id_node', 'title')); $f->addTextArea('footer_for_emails', 'Pätička pre emaili')->getControlPrototype()->style = "width:700px;"; $f->addGroup('Heureka'); $f->addSelect('HEUREKA__ENABLE', 'Spustiť heureku', array(0 => 'nie', 1 => 'áno'))->addRule(NForm::FILLED, 'Musí byť vyplené'); $f->addText('HEUREKA__API_KEY', 'API KEY'); $f->addGroup('Facebook'); $f->addSelect('FACEBOOK__AUTH_ENABLE', 'Povoliť Facebook prihlasovanie', array(0 => 'nie', 1 => 'áno'))->addRule(NForm::FILLED, 'Musí byť vyplené'); //twitter.consumer_key = JD4NBeGvlkEomwmaYYlIQ //twitter.consumer_secret = WgRwndqR3oA6hShLk43mnQVTpcJvvY9Lmsfe45WNXw // //google.client_id = 924141147825.apps.googleusercontent.com //google.client_secret = G1SSmJ0efgD69eKP43D04FEd //google.redirect_url = "http://www.propagacnepredmety.sk/google-account/log-in/" $f->addText('FACEBOOK__appId', 'appId'); $f->addText('FACEBOOK__secret', 'secret'); $f->addGroup('Google Account'); $f->addSelect('GOOGLE__AUTH_ENABLE', 'Povoliť Google prihlasovanie', array(0 => 'nie', 1 => 'áno'))->addRule(NForm::FILLED, 'Musí byť vyplené'); $f->addText('GOOGLE__client_id', 'client_id'); $f->addText('GOOGLE__client_secret', 'client_secret'); $f->addText('GOOGLE__application_name', 'application_name'); $f->addText('GOOGLE__redirect_url', 'redirect_url'); $f->addGroup('Google Analytics'); $f->addText('GOOGLE_ANALYTICS__ID', 'ID'); $f->addGroup('Doprava'); // $f->addSelect('DELIVERY_IS_WITH_TAX', 'Doprava je už s danou?', array(0=>'nie', 1=>'áno')) // ->addRule( NForm::FILLED, 'Musí byť vyplené'); $vat = VatModel::init(); $f->addSelect('DELIVERY_TAX', 'Dan na dopravu?', $vat->getFluent()->fetchPairs('value', 'name'))->addRule(NForm::FILLED, 'Musí byť vyplené'); $f->addGroup('Platby'); $vat = VatModel::init(); $f->addSelect('PAYMENT_TAX', 'Dan na platbu?', $vat->getFluent()->fetchPairs('value', 'name'))->addRule(NForm::FILLED, 'Musí byť vyplené'); $f->addGroup(); $f->addSubmit('btn', 'Uložiť'); $f->onSuccess[] = array($this, 'handleSaveSetting'); $f->setDefaults($this->getService('Setting')->fetchPairs()); return $f; }
function createComponentForm($name) { $f = new MyForm(); $f->addHidden('id_product_template_group'); $f->addGroup('Nastavenie skupiny'); $f->addText('group_name', 'Názov skupiny')->addRule(NForm::FILLED, 'Názov skupiny musí byť vyplnený'); $f->addCheckbox('default', 'Predvolená skupina?'); $f->addCheckbox('allow_change_price', 'Možnosť meniť cenu pre jednotlivé parametre?'); $f->addGroup('Parametre'); $rows = $this->model->getProductParamRows(); foreach ($rows as $k => $r) { $f->addCheckbox($r, $r); } $f->addGroup(''); $f->addSubmit('btn', 'Uložiť'); $f->onSuccess[] = array($this, 'handleSave'); return $f; }
protected function createComponent($name) { switch ($name) { default: parent::createComponent($name); break; case 'newsletterform': $form = new MyForm(); $form->getElementPrototype()->class = 'ajax'; $form->addText('email', 'Váš email')->addRule(NAPPFORM::FILLED, 'Email musí byť vyplnený.')->addRule(NAPPFORM::EMAIL, 'Zadaný email nieje v správnom tvare.'); // $form['email']->getLabelPrototype()->class = 'inlined'; // $form['email']->getLabelPrototype()->id = 'emaillabel'; $form->addSubmit('sendnewsletter', 'Ok'); $form->onSuccess[] = array($this, 'sendToEmailRegisterToNewsletter'); return $form; break; } }
/** * Form to show list of topics with checkboxes * * @access protected * @return Nette\Application\UI\Form * @since 1.0.0 */ protected function createComponentForumTopicsForm() { $form = new MyForm(); $form->setMethod('get'); $container = $form->addContainer($this->forumSelectedTopicsContainer); foreach ($this->forumThreads as $thread) { $container->addCheckbox($thread->id_thread, $thread->title); } $form->addSubmit('show', 'View selected'); return $form; }
protected function createComponent($name) { switch ($name) { case 'JsTree': $tree = new JsTree(); $tree->keyColumn = 'id_category'; $tree->parentColumn = 'id_parent'; $tree->table = "category"; // jméno tabulky, s kterou bude pracovat $tree->titleColumn = "name"; // jméno sloupce pro titulek $tree->orderColumn = "sequence"; // jméno sloupce pro pořadí $tree->numberingFrom = 0; // $tree->parentColumn = "parent"; //$tree->where = array(array("`web`=%i", WEB)); // je možné navěsit podmínky //$tree->defaultValues = array("web"=>WEB); $tree->enableContextmenu = false; $tree->enableDragDrop = true; $tree->enableDragDropOrder = false; $tree->showRoot = false; $tree->enableCheckbox = false; // zobrazení checkboxů $tree->checkboxColumn = "checked"; // sloupec, který ovlivňuje stav checkboxu $tree->onAfterUpdate[] = callback($this, "updateUrl"); $tree->onAfterCreate[] = callback($this, "updateUrl"); $tree->onClick[] = callback($this, "handleClick"); $tree->openAll = true; return $tree; break; case 'changePrice': $f = new MyForm(); $f->addText('coeficient', NHtml::el('p')->add('Upraviť ceny v danej kategórii podľa koeficientu.')->add(NHtml::el('div')->add('Napr. ak chcete zvýšiť cenu o 10 percent, zadáte koeficient 1.10, ak o 25 percent 1.25. Ak chcete ceny znížiť o 10 percent, zadáte 0.90, ak o 15 percent, zadáte 0.85. Želanú kategóriu si zvolíte v ľavom v menu. Cena bude zaokrúhlená!')->addClass('silver')))->addRule(NForm::FILLED, 'Koeficient musí byť vyplnený'); $f->addSubmit('btn_percent', "Prepočitať"); $f->onSuccess[] = array($this, 'handleChangePrice'); return $f; break; case 'addCategoryForm': $c = new CategoryFormControl(); $c->mode = 'add'; return $c; break; case 'editCategoryForm': $c = new CategoryFormControl(); $c->mode = 'edit'; return $c; break; case 'MyTree': $c = new MyTreeControl(); $c->invalidateControl(); return $c; break; default: return parent::createComponent($name); break; } }
function createComponent($name) { switch ($name) { /* * newsletterTabella */ case 'newsletterTabella': $grid = new Tabella(NewsletterModel::getFluent()->toDataSource(), array('sorting' => 'desc', 'order' => 'adddate', 'id_table' => 'id', 'limit' => 100, 'onSuccess' => function ($values) { NewsletterModel::edit($values, $values['id_newsletter_emails']); }, 'onDelete' => function ($id_newsletter_emails) { NewsletterModel::delete($id_newsletter_emails); })); $el = NHtml::el("div"); $session = NEnvironment::getSession('checked_emails'); $grid->addColumn($el, "", array("editable" => false, 'filter' => false, "width" => 20, "renderer" => function ($row) use($session) { $el = NHtml::el("td"); $checked = isset($session->emails[$row['id_newsletter_emails']]) ? 'checked="checked"' : ''; $el->add('<input class="checked_emails" type="checkbox" name="se[]" value="' . $row['id_newsletter_emails'] . '" ' . $checked . '/>'); return $el; })); $grid->addColumn("Id", "id_newsletter_emails", array("width" => 30, 'editable' => false)); $grid->addColumn("Email", "email", array("width" => 50, 'editable' => false)); // $grid->addColumn( "Popis", "description", array( 'editable'=>true ) ); $grid->addColumn("Dátum registrácie ", "adddate", array("width" => 100)); /*$grid->addColumn( "Aktívny", "active", array( "width" => 50, 'type'=> Tabella::SELECT, "editable" => true, "filter" => array( 1=>'áno', 0=>'nie'), 'renderer' => function($row){ $active = ($row['active'] == 1)?'áno':'nie'; $el = NHtml::el( "td" )->setHtml($active); return $el; } ) ); $grid->addColumn("", "", array( "width" => 30, 'filter'=>NULL, "options" => '', "renderer" => function( $row ) { $el = NHtml::el( "td" ); $el->add( NHtml::el( 'a' )->href( NEnvironment::getApplication()->getPresenter()->link( 'deleteEmail!' , array('id'=>$row->id_newsletter_emails)) )->addClass( 'deleteIcon' ) ); $span = NHtml::el('span'); $el->add($span); return $el; } ) ); */ $this->addComponent($grid, $name); break; /* * newslette text */ /* * newslette text */ case 'newsletterTextForm': $last_newsletter = dibi::fetch("SELECT * FROM [newsletter_sended_msg] ORDER BY [date] DESC LIMIT 1"); $f = new MyForm($this, $name); $f->addText('subject', 'Predmet')->addRule(NForm::FILLED, 'Predmet musí byť vyplnený.'); $f->addTextArea('text', ''); $f->addText('my_email', 'Testovací email'); $f->addSubmit('btn_send_emails', 'Odoslať všetkým')->onClick[] = array($this, 'actionSendEmails'); $f->addSubmit('btn_send_to_me', 'Odoslať testovací email')->onClick[] = array($this, 'actionSendTestingEmail'); if (!$last_newsletter) { $email_template = new NFileTemplate(); $email_template->registerFilter(new NLatteFilter()); $email_template->setFile(WWW_DIR . '/newsletter/templates/1/1.phtml'); $email_template->text = ''; $values['text'] = (string) $email_template; } else { $values = $last_newsletter; } $f->setDefaults($values); return $f; break; case 'addForm': $f = new MyForm(); $f->addText('emails', 'Email'); $f->addSubmit('btn', 'Pridať'); $f->onSuccess[] = array($this, 'handleAddEmail'); return $f; break; default: return parent::createComponent($name); break; } }
function createComponent($name) { switch ($name) { // case 'addForm': // $form = $this->baseForm(); // $form->addSubmit('btn', 'Pridať'); //// $values['product_alternative'] = ProductModel::getFluent($this->id_lang)->where('id_category = 5')->fetchPairs("id_product",'id_product'); // //poziadavka klienta - zobrat vsetky produkty z doplnkov // // // $form->setDefaults( array('id_product_template_group'=>$this->getService('ProductTemplateGroupModel')->getIdDefaultTemplate()) ); // // // $form->onSuccess[] = callback($this, 'add'); // return $form; // break; case 'editForm': $id_product = $this->getPresenter()->getParam('id'); $form = $this->baseForm(); $form['id_product']->setValue($id_product); $values = array(); //Titulok - doplnit categoria+ nazov produktu //Kľúčové slová - //Meta popis - doplnit categoria+ nazov produktu + Výkon + Dĺžka Horenia foreach ($this->template->langs as $l) { $val = ProductModel::get($id_product, $l['id_lang']); // ziste ktore komponenty maju jazykovu mutaciu $controls_for_lang = array(); foreach ($form->getComponents() as $control) { if (strpos($control->getName(), CategoryFormControl::$_separator)) { if (strpos($control->getName(), CategoryFormControl::$_separator . $l['iso'])) { list($val_key) = explode(CategoryFormControl::$_separator . $l['iso'], $control->getName()); $values += array($control->getName() => $val[$val_key]); } } else { if (isset($val[$control->getName()])) { $values += array($control->getName() => $val[$control->getName()]); } } } } //print_r(ProductModel::getProductAlternative($id_product));exit; $values['product_alternative'] = ProductModel::getProductAlternative($id_product); // vyriesenie categorii //nacitanie prveho parametru - iba pre jednoparametrove produkty $param = (array) dibi::fetch("SELECT * FROM [product_param] WHERE id_product = %i", $id_product); $form->setDefaults(array_merge($param, $values)); $form->addSubmit('btn_save_and_stay', 'Upraviť a zostať tu'); $form->addSubmit('btn_save', 'Upraviť'); $form->onSuccess[] = callback($this, 'save'); return $form; break; /* * generator */ /* * generator */ case 'generatorForm': //ProductModel::repairMinPrice(); NFormContainer::extensionMethod('NFormContainer::addCheckboxList', array('CheckboxList', 'addCheckboxList')); $sizes = dibi::query("SELECT size FROM [product_param] WHERE size !='' GROUP BY size")->fetchPairs('size', 'size'); $colors = dibi::query("SELECT color FROM [product_param] WHERE color !='' GROUP BY color")->fetchPairs('color', 'color'); $materials = dibi::query("SELECT material FROM [product_param] WHERE material !='' GROUP BY material")->fetchPairs('material', 'material'); $f = new MyForm(); // $f->getElementPrototype()->addClass('ajax'); $renderer = $f->getRenderer(); $renderer->wrappers['controls']['container'] = NHtml::el('div')->addClass('container'); $renderer->wrappers['pair']['container'] = NHtml::el('div')->addClass('pair-container'); $renderer->wrappers['label']['container'] = NHtml::el('h3'); $renderer->wrappers['control']['container'] = NHtml::el('div')->addClass('input-container'); // usort($sizes, 'EshopProductControl::cmp'); $f->addCheckboxList('size', 'Veľkosť', $sizes); $f->addCheckboxList('color', 'Farba', $colors); $f->addCheckboxList('material', 'Material', $materials); //ak je pridavanie a neexistuje id $f->addHidden('id_product', $this->getParam('id')); // // // $renderer = $f->getRenderer(); // $renderer->wrappers['label']['container'] = NULL; // // //ziskaj vsetky mozne velkosti // $sizes = dibi::fetchAll("SELECT size FROM [product_param] GROUP BY size"); // $f->addGroup('Veľkosť'); // foreach($sizes as $k=>$size){ // $f->addCheckbox('size_'.$k, $size['size']); // } // // //ziskaj vsetky mozne farby // $colors = dibi::fetchAll("SELECT color FROM [product_param] GROUP BY color"); // $f->addGroup('Farba'); // foreach($colors as $k=>$color){ // $f->addCheckbox('color_'.$k, $color['color']); // } // // //ziskaj vsetky mozne material // $materials = dibi::fetchAll("SELECT material FROM [product_param] GROUP BY material"); // $f->addGroup('Material'); // foreach($materials as $k=>$material){ // $f->addCheckbox('material_'.$k, $material['material']); // } $f->addGroup()->setOption('container', 'fieldset class=clear'); $f->addSubmit('btn_generate', 'Generovať'); $f->onSuccess[] = array($this, 'handleAddGeneratedParam'); return $f; break; case 'productParams': // $d = ProductModel::getProductParamDatasource( $this->getParam('id'))->fetchAll(); $id_product = $this->getParam('id'); $grid = new Tabella(ProductModel::getProductParamDatasource($id_product), array('sorting' => 'asc', 'order' => 'sequence', 'id_table' => 'id_product_param', 'limit' => 50, "onSubmit" => function ($post) { // print_r($post);exit; ProductModel::setProductParamValue($post, $post['id_product_param']); }, "onDelete" => function ($id) { ProductModel::deleteProductParamValue($id); })); $el = NHtml::el("div"); $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('addEmptyParam!', array('id_product' => $id_product)))->addClass('addIcon ajax')); $grid->addColumn($el, 'sequence', array('width' => 20, 'filter' => NULL, "editable" => true)); //vytiahnutie template_group pre produkt - ake bude mat parametre if ($id_product) { $id_product_template_group = ProductModel::getFluent(1, false, false)->removeClause('select')->select('id_product_template_group')->where('id_product = %i', $id_product)->fetchSingle(); } else { //ak je id_product NULL jedna sa pridavanie produktu if ($id_product == NULL and $this->getParam('id_product_template_group') != NULL) { $id_product_template_group = $this->getParam('id_product_template_group'); } else { $id_product_template_group = $this->getService('ProductTemplateGroupModel')->getIdDefaultTemplate(); } } $params = $this->getService('ProductTemplateGroupModel')->fetchAssocAllParam($id_product_template_group); foreach ($params as $p) { if ($p['checked']) { $grid->addColumn($this->getService('translator')->translate($p['row_name']), $p['row_name'], array("width" => 50, "editable" => true)); } } $grid->addColumn("Cena", "price", array("width" => 100, "editable" => true)); // _repairPriceForView // // // $grid->addColumn( "Na sklade", "stock", array( "width" => 50, "editable" => true ) ); //// $grid->addColumn( "Farba", "color", array( "width" => 100, "editable" => true ) ); //// $grid->addColumn( "Veľkosť", "size", array( "width" => 100, "editable" => true ) ); //// $grid->addColumn( "Material", "material", array( "width" => 100, "editable" => true ) ); // $grid->addColumn( "Napojenie", "connection", array( "width" => 100, "editable" => true ) ); // $grid->addColumn( "Cena", "price", array( "width" => 100, "editable" => true ) ); $grid->addColumn("", "", array("width" => 30, 'filter' => NULL, "options" => '', "renderer" => function ($row) { $el = NHtml::el("td"); $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('deleteProductParam!', array('id_product_param' => $row->id_product_param)))->addClass('deleteIcon ajax')); return $el; })); $this->addComponent($grid, $name); break; case 'pictogram': $p = new PictogramControl($this, $name); return $p; break; case 'keyword': return new KeywordControl(); break; case 'ajaxtest': return new AjaxTextControl(); break; default: return parent::createComponent($name); break; } }
protected function createComponent($name) { switch ($name) { case 'article': return new ArticleControl(); break; case 'questionToSeller': $f = new QuestionToSeller(); $f->setDefaults(array('link' => $_SERVER['HTTP_HOST'] . $this->link('this'))); return $f; break; case 'searchform': $f = new MyForm(); $f->addText('q', 'hľadané slovo / výraz')->getControlPrototype()->class = 'no-border'; //->addRule( NForm::FILLED, 'Hľadané slovo musí byť vyplnené'); $f->addSubmit('btn', 'Vyhľadať')->getControlPrototype()->class = 'no-border'; $f->onSuccess[] = array($this, 'searchFormSubmitted'); $f->setDefaults(array('q' => $this->getParam('q'))); return $f; break; case 'poll': $p = new PollControl(); return $p; break; /* * Pomocka pre pohyb admina po Front */ /* * Pomocka pre pohyb admina po Front */ case 'adminBar': return new AdminBarControl(); break; /* * Sluzi na zobrazenie vypredajovych poloziek * prislusenstva * noviniek */ /* * Sluzi na zobrazenie vypredajovych poloziek * prislusenstva * noviniek */ case 'productNewsSaleAvaiableTable': return new ProductNewsSaleAvaiableTableControl(); break; case 'Home': return new SlideshowControl(); break; case 'breadcrumb': return new BreadcrumbControl(); break; case 'quickFilter': return new QuickFilterControl(); break; case 'cart': $cart = new CartControl(); return $cart; break; case 'cartsmall': $cart = new CartSmallControl(); return $cart; break; case 'gmap': return new GmapControl(); break; case 'newsletter': return new NewsletterControl(); break; case 'UserForm': return new UserFormControl(); break; case 'LoginForm': return new LoginControl(); break; case 'userProfil': return new UserProfilControl(); break; case 'cartLogin': return new CartLoginControl(); break; // // case 'EshopProduct' : // $p = new EshopProductControl; // $p->invalidateControl(); // return $p; // break; // // case 'Redirect' : // return new RedirectControl (); // break; // // case 'EshopProduct' : // $p = new EshopProductControl; // $p->invalidateControl(); // return $p; // break; // // case 'Redirect' : // return new RedirectControl (); // break; case 'ContactForm': return new ContactFormControl(); break; // case 'comment' : // return new CommentControl (); // break; // case 'comment' : // return new CommentControl (); // break; case 'msg': return new MsgControl(); break; case 'vizionWidget': $widget = new VizionWidgetControl(); $widget->setWidgetService($this->getService('Widget')); return $widget; break; case 'userBaseForm': $form = UserModel::baseForm(); $_convertor_lang_to_iso = array('sk' => 'SVK', 'cz' => 'CZE', 'de' => 'DEU', 'en' => 'GB', 'hu' => 'HUN'); $form->setDefaults(array('type' => 0, 'iso' => $_convertor_lang_to_iso[$this->lang], 'delivery_iso' => $_convertor_lang_to_iso[$this->lang])); return $form; break; default: return parent::createComponent($name); break; } }
protected function createComponent($name) { switch ($name) { case 'EshopProduct': $p = new EshopProductControl(); $p->invalidateControl(); return $p; break; case 'referenceForm': $params = NEnvironment::getApplication()->getPresenter()->getParam(); $form = new MyForm(); $form->addText('name', 'Meno:'); $form->addProtection(); $form->addText('email', 'Email:'); $form->addTextarea('text', 'Text:'); if (class_exists('reCAPTCHA')) { $form->addRecaptcha('recaptcha_input', 'Overenie:')->addRule('reCAPTCHA::validate', 'Prosím prepíšte správne text z obrázku.'); } $form->addSubmit('submit', 'Odoslať'); $form->onSuccess[] = array($this, 'handleSendReference'); $form->addHidden('id_product'); $form->setDefaults(array('id_product' => ProductModel::getIdProductByUrl($params['url_identifier'], 1))); return $form; break; default: return parent::createComponent($name); break; } }