コード例 #1
0
ファイル: Front_CartPresenter.php プロジェクト: oaki/demoshop
 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;
 }
コード例 #2
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;
 }
コード例 #3
0
ファイル: UserModel.php プロジェクト: oaki/demoshop
 static function baseForm($check_email = true)
 {
     $form = new MyForm();
     $renderer = $form->getRenderer();
     $renderer->wrappers['group']['label'] = 'h3';
     $form->addGroup(_('Informácie o zákazníkovi'))->setOption('container', 'fieldset id=user-info');
     $form->addText('login', _('Používateľské meno / Email'));
     if ($check_email) {
         $form['login']->addRule(NForm::FILLED, _('Používateľské meno musí byť vyplnené'))->addRule(NForm::EMAIL, _('Používateľské meno musí byť email.'));
     }
     //				$form->addText('email', _('Email'))
     //					->addRule(NForm::FILLED, _('Email musí byť vyplnený'))
     //					->addRule(NForm::EMAIL, _('Email nie je v správnom tvare'));
     $form->addPassword('password', _('Heslo'));
     $form->addPassword('passwordCheck', _('Znova heslo'))->addConditionOn($form['password'], NForm::FILLED)->addRule(NForm::FILLED, _('Zadejte heslo pro kontrolu'))->addRule(NForm::EQUAL, _('Hesla sa musia zhodovať'), $form['password']);
     /*
      * Info o uzivatelovi
      */
     $form->addGroup('Účtovné informácie');
     $form->addRadioList('type', '', array(0 => _('Súkromná osoba'), 1 => _('Podnikateľ - firma')))->addRule(NForm::FILLED, _('Uveďte či ste súkromná osoba alebo firma'))->setDefaultValue(0);
     //$form->addSelect('title', _('Oslovenie'), array( 0=>_('Žiadne'), 1=>_('Pán'),2=>_('Pani'),3=>_('Slečna') ));
     $form->addText('name', _('Meno'))->addRule(NForm::FILLED, _('Meno musí byť vyplnené'));
     $form->addText('surname', _('Priezvisko'))->addRule(NForm::FILLED, _('Priezvisko musí byť vyplnené'));
     $form->addText('address', _('Adresa'))->addRule(NForm::FILLED, _('Adresa musí byť vyplnená'));
     $form->addText('city', _('Mesto'))->addRule(NForm::FILLED, _('Mesto musí byť vyplnené'));
     $form->addText('zip', _('PSČ'))->addRule(NForm::FILLED, _('Priezvisko musí byť vyplnené'));
     $form->addSelect('iso', _('Štát'), UserModel::getAllCountry())->addRule(NForm::FILLED, _('Priezvisko musí byť vyplnené'));
     $form->addText('phone', _('Telefón'))->addRule(NForm::FILLED, _('Telefón musí byť vyplnený'));
     //$form->addText('fax', _('Fax'));
     $form->addGroup(_('Firemné informácie'))->setOption('container', 'fieldset id=company-form-container');
     $form->addText('company_name', _('Názov spoločnosti '))->addConditionOn($form['type'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('Názov spoločnosti musí byť vyplnený'));
     $form->addText('ico', _('IČO'))->addConditionOn($form['type'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('IČO spoločnosti musí byť vyplnené'))->addRule(NForm::MAX_LENGTH, 'Maximálna dĺžka je 12', 12);
     $form->addRadioList('paying_vat', _('Platca DPH'), array(0 => 'platca', 1 => 'neplatca'))->setDefaultValue(0)->addConditionOn($form['type'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('IČO spoločnosti musí byť vyplnené'));
     $form->addText('dic', _('DIČ'))->addConditionOn($form['type'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('DIČ spoločnosti musí byť vyplnené'));
     $form->addGroup('');
     $form->addRadioList('use_delivery_address', _('Dodacia adresa'), array(0 => _('Prednastavená (rovnaká ako fakturačná adresa)'), 1 => _('Iná')))->setDefaultValue(0);
     $form->addGroup(_('Dodacia adresa'))->setOption('container', 'fieldset id=delivery-address-container');
     //$form->addSelect('title', _('Oslovenie'), array( 0=>_('Žiadne'), 1=>_('Pán'),2=>_('Pani'),3=>_('Slečna') ));
     $form->addText('delivery_name', _('Meno'))->addConditionOn($form['use_delivery_address'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('Meno musí byť vyplnené'));
     $form->addText('delivery_surname', _('Priezvisko'))->addConditionOn($form['use_delivery_address'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('Priezvisko musí byť vyplnené'));
     $form->addText('delivery_address', _('Adresa'))->addConditionOn($form['use_delivery_address'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('Adresa musí byť vyplnená'));
     $form->addText('delivery_city', _('Mesto'))->addConditionOn($form['use_delivery_address'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('Mesto musí byť vyplnené'));
     $form->addText('delivery_zip', _('PSČ'))->addConditionOn($form['use_delivery_address'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('Priezvisko musí byť vyplnené'));
     $form->addSelect('delivery_iso', _('Štát'), UserModel::getAllCountry())->addConditionOn($form['use_delivery_address'], NFORM::EQUAL, 1)->addRule(NForm::FILLED, _('Priezvisko musí byť vyplnené'));
     $form->addText('delivery_phone', _('Telefón'));
     return $form;
 }