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 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;
 }
 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;
 }
示例#4
0
 /**
  * Form to add a topic
  *
  * @access protected
  * @return Nette\Application\UI\Form
  * @since 1.0.0
  */
 protected function createComponentForumForm()
 {
     $form = new MyForm();
     $form->addGroup(!$this->forumTopicId ? 'Topic' : 'Reply to topic');
     $form->addText('name', 'Name:', 50, 40)->addRule($form::FILLED, 'Name must be filled.');
     if (!$this->forumTopicId) {
         $form->addText('title', 'Title:', 50, 100)->addRule($form::FILLED, 'Title must be filled.');
     }
     $form->addTextArea('topic', 'Comment:', 87, 5)->addRule($form::FILLED, 'Comment must be filled.');
     $form->addProtection('Security token did not match. Possible CSRF attack.');
     $form->addSubmit('insert', 'Insert');
     $form->onSuccess[] = callback($this, 'forumFormSubmitted');
     return $form;
 }
示例#5
0
 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;
     }
 }
示例#6
0
 private function baseForm()
 {
     $f = new MyForm();
     $renderer = $f->getRenderer();
     $renderer->wrappers['controls']['container'] = NHtml::el('table')->addClass('standard');
     $f->addGroup(_('Pridanie produktu'))->setOption('container', NHtml::el('div')->class('groupHolder')->id('groupHolderMain'));
     $f->getElementPrototype()->class('long_input');
     $langs = Setting::getLangs();
     foreach ($langs as $l) {
         $f->addGroup(count($langs) == 1 ? '' : $l['name'])->setOption('container', 'fieldset class=lang_fieldset id=lang_' . $l['iso']);
         $f->addText('name' . CategoryFormControl::$_separator . $l['iso'], 'Názov')->addRule(NForm::FILLED, _('Nazov musí byť vyplnený.'));
         $f->addTextArea('description' . CategoryFormControl::$_separator . $l['iso'], _('Popis'));
         $f->addTextArea('long_description' . CategoryFormControl::$_separator . $l['iso'], _('Dlhý popis'));
         //			$f->addTextArea('referencies' . CategoryFormControl::$_separator . $l['iso'], _('Referencie') );
         $f->addText('link_rewrite' . CategoryFormControl::$_separator . $l['iso'], _('URL link'));
         $f->addText('meta_title' . CategoryFormControl::$_separator . $l['iso'], _('Titulok'));
         //			$f->addText('meta_keywords' . CategoryFormControl::$_separator . $l['iso'], _('Kľúčové slová') );
         $f->addText('meta_description' . CategoryFormControl::$_separator . $l['iso'], _('Meta popis'));
     }
     $f->addGroup();
     //		$f->addSelect('id_product_supplier',
     //			'Výrobca',
     //			array(NULL => '-------') + SupplierModel::getFluent()->fetchPairs('id_product_supplier', 'name')
     //		);
     //->add(NHtml::el('span')->setHtml('palo'));
     //		$f->addText('price', _('Cena'))
     //			->addRule(NForm::FLOAT, _('Cena musí byť číslo.'));
     //		$f->addText('code', _('Kód tovaru'));
     //		$f->addText('weight', _('Váha'));
     //		$f->addText('packing', _('Balenie'));
     //		$f->addText('unit_of_measure', _('Merná jednotka'));
     //		$f['price']->getControlPrototype()->addClass('short_text');
     //
     //		$f->addText('pack_type', 'Druh balenia');
     //		$f['pack_type']->getControlPrototype()->addClass('short_text');
     //
     //
     //		$f->addText('color', 'Farba');
     //		$f['color']->getControlPrototype()->addClass('short_text');
     //
     //		$f->addText('capacity', 'Objem');
     //		$f['capacity']->getControlPrototype()->addClass('short_text');
     //
     //		$f->addText('product_number', 'Číslo produktu');
     //		$f['product_number']->getControlPrototype()->addClass('short_text');
     //
     //
     //		$f->addText('pack_count', 'Balenie');
     //		$f['pack_count']->getControlPrototype()->addClass('short_text');
     //$f->addText('ean13', 'Kód')->getControlPrototype()->addClass('short_text');
     $vat = VatModel::init();
     if ($this->context->parameters['SHOW_TAX_FOR_PRODUCT'] == 1) {
         $f->addRadioList('id_vat', _('DPH %'), $vat->getFluent()->fetchPairs('id_vat', 'name'))->setDefaultValue($vat->getDefault());
     } else {
         $f->addHidden('id_vat')->setDefaultValue($vat->getDefault());
     }
     //
     //		$f->addText('delivery_date', _('Dodacia lehota (dni)'))
     //			->getControlPrototype()->addClass('short_text');
     $f->addRadioList('active', 'Aktívny', array(1 => 'Povolený', 0 => 'Zakázaný'))->setDefaultValue(1);
     //		$f->addRadioList('available', 'Dostupný do 48 hodín', array(1 => 'áno', 0 => 'nie'))->setDefaultValue(1);
     //		$f->addText('weight', 'Hmotnosť (kg)')->getControlPrototype()->class = 'small';
     //		$f->addCheckbox('our_tip', 'Najpredávanejší');
     //$f->addCheckbox('sale', 'Výpredaj');
     $f->addCheckbox('home', 'Zobraziť na úvode');
     $f->addCheckbox('our_tip', 'TOP');
     $f->addCheckbox('news', 'Novinka');
     $f->addCheckbox('sale', 'Akcia');
     $f->addText('sale_percent', 'Zľava %')->getControlPrototype()->class = 'small';
     $f->addGroup('Kategórie');
     //->setOption('container', NHtml::el('div')->class('groupHolder')->id('categoryHolderOptions'));
     NForm::extensionMethod('NForm::addCBTree', array('CBTree', 'addCBTree'));
     $tree = new TreeView();
     $id_product = $this->getParam('id');
     $tree->primaryKey = 'id_category';
     $tree->parentColumn = 'id_parent';
     $tree->useAjax = true;
     $tree->mode = 1;
     $tree->addLink(null, 'name', 'id', true, $this->presenter);
     $tree->dataSource = CategoryModel::getTreeCheckProduct($id_product)->where("id_lang = %i", $this->getPresenter()->id_lang);
     $f->addCBTree('id_categories', _('Kategórie'), $tree)->initialState = 'expand';
     $f->addGroup('Príslušenstvo');
     $product_alternative = ProductModel::getFluent($this->id_lang)->where('1=1 %if', $id_product, 'AND id_product != %i', $id_product, "%end")->fetchPairs("id_product", 'name');
     $f['product_alternative'] = new MultiSelectDualList('Príslušenstvo', $product_alternative);
     $templateGroupParams = $this->getService('ProductTemplateGroupModel')->fetchPairs();
     //ak je iba jedna, nezobrazi sa vyber
     if (count($templateGroupParams) > 1) {
         $f->addSelect('id_product_template_group', 'Skupina parametrov', $templateGroupParams);
     } else {
         $f->addHidden('id_product_template_group')->setDefaultValue(key($templateGroupParams));
     }
     $f->addHidden('id_product');
     $f->addGroup('')->setOption('container', NHtml::el('div')->class('button'));
     return $f;
 }