コード例 #1
0
 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;
     });
 }
コード例 #2
0
ファイル: KeywordControl.php プロジェクト: oaki/demoshop
 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;
 }
コード例 #3
0
ファイル: QuickFilterControl.php プロジェクト: oaki/demoshop
 function createComponent($name)
 {
     switch ($name) {
         case 'order':
             $orderSession = $this->getSession();
             $f = new MyForm();
             $f->getElementPrototype()->class = 'ajax';
             $f->addSelect('order_select', 'Zoradenie podľa: ', $this->getOrderFilterArray())->getControlPrototype()->class = 'orderBy';
             $f->onSuccess[] = array($this, 'handleChangeOrder');
             $f->setDefaults(array('order_select' => $orderSession['order']));
             return $f;
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }
コード例 #4
0
ファイル: newsletterControl.php プロジェクト: oaki/demoshop
 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;
     }
 }
コード例 #5
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;
 }