Esempio n. 1
0
 public function _addFieldsContentTypeProducerBox($form, $boxContent)
 {
     $ct_ProducerBox = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'ct_ProducerBox', 'label' => _('TXT_LAYOUT_BOX_CONTENT_SETTINGS'))));
     $ct_ProducerBox->AddDependency(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $boxContent, new FormEngine\Conditions\Equals('ProducerBox')));
     $ct_ProducerBox->AddChild(new FormEngine\Elements\Select(array('name' => 'view', 'label' => 'Domyślny widok', 'options' => array(new FormEngine\Option('0', 'Lista'), new FormEngine\Option('1', 'Select')))));
     $ct_ProducerBox->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'producers', 'label' => _('TXT_AVAILABLE_PRODUCERS'), 'options' => FormEngine\Option::Make(App::getModel('producer')->getProducerToSelect()))));
 }
Esempio n. 2
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'contact', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'contacttranslation', 'name', null, array('column' => 'contactid', 'values' => (int) $this->registry->core->getParam()))))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'comment' => _('TXT_EMAIL_FORM'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL')), new FormEngine\Rules\Email(_('ERR_WRONG_EMAIL'))))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT_PHONE'), '/^(\\d{1,}(-|\\s)?\\d{1,})*$/')))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'fax', 'label' => _('TXT_FAX'), 'comment' => _('TXT_FAX_FORM'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT_FAX'), '/^(\\d{1,}(-|\\s)?\\d{1,})*$/')))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'businesshours', 'label' => _('TXT_BUSINESS_HOURS'))));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'publish', 'label' => _('TXT_PUBLISH'), 'options' => array(new FormEngine\Option('1', _('TXT_YES')), new FormEngine\Option('0', _('TXT_NO'))), 'default' => '1')));
     $addressData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'address_data', 'label' => _('TXT_CONTACT_ADDRESS_DATA'))));
     $addressLanguageData = $addressData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $addressLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $addressLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'))));
     $addressLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $place = $addressLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placename', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $addressLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'comment' => _('TXT_POSTCODE_FORM'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT_POSTCODE'), '/^\\d{2}-\\d{3}?$/')))));
     $addressLanguageData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('countrieslist')->getCountryForSelect()), 'default' => 0, 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
     $layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
     $Data = Event::dispatch($this, 'admin.contact.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 3
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'store', 'action' => '', 'method' => 'post'));
     $companyData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'company_data', 'label' => _('TXT_COMPANY_DATA'))));
     $companyData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANY_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_COMPANYNAME'))))));
     $companyData->AddChild(new FormEngine\Elements\TextField(array('name' => 'shortcompanyname', 'label' => _('TXT_SHORT_COMPANY_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SHORT_COMPANY_NAME'))))));
     $companyData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NIP')), new FormEngine\Rules\Custom(_('ERR_WRONG_NIP'), array(App::getModel('vat'), 'checkVAT'))))));
     $companyData->AddChild(new FormEngine\Elements\TextField(array('name' => 'krs', 'label' => _('TXT_KRS'))));
     $addressData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'address_data', 'label' => _('TXT_ADDRESS_COMPANY_DATA'))));
     $addressData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placename', 'label' => _('TXT_PLACENAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $addressData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE'))))));
     $addressData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $addressData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'))));
     $addressData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $addressData->AddChild(new FormEngine\Elements\TextField(array('name' => 'province', 'label' => _('TXT_PROVINCE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PROVINCE'))))));
     $addressData->AddChild(new FormEngine\Elements\Select(array('name' => 'countries', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('countrieslist')->getCountryForSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $bankData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'bank_data', 'label' => _('TXT_BANK_DATA'))));
     $bankData->AddChild(new FormEngine\Elements\TextField(array('name' => 'bankname', 'label' => _('TXT_BANK_NAME'))));
     $bankData->AddChild(new FormEngine\Elements\TextField(array('name' => 'banknr', 'label' => _('TXT_BANK_NUMBER'), 'comment' => _('TXT_BANK_NUMBER_FORMAT'))));
     $photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'photos_pane', 'label' => _('TXT_SINGLE_PHOTO'))));
     $photosPane->AddChild(new FormEngine\Elements\Image(array('name' => 'photo', 'label' => _('INVOICE_SINGLE_PHOTO'), 'repeat_min' => 0, 'repeat_max' => 1, 'upload_url' => App::getURLAdressWithAdminPane() . 'files/add')));
     $invoicedata = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'invoice_data', 'label' => _('TXT_INVOICE'))));
     $isinvoiceshopslogan = $invoicedata->AddChild(new FormEngine\Elements\RadioValueGroup(array('name' => 'isinvoiceshopslogan', 'label' => _('TXT_INVOICE_SHOW_SHOP_NAME_AND_TAG'), 'options' => FormEngine\Option::Make(array('1' => _('TXT_INVOICE_SHOW_SHOP_NAME'), '2' => _('TXT_INVOICE_SHOW_SHOP_NAME_AND_TAG'))), 'value' => '1')));
     $invoicedata->AddChild(new FormEngine\Elements\TextField(array('name' => 'invoiceshopslogan', 'label' => _('TXT_NAME_OF_INVOICE_TAG'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_EMPTY_NAME_OF_INVOICE_TAG'))), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $isinvoiceshopslogan, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('2')))))));
     $Data = Event::dispatch($this, 'admin.store.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 4
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'currencieslist', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_CURRENCY_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME'))))));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'symbol', 'label' => _('TXT_CURRENCY_SYMBOL'), 'options' => FormEngine\Option::Make(App::getModel('currencieslist')->getCurrenciesALLToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CURRENCY_SYMBOL'))))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'decimalseparator', 'label' => _('TXT_CURRENCY_DECIMAL_SEPARATOR'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CURRENCY_DECIMAL_SEPARATOR'))))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'decimalcount', 'label' => _('TXT_CURRENCY_DECIMAL_COUNT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CURRENCY_DECIMAL_COUNT'))))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'thousandseparator', 'label' => _('TXT_CURRENCY_THOUSAND_SEPARATOR'))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'positivepreffix', 'label' => _('TXT_CURRENCY_POSITIVE_PREFFIX'))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'positivesuffix', 'label' => _('TXT_CURRENCY_POSITIVE_SUFFIX'))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'negativepreffix', 'label' => _('TXT_CURRENCY_NEGATIVE_PREFFIX'))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'negativesuffix', 'label' => _('TXT_CURRENCY_NEGATIVE_SUFFIX'))));
     $exchangeData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'exchange_data', 'label' => _('TXT_CURRENCY_EXCHANGE'))));
     $currencies = App::getModel('currencieslist')->getCurrencies();
     foreach ($currencies as $key => $currency) {
         $exchangeData->AddChild(new FormEngine\Elements\TextField(array('name' => 'currency_' . $currency['idcurrency'], 'label' => $currency['currencysymbol'], 'filters' => array(new FormEngine\Filters\CommaToDotChanger()))));
     }
     $layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
     $layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
     $Data = Event::dispatch($this, 'admin.currencieslist.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 5
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'language', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'comment' => _('TXT_EXAMPLE') . ': en_EN', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\Unique(_('ERR_NAME_ALREADY_EXISTS'), 'language', 'name', null, array('column' => 'idlanguage', 'values' => (int) $this->registry->core->getParam()))))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'translation', 'label' => _('TXT_TRANSLATION'), 'comment' => _('TXT_EXAMPLE') . ': TXT_ENGLISH', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_TRANSLATION'))))));
     if ($this->registry->core->getParam() == '') {
         $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'copylanguage', 'label' => _('TXT_COPY_FROM_LANGUAGE'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('language')->getLanguageALLToSelect()), 'default' => 0)));
     }
     $requiredData->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'translations', 'label' => 'Plik z tłumaczeniem', 'file_source' => 'upload/', 'file_types' => array('xml'))));
     $currencies = App::getModel('currencieslist')->getCurrencyForSelect();
     $currencyData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'currency_data', 'label' => _('TXT_CURRENCY_DATA'))));
     $currencyData->AddChild(new FormEngine\Elements\Select(array('name' => 'currencyid', 'label' => _('TXT_DEFAULT_LANGUAGE_CURRENCY'), 'options' => FormEngine\Option::Make($currencies))));
     $flagPane = $form->addChild(new FormEngine\Elements\Fieldset(array('name' => 'flag_pane', 'label' => _('TXT_LANGUAGE_FLAG'))));
     $flagPane->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'flag', 'label' => _('TXT_LANGUAGE_FLAG'), 'file_source' => 'design/_images_common/icons/languages/', 'file_types' => array('png'))));
     $layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
     $layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
     $Data = Event::dispatch($this, 'admin.language.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 6
0
    public function getPaymentMethodConfigurationForm($event, $request)
    {
        if ($request['data']['paymentmethodmodel'] != $this->getName()) {
            return false;
        }
        $payu =& $request['form']->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'payu_data', 'label' => 'Konfiguracja')));
        $payu->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Wprowadź dane punktu płatności. Adresy konieczne do ustawienia przy jego tworzeniu to:</p>
					<ul>
					<li>Adres powrotu - błąd: <strong>' . $this->registry->router->generate('frontend.payment', true, array('action' => 'cancel', 'param' => 'platnosci')) . '</strong></li>
					<li>Adres powrotu - poprawnie: <strong>' . $this->registry->router->generate('frontend.payment', true, array('action' => 'confirm', 'param' => 'platnosci')) . '</strong></li>
					<li>Adres raportów: <strong>' . $this->registry->router->generate('frontend.payment', true, array('action' => 'report', 'param' => 'platnosci')) . '</strong></li>
		
		</ul>')));
        $payu->AddChild(new FormEngine\Elements\TextField(array('name' => 'idpos', 'label' => 'Id punktu płatności (pos_id)')));
        $payu->AddChild(new FormEngine\Elements\Password(array('name' => 'firstmd5', 'label' => 'Klucz (MD5)')));
        $payu->AddChild(new FormEngine\Elements\TextField(array('name' => 'secondmd5', 'label' => 'Drugi klucz (MD5)')));
        $payu->AddChild(new FormEngine\Elements\TextField(array('name' => 'authkey', 'label' => 'Klucz autoryzacji płatności (pos_auth_key)')));
        $statuses = App::getModel('orderstatus')->getOrderStatusToSelect();
        $payu->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Ustaw powiązania statusów PayU ze sklepem</p>')));
        foreach ($this->_statusMap as $id => $name) {
            $payu->AddChild(new FormEngine\Elements\Select(array('name' => 'payu_status_' . $id, 'label' => $name, 'options' => FormEngine\Option::Make($statuses))));
        }
        $settings = $this->registry->core->loadModuleSettings('payu', Helper::getViewId());
        if (!empty($settings)) {
            $populate = array('payu_data' => array('idpos' => $settings['idpos'], 'firstmd5' => $settings['firstmd5'], 'secondmd5' => $settings['secondmd5'], 'authkey' => $settings['authkey']));
            foreach ($this->_statusMap as $id => $name) {
                if (isset($settings['payu_status_' . $id])) {
                    $populate['payu_data']['payu_status_' . $id] = $settings['payu_status_' . $id];
                }
            }
            $event->setReturnValues($populate);
        }
    }
Esempio n. 7
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'producer', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'producertranslation', 'name', null, array('column' => 'producerid', 'values' => (int) $this->registry->core->getParam()))))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'seo', 'label' => _('TXT_SEO_URL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SEO_URL'))))));
     $languageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'), 'rows' => 10)));
     $requiredData->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'deliverer', 'label' => _('TXT_DELIVERER'), 'options' => FormEngine\Option::Make(App::getModel('deliverer')->getDelivererToSelect()))));
     $requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p style="padding-left: 195px;"><a href="' . App::getURLAdressWithAdminPane() . 'deliverer/add' . '" target="_blank"><span>' . _('TXT_ADD_DELIVERER') . '</span></a></p>')));
     $metaData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'meta_data', 'label' => _('TXT_META_INFORMATION'))));
     $metaData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">W przypadku braku informacji META system wygeneruje je automatycznie. W każdej chwili możesz je zmienić edytując dane poniżej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $languageData = $metaData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'keyword_title', 'label' => _('TXT_KEYWORD_TITLE'))));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword_description', 'label' => _('TXT_KEYWORD_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 1000', 'max_length' => 1000)));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword', 'label' => _('TXT_KEYWORDS'), 'comment' => _('TXT_KEYWORDS_HELP'))));
     $photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'photos_pane', 'label' => _('TXT_SINGLE_PHOTO'))));
     $photosPane->AddChild(new FormEngine\Elements\Image(array('name' => 'photo', 'label' => _('TXT_SINGLE_PHOTO'), 'repeat_min' => 0, 'repeat_max' => 1, 'upload_url' => App::getURLAdressWithAdminPane() . 'files/add')));
     $layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
     $layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
     $Data = Event::dispatch($this, 'admin.producer.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 8
0
 public function _addFieldsContentTypeShowcaseBox($form, $boxContent)
 {
     $ct_ShowcaseBox = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'ct_ShowcaseBox', 'label' => _('TXT_LAYOUT_BOX_CONTENT_SETTINGS'))));
     $ct_ShowcaseBox->AddDependency(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $boxContent, new FormEngine\Conditions\Equals('ShowcaseBox')));
     $ct_ShowcaseBox->AddChild(new FormEngine\Elements\TextField(array('name' => 'productsCount', 'label' => 'Maks. liczba produktów', 'comment' => 'Domyślnie 0 (bez ograniczenia)')));
     $ct_ShowcaseBoxOrderBy = $ct_ShowcaseBox->AddChild(new FormEngine\Elements\Select(array('name' => 'ct_ShowcaseBox_orderBy', 'label' => 'Domyślne sortowanie', 'options' => array(new FormEngine\Option('id', 'ID produktu'), new FormEngine\Option('name', 'Nazwa'), new FormEngine\Option('price', 'Cena'), new FormEngine\Option('rating', 'Ocena klientów'), new FormEngine\Option('opinions', 'Ilość recenzji'), new FormEngine\Option('adddate', 'Data dodania'), new FormEngine\Option('random', 'Losowo')))));
     $ct_ShowcaseBox->AddChild(new FormEngine\Elements\Select(array('name' => 'ct_ShowcaseBox_orderDir', 'label' => 'Kolejność sortowania', 'options' => array(new FormEngine\Option('asc', 'Rosnąco'), new FormEngine\Option('desc', 'Malejąco')), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $ct_ShowcaseBoxOrderBy, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('random')))))));
     $ct_ShowcaseBox->AddChild(new FormEngine\Elements\Select(array('name' => 'statusId', 'label' => 'Status', 'comment' => 'Będą wyświetlone tylko produkty o tych statusach', 'options' => FormEngine\Option::Make(App::getModel('productstatus')->getProductstatusAll(false)))));
 }
Esempio n. 9
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'buyalso', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_BASE_PRODUCT'))));
     $requiredData->AddChild(new FormEngine\Elements\Constant(array('name' => 'name', 'label' => _('TXT_BASE_PRODUCT'))));
     $requiredData->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'products', 'label' => _('TXT_BUY_ALSO_LIST'), 'options' => FormEngine\Option::Make(App::getModel('buyalso')->getProductAlsoToSelect()))));
     $Data = Event::dispatch($this, 'admin.buyalso.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 10
0
 public function getPaymentMethodConfigurationForm($event, $request)
 {
     if ($request['data']['paymentmethodmodel'] != $this->getName()) {
         return false;
     }
     $dotpay =& $request['form']->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'dotpay_data', 'label' => 'Konfiguracja')));
     $dotpay->AddChild(new FormEngine\Elements\TextField(array('name' => 'idsprzedawcy', 'label' => 'Id sprzedawcy')));
     $dotpay->AddChild(new FormEngine\Elements\Password(array('name' => 'pin', 'label' => 'PIN')));
     $dotpay->AddChild(new FormEngine\Elements\Select(array('name' => 'positiveorderstatusid', 'label' => 'Status zamówienia dla płatności zakończonej', 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $dotpay->AddChild(new FormEngine\Elements\Select(array('name' => 'negativeorderstatusid', 'label' => 'Status zamówienia dla płatności anulowanej', 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $settings = $this->registry->core->loadModuleSettings('dotpay', Helper::getViewId());
     if (!empty($settings)) {
         $populate = array('dotpay_data' => array('idsprzedawcy' => $settings['idsprzedawcy'], 'pin' => $settings['pin'], 'positiveorderstatusid' => $settings['positiveorderstatusid'], 'negativeorderstatusid' => $settings['negativeorderstatusid']));
         $event->setReturnValues($populate);
     }
 }
Esempio n. 11
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'orderstatus', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'orderstatustranslation', 'name', null, array('column' => 'orderstatusid', 'values' => (int) $this->registry->core->getParam()))))));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'comment', 'label' => _('TXT_DEFAULT_ORDER_COMMENT'))));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'orderstatusgroupsid', 'label' => _('TXT_ORDER_STATUS_GROUPS'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_ORDER_STATUS_GROUPS'))), 'options' => FormEngine\Option::Make(App::getModel('orderstatusgroups/orderstatusgroups')->getOrderStatusGroupsAllToSelect(), $this->registry->core->getDefaultValueToSelect()))));
     $Data = Event::dispatch($this, 'admin.orderstatus.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 12
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'orderstatusgroups', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_TOPIC_ALREADY_EXISTS'), 'orderstatusgroupstranslation', 'name', null, array('column' => 'orderstatusgroupsid', 'values' => (int) $this->registry->core->getParam()))))));
     $requiredData->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'orderstatus', 'label' => _('TXT_ORDERSTATUS'), 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $requiredData->AddChild(new FormEngine\Elements\ColourSchemePicker(array('name' => 'colour', 'label' => 'Kolor statusów zamówień', 'type_colour' => true, 'type_gradient' => false, 'type_image' => false)));
     $Data = Event::dispatch($this, 'admin.orderstatusgroups.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 13
0
 public function getPaymentMethodConfigurationForm($event, $request)
 {
     if ($request['data']['paymentmethodmodel'] != $this->getName()) {
         return false;
     }
     $paypal =& $request['form']->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'paypal_data', 'label' => 'Konfiguracja')));
     $paypal->AddChild(new FormEngine\Elements\TextField(array('name' => 'business', 'label' => 'Adres email')));
     $paypal->AddChild(new FormEngine\Elements\TextField(array('name' => 'apiusername', 'label' => 'Nazwa użytkownika API', 'comment' => 'Wprowadź nazwę użytkownika API')));
     $paypal->AddChild(new FormEngine\Elements\TextField(array('name' => 'apipassword', 'label' => 'Hasło użytkownika API', 'comment' => 'Wprowadź hasło użytkownika API')));
     $paypal->AddChild(new FormEngine\Elements\TextField(array('name' => 'apisignature', 'label' => 'Sygnatura API', 'comment' => 'Wprowadź sygnaturę API')));
     $paypal->AddChild(new FormEngine\Elements\Select(array('name' => 'sandbox', 'label' => 'Sandbox', 'options' => array(new FormEngine\Option(0, 'Nie (korzystaj z wersji Live)'), new FormEngine\Option(1, 'Tak (korzystaj z Sandbox)')))));
     $paypal->AddChild(new FormEngine\Elements\Select(array('name' => 'positiveorderstatusid', 'label' => 'Status zamówienia dla płatności zakończonej', 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()), 'help' => 'Wybierz status zamówienia po zaakceptowaniu płatności')));
     $paypal->AddChild(new FormEngine\Elements\Select(array('name' => 'negativeorderstatusid', 'label' => 'Status zamówienia dla płatności anulowanej', 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()), 'comment' => 'Wybierz status zamówienia po anulowaniu płatności')));
     $settings = $this->registry->core->loadModuleSettings('paypal', Helper::getViewId());
     if (!empty($settings)) {
         $populate = array('paypal_data' => array('business' => $settings['business'], 'apipassword' => $settings['apipassword'], 'apiusername' => $settings['apiusername'], 'apisignature' => $settings['apisignature'], 'sandbox' => $settings['sandbox'], 'positiveorderstatusid' => $settings['positiveorderstatusid'], 'negativeorderstatusid' => $settings['negativeorderstatusid']));
         $event->setReturnValues($populate);
     }
 }
Esempio n. 14
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'globalsettings', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'config_data', 'label' => _('TXT_SYSTEM_CONFIGURATION'))));
     $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_ATTENTION_AFTER_CHANGING_ADMINLINK') . '</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'admin_panel_link', 'label' => _('TXT_ADMIN_PANEL_LINK'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_ADMIN_PANEL_LINK'))), 'default' => __ADMINPANE__)));
     $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_SSL_HELP') . '</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'ssl', 'label' => _('TXT_ENABLE_SSL'))));
     $gallerySettings = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'gallerysettings_data', 'label' => _('TXT_GALLERY_SETTINGS'))));
     $gallerySettings->AddChild(new FormEngine\Elements\ColourSchemePicker(array('name' => 'colour', 'label' => _('TXT_GALLERY_BGCOLOUR'), 'type_colour' => true, 'type_gradient' => false, 'type_image' => false, 'file_source' => 'upload/')));
     $gallerySettings->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_GALLERY_SMALLEST_IMAGE_SETTINGS') . '</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'smallest_width', 'label' => _('TXT_WIDTH'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'smallest_height', 'label' => _('TXT_HEIGHT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'smallest_keepproportion', 'label' => _('TXT_KEEP_PROPORTION'))));
     $gallerySettings->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_GALLERY_SMALL_IMAGE_SETTINGS') . '</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'small_width', 'label' => _('TXT_WIDTH'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'small_height', 'label' => _('TXT_HEIGHT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'small_keepproportion', 'label' => _('TXT_KEEP_PROPORTION'))));
     $gallerySettings->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_GALLERY_MEDIUM_IMAGE_SETTINGS') . '</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'medium_width', 'label' => _('TXT_WIDTH'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'medium_height', 'label' => _('TXT_HEIGHT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'medium_keepproportion', 'label' => _('TXT_KEEP_PROPORTION'))));
     $gallerySettings->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_GALLERY_NORMAL_IMAGE_SETTINGS') . '</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'normal_width', 'label' => _('TXT_WIDTH'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'normal_height', 'label' => _('TXT_HEIGHT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'normal_keepproportion', 'label' => _('TXT_KEEP_PROPORTION'))));
     $gallerySettings->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_GALLERY_LARGE_IMAGE_SETTINGS') . '</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'large_width', 'label' => _('TXT_WIDTH'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'large_height', 'label' => _('TXT_HEIGHT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))), 'suffix' => 'px')));
     $gallerySettings->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'large_keepproportion', 'label' => _('TXT_KEEP_PROPORTION'))));
     $interfaceSettings = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'interface', 'label' => _('TXT_INTERFACE_SETTINGS'))));
     $interfaceSettings->AddChild(new FormEngine\Elements\TextField(array('name' => 'datagrid_rows_per_page', 'label' => _('TXT_DATAGRID_ROWS_PER_PAGE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_DATAGRID_ROWS_PER_PAGE'))), 'default' => 50)));
     $interfaceSettings->AddChild(new FormEngine\Elements\Select(array('name' => 'datagrid_click_row_action', 'label' => _('TXT_DATAGRID_CLICK_ROW_ACTION'), 'options' => FormEngine\Option::Make(array('edit' => _('TXT_DATAGRID_EDIT_ROW'), 'contextmenu' => _('TXT_SHOW_CONTEXT_MENU'))))));
     $Data = Event::dispatch($this, 'admin.globalsettings.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 15
0
 public function initForm($addForm = 0)
 {
     $form = new FormEngine\Elements\Form(array('name' => 'paymentmethod', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $basicLanguageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $basicLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\Unique(_('ERR_NAME_ALREADY_EXISTS'), 'paymentmethodtranslation', 'name', null, array('column' => 'paymentmethodid', 'values' => (int) $this->registry->core->getParam()))))));
     if ($addForm) {
         $Data = Event::dispatch($this, 'admin.paymentmethod.getPaymentMethods', array('data' => array()));
         $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'controller', 'label' => _('TXT_PAYMENT_CONTROLLER'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PAYMENT_CONTROLLER'))), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + $Data))));
     } else {
         $requiredData->AddChild(new FormEngine\Elements\Constant(array('name' => 'controller', 'label' => _('TXT_PAYMENT_CONTROLLER'))));
     }
     $layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
     $layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'))));
     $requiredData->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'dispatchmethod', 'label' => _('TXT_DISPATCHMETHOD'), 'options' => FormEngine\Option::Make(App::getModel('dispatchmethod')->getDispatchmethodToSelect()))));
     $Data = Event::dispatch($this, 'admin.paymentmethod.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 16
0
 public function getPaymentMethodConfigurationForm($event, $request)
 {
     if ($request['data']['paymentmethodmodel'] != $this->getName()) {
         return false;
     }
     $paybynet =& $request['form']->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'paybynet_data', 'label' => _('TXT_CONFIGURATION'))));
     $paybynet->AddChild(new FormEngine\Elements\TextField(array('name' => 'id_client', 'label' => _('TXT_NIP'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -]+$/')))));
     $paybynet->AddChild(new FormEngine\Elements\Password(array('name' => 'password', 'label' => _('TXT_PASSWORD'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED'))))));
     $accname = $paybynet->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'accname', 'label' => 'Rachunek bankowy')));
     $accname->AddChild(new FormEngine\Elements\TextField(array('name' => 'accname_ac', 'label' => 'Numer rachunku', 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -]+$/')))));
     $accname->AddChild(new FormEngine\Elements\TextField(array('name' => 'accname_nm', 'label' => 'Nazwa  rachunku bankowego', 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED'))))));
     $accname->AddChild(new FormEngine\Elements\TextField(array('name' => 'accname_zp', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED'))))));
     $accname->AddChild(new FormEngine\Elements\TextField(array('name' => 'accname_ci', 'label' => _('TXT_PLACENAME'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED'))))));
     $accname->AddChild(new FormEngine\Elements\TextField(array('name' => 'accname_st', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED'))))));
     $accname->AddChild(new FormEngine\Elements\TextField(array('name' => 'accname_ct', 'label' => _('TXT_COUNTRY'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_REQUIRED'))))));
     $paybynet->AddChild(new FormEngine\Elements\Select(array('name' => 'verificationrejectedorderstatusid', 'label' => 'Weryfikacja odrzucona', 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $paybynet->AddChild(new FormEngine\Elements\Select(array('name' => 'positiveorderstatusid', 'label' => 'Status zamówienia dla płatności zakończonej', 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $paybynet->AddChild(new FormEngine\Elements\Select(array('name' => 'negativeorderstatusid', 'label' => 'Status zamówienia dla płatności anulowanej', 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $settings = $this->registry->core->loadModuleSettings('paybynet', Helper::getViewId());
     if (!empty($settings)) {
         $populate = array('paybynet_data' => array('id_client' => $settings['id_client'], 'accname' => array('accname_ac' => $settings['accname_ac'], 'accname_nm' => $settings['accname_nm'], 'accname_zp' => $settings['accname_zp'], 'accname_ci' => $settings['accname_ci'], 'accname_st' => $settings['accname_st'], 'accname_ct' => $settings['accname_ct']), 'password' => $settings['password'], 'positiveorderstatusid' => $settings['positiveorderstatusid'], 'negativeorderstatusid' => $settings['negativeorderstatusid'], 'verificationrejectedorderstatusid' => $settings['verificationrejectedorderstatusid']));
         $event->setReturnValues($populate);
     }
 }
Esempio n. 17
0
 public function initForm()
 {
     $set = App::getModel('attributegroup')->getSugestVariant((int) $this->registry->core->getParam());
     $availablity = $this->registry->core->getDefaultValueToSelect() + App::getModel('availablity')->getAvailablityToSelect();
     $form = new FormEngine\Elements\Form(array('name' => 'product', 'action' => '', 'method' => 'post'));
     $basicPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'basic_pane', 'label' => _('TXT_BASIC_INFORMATION'))));
     $basicLanguageData = $basicPane->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $seoname = $basicLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_PRODUCT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PRODUCT_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'producttranslation', 'name', null, array('column' => 'productid', 'values' => (int) $this->registry->core->getParam()))))));
     $basicLanguageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'seo', 'label' => _('TXT_PRODUCT_SEO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PRODUCT_SEO')), new FormEngine\Rules\Format(_('ERR_ALPHANUMERIC_INVALID'), '/^[A-Za-z0-9-_\\",\'\\s]+$/'), new FormEngine\Rules\LanguageUnique('Wybierz inny adres URL, podany już istnieje', 'producttranslation', 'seo', null, array('column' => 'productid', 'values' => (int) $this->registry->core->getParam()))))));
     $basicPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'enable', 'label' => _('TXT_ENABLE_PRODUCT'), 'default' => '0')));
     $basicPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'ean', 'label' => _('TXT_EAN'))));
     $basicPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'delivelercode', 'label' => _('TXT_DELIVELERCODE'))));
     $producerid = $basicPane->AddChild(new FormEngine\Elements\Select(array('name' => 'producerid', 'label' => _('TXT_PRODUCER'), 'addable' => true, 'onAdd' => 'xajax_AddProducer', 'add_item_prompt' => 'Podaj nazwę producenta', 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('producer')->getProducerToSelect()))));
     $basicPane->AddChild(new FormEngine\Elements\Select(array('name' => 'delivererid', 'label' => _('TXT_DELIVERER'), 'addable' => true, 'onAdd' => 'xajax_AddDeliverer', 'add_item_prompt' => 'Podaj nazwę dostawcy', 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('deliverer')->getDelivererToSelect()))));
     $metaData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'meta_data', 'label' => _('TXT_META_INFORMATION'))));
     $metaData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">W przypadku braku informacji META system wygeneruje je automatycznie. W każdej chwili możesz je zmienić edytując dane poniżej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $languageData = $metaData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'keywordtitle', 'label' => _('TXT_KEYWORD_TITLE'))));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyworddescription', 'label' => _('TXT_KEYWORD_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 1000', 'max_length' => 1000)));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword', 'label' => _('TXT_KEYWORDS'), 'comment' => _('TXT_KEYWORDS_HELP'))));
     $stockPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'stock_pane', 'label' => _('TXT_SHIPPING_STOCK_SETTINGS'))));
     if ((int) $set > 0) {
         $stockPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p><strong style="color: red;">UWAGA:</strong>Ten produkt posiada warianty produktu. Jego stan magazynowy zostanie określony automatycznie na podstawie sumy stanów magazynowych wszystkich wariantów. Przejdź do zakładki Warianty produktu aby edytować stany.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
         $stockPane->AddChild(new FormEngine\Elements\Constant(array('name' => 'stock', 'label' => _('TXT_STOCK'), 'suffix' => _('TXT_QTY'), 'default' => 0)));
         $stockPane->AddChild(new FormEngine\Elements\Hidden(array('name' => 'stock', 'label' => _('TXT_STOCK'), 'default' => 0)));
     } else {
         $stockPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'stock', 'label' => _('TXT_STOCK'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STOCK')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'suffix' => _('TXT_QTY'), 'default' => 0)));
     }
     $stockPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Śledzenie stanu magazynowego spowoduje, że stan magazynowy będzie się zmieniał automatycznie w przypadku zamówień. Produkty z włączonym śledzeniem i ilością 0 nie będą mogły być zamówione przez klientów.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $stockPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'trackstock', 'label' => _('TXT_TRACKSTOCK'))));
     $disableatstockenabled = $stockPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'disableatstockenabled', 'label' => _('TXT_DISABLEATSTOCK_ENABLE'), 'default' => '0')));
     $stockPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'disableatstock', 'label' => _('TXT_DISABLEATSTOCK'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $disableatstockenabled, new FormEngine\Conditions\Equals('1'))), 'default' => '0')));
     $stockPane->AddChild(new FormEngine\Elements\Select(array('name' => 'availablityid', 'label' => _('TXT_AVAILABLITY'), 'options' => FormEngine\Option::Make($availablity))));
     $categoryPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'category_pane', 'label' => _('TXT_CATEGORY'))));
     $categoryPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz kategorie w jakich ma pojawić się produkt. Kategoriami możesz zarządzać na stronie <a href="' . $this->registry->router->generate('admin', true, array('controller' => 'category')) . '" target="_blank">Katalog &raquo; Kategorie</a>.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $category = $categoryPane->AddChild(new FormEngine\Elements\Tree(array('name' => 'category', 'label' => _('TXT_CATEGORY'), 'choosable' => false, 'selectable' => true, 'sortable' => false, 'clickable' => false, 'items' => App::getModel('view')->getChildCategories(), 'load_children' => array(App::getModel('view'), 'getChildCategories'))));
     $pricePane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'price_pane', 'label' => _('TXT_PRICE'))));
     $vat = $pricePane->AddChild(new FormEngine\Elements\Select(array('name' => 'vatid', 'label' => _('TXT_VAT'), 'options' => FormEngine\Option::Make(App::getModel('vat')->getVATAll()), 'addable' => true, 'onAdd' => 'xajax_AddVat', 'add_item_prompt' => 'Podaj wartość stawki VAT')));
     $currencies = App::getModel('currencieslist')->getCurrencyForSelect();
     $sellcurrency = $pricePane->AddChild(new FormEngine\Elements\Select(array('name' => 'sellcurrencyid', 'label' => _('TXT_SELL_CURRENCY'), 'options' => FormEngine\Option::Make($currencies), 'default' => Session::getActiveShopCurrencyId())));
     $buycurrency = $pricePane->AddChild(new FormEngine\Elements\Select(array('name' => 'buycurrencyid', 'label' => _('TXT_BUY_CURRENCY'), 'options' => FormEngine\Option::Make($currencies), 'default' => Session::getActiveShopCurrencyId())));
     $pricePane->AddChild(new FormEngine\Elements\Price(array('name' => 'buyprice', 'label' => _('TXT_BUYPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_BUYPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'vat_field' => $vat)));
     $standardPrice = $pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'standard_price', 'label' => _('TXT_STANDARD_SELLPRICE'), 'class' => 'priceGroup')));
     $price = $standardPrice->AddChild(new FormEngine\Elements\Price(array('name' => 'sellprice', 'label' => _('TXT_SELLPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat)));
     $enablePromotion = $standardPrice->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion', 'label' => _('TXT_ENABLE_PROMOTION'), 'default' => '0')));
     $standardPrice->AddChild(new FormEngine\Elements\Price(array('name' => 'discountprice', 'label' => _('TXT_DISCOUNTPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1))))));
     $standardPrice->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionstart', 'label' => _('TXT_START_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1))))));
     $standardPrice->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionend', 'label' => _('TXT_END_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1))))));
     $pricePane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center"><strong>Ceny dla grup klientów</strong><br />Jeżeli chcesz aby dana grupa klientów posiadała inne ceny, uzupełnij wybrane sekcje poniżej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $clientGroups = App::getModel('clientgroup/clientgroup')->getClientGroupAll();
     foreach ($clientGroups as $clientGroup) {
         $group = $pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'field_' . $clientGroup['id'], 'label' => $clientGroup['name'], 'class' => 'priceGroup')));
         $groups[$clientGroup['id']] = $group->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'groupid_' . $clientGroup['id'], 'label' => _('TXT_ENABLE_GROUP_PRICE'), 'default' => '0')));
         $group->AddChild(new FormEngine\Elements\Price(array('name' => 'sellprice_' . $clientGroup['id'], 'label' => _('TXT_SELLPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $groups[$clientGroup['id']], new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals(1)))))));
         $promotion[$clientGroup['id']] = $group->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion_' . $clientGroup['id'], 'label' => _('TXT_ENABLE_CLIENTGROUP_PROMOTION'), 'default' => '0')));
         $group->AddChild(new FormEngine\Elements\Price(array('name' => 'discountprice_' . $clientGroup['id'], 'label' => _('TXT_DISCOUNTPRICE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SELLPRICE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'vat_field' => $vat, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1))))));
         $group->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionstart_' . $clientGroup['id'], 'label' => _('TXT_START_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1))))));
         $group->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionend_' . $clientGroup['id'], 'label' => _('TXT_END_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1))))));
     }
     $weightPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'weight_pane', 'label' => _('TXT_WEIGHT_DATA'))));
     $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'weight', 'label' => _('TXT_WEIGHT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_WEIGHT')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'suffix' => 'kg', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'default' => 0)));
     $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'width', 'label' => _('TXT_WIDTH'), 'suffix' => 'cm', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()))));
     $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'height', 'label' => _('TXT_HEIGHT'), 'suffix' => 'cm', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()))));
     $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'deepth', 'label' => _('TXT_DEEPTH'), 'suffix' => 'cm', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()))));
     $weightPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz miarę produktu w jakiej sprzedawany jest produkt. Jednostkami możesz zarządzać na stronie <a href="' . $this->registry->router->generate('admin', true, array('controller' => 'unitmeasure')) . '" target="_blank">Katalog &raquo; Jednostka miary</a>. Jeżeli chcesz tylko dodać nową opcję, użyj ikony dodawania obok listy wyboru.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $weightPane->AddChild(new FormEngine\Elements\Select(array('name' => 'unit', 'label' => _('TXT_UNIT_MEASURE'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('unitmeasure')->getUnitMeasureToSelect()), 'addable' => true, 'onAdd' => 'xajax_AddUnitMeasure', 'add_item_prompt' => 'Podaj nazwę jednostki miary', 'default' => 0)));
     $weightPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wpisz ilość sztuk w opakowaniu. Podczas dodawania produktu do koszyka ilość zostanie zaokrąglona do pełnych opakowań</p>')));
     $weightPane->AddChild(new FormEngine\Elements\TextField(array('name' => 'packagesize', 'label' => _('TXT_PACKAGE_SIZE'), 'comment' => _('TXT_PACKAGE_SIZE_HELP'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PACKAGE_SIZE')), new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'default' => 1)));
     $descriptionPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'description_pane', 'label' => _('TXT_DESCRIPTION'))));
     $descriptionLanguageData = $descriptionPane->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $descriptionLanguageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'shortdescription', 'label' => _('TXT_SHORTDESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 1000', 'max_length' => 1000, 'rows' => 20)));
     $descriptionLanguageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 5000', 'max_length' => 5000, 'rows' => 30)));
     $descriptionLanguageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'longdescription', 'label' => _('TXT_ADDITIONAL_INFO'), 'rows' => 30)));
     $photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'photos_pane', 'label' => _('TXT_PHOTOS'))));
     $photosPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz zdjęcia dla produktu z biblioteki lub wgraj je z dysku komputera. Zdjęcie oznaczone jako główne będzie wyświetlane w listach produktów oraz w karcie produktu jako pierwsze.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $photosPane->AddChild(new FormEngine\Elements\Image(array('name' => 'photo', 'label' => _('TXT_PHOTOS'), 'repeat_min' => 0, 'repeat_max' => FormEngine\FE::INFINITE, 'upload_url' => App::getURLAdressWithAdminPane() . 'files/add', 'main_id' => isset($this->populateData['photos_pane']['mainphotoid']) ? $this->populateData['photos_pane']['mainphotoid'] : '')));
     $filePane = $form->addChild(new FormEngine\Elements\Fieldset(array('name' => 'files_pane', 'label' => _('TXT_FILES'))));
     $filePane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz pliki z biblioteki, które chcesz przypisać do tego produktu.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $filePane->AddChild(new FormEngine\Elements\Downloader(array('name' => 'file', 'label' => _('TXT_FILES'), 'repeat_min' => 0, 'repeat_max' => FormEngine\FE::INFINITE, 'upload_url' => App::getURLAdressWithAdminPane() . 'virtualproduct/add')));
     $warrantyPane = $form->addChild(new FormEngine\Elements\Fieldset(array('name' => 'warranty_pane', 'label' => _('TXT_WARRANTY'))));
     $warrantyPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz pliki z biblioteki, które chcesz przypisać do tego produktu.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $warrantyPane->AddChild(new FormEngine\Elements\Downloader(array('name' => 'warranty', 'label' => _('TXT_WARRANTY'), 'repeat_min' => 0, 'repeat_max' => FormEngine\FE::INFINITE, 'upload_url' => App::getURLAdressWithAdminPane() . 'virtualproduct/add')));
     $upsellProducts = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'upsell_products', 'label' => _('TXT_UPSELL'))));
     $upsellProducts->AddChild(new FormEngine\Elements\ProductSelectRelated(array('name' => 'upsell', 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'exclude' => array((int) $this->registry->core->getParam()))));
     $similarProducts = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'similar_products', 'label' => _('TXT_SIMILAR_PRODUCT_LIST'))));
     $similarProducts->AddChild(new FormEngine\Elements\ProductSelectRelated(array('name' => 'similar', 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'exclude' => array((int) $this->registry->core->getParam()))));
     $crosssellProducts = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'crosssell_products', 'label' => _('TXT_CROSSSELL'))));
     $crosssellProducts->AddChild(new FormEngine\Elements\ProductSelectRelated(array('name' => 'crosssell', 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'exclude' => array((int) $this->registry->core->getParam()))));
     $statusProductPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'statusproduct_pane', 'label' => _('TXT_PRODUCT_STATUS'))));
     $statusProductPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Statusy produktów są używane do wyświetlania specjalnych oznaczeń na listach i kartach produktów.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $statusProductPane->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'productstatuses', 'label' => _('TXT_PRODUCT_STATUS'), 'addable' => true, 'onAdd' => 'xajax_AddProductStatus', 'add_item_prompt' => 'Podaj nazwę statusu', 'options' => FormEngine\Option::Make(App::getModel('productstatus')->getProductstatusAll(false)))));
     $idnew = $statusProductPane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'newactive', 'label' => _('TXT_PRODUCT_IS_NEW'))));
     $newData = $statusProductPane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'new_data', 'label' => _('TXT_NEW_DATA'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $idnew, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
     $newData->AddChild(new FormEngine\Elements\Date(array('name' => 'startnew', 'label' => _('TXT_START_DATE'))));
     $newData->AddChild(new FormEngine\Elements\Date(array('name' => 'endnew', 'label' => _('TXT_END_DATE'))));
     $groups = App::getModel('attributegroup/attributegroup')->getGroupsForCategory(0);
     if (!empty($groups)) {
         $variantsPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'variants_pane', 'label' => _('TXT_PRODUCT_VARIANTS'))));
         $variantsPane->AddChild(new FormEngine\Elements\ProductVariantsEditor(array('name' => 'variants', 'label' => _('TXT_PRODUCT_VARIANTS'), 'category' => $category, 'price' => $price, 'set' => $set, 'vat_field' => $vat, 'availablity' => $availablity, 'photos' => App::getModel('product')->productSelectedPhotos((int) $this->registry->core->getParam()), 'allow_generate' => App::getModel('order')->checkProductWithAttributes((int) $this->registry->core->getParam()))));
     }
     $Data = Event::dispatch($this, 'admin.product.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 18
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'client', 'action' => '', 'method' => 'post'));
     $personalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'personal_data', 'label' => _('TXT_PERSONAL_DATA'))));
     $personalData->AddChild(new FormEngine\Elements\Select(array('name' => 'viewid', 'label' => _('TXT_SHOP'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SHOP'))), 'options' => FormEngine\Option::Make(App::getModel('view')->getViewAllSelect()), 'default' => Helper::getViewId())));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     if ($this->getParam() > 0) {
         $personalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Uwaga zmieniając adres Email zmieni sie również login do sklepu</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     } else {
         $personalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Dla klienta zostanie wygenerowane hasło które umożliwi mu dostęp do panelu sklepu. Hasło zostanie wysłane na podany adres e-mail.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     }
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'comment' => _('TXT_EMAIL_FORM'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL')), new FormEngine\Rules\Email(_('ERR_WRONG_EMAIL')), new FormEngine\Rules\Unique(_('ERR_EMAIL_ALREADY_EXISTS'), 'clientdata', 'email', null, array('column' => 'email', 'values' => (int) $this->registry->core->getParam()))))));
     $personalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'newsletter', 'label' => _('TXT_NEWSLETTER'), 'default' => '1')));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PHONE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone2', 'label' => _('TXT_ADDITIONAL_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $personalData->AddChild(new FormEngine\Elements\Select(array('name' => 'clientgroupid', 'label' => _('TXT_GROUPS'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_GROUPS'))), 'addable' => true, 'onAdd' => 'xajax_AddClientGroup', 'add_item_prompt' => 'Podaj nazwę grupy', 'options' => FormEngine\Option::Make(App::getModel('clientgroup/clientgroup')->getClientGroupAllToSelect()))));
     $personalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Klient będzie awansowany/degradowany zgodnie z ustawieniami automatycznego awansu w <a href="' . $this->registry->router->generate('admin', true, array('controller' => 'view')) . '" target="_blank">Konfiguracja &raquo; Sklepy</a></p>')));
     $personalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'autoassign', 'label' => _('TXT_AUTO_ASSIGN'), 'default' => '1')));
     $additionalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'additional_data', 'label' => _('TXT_ADDITIONAL_DATA'))));
     $additionalData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'))));
     $additionalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Blokada konta uniemożliwia zalogowanie klienta w sklepie oraz ponowną rejestrację za pomocą tego samego adresu e-mail.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'disable', 'label' => _('TXT_DISABLE_CLIENT'))));
     $billingData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'billing_data', 'label' => _('TXT_EDIT_ORDER_BILLING_DATA'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placename', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), "/[0-9]{2}\\-[0-9]{3}/")))));
     $billingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => $this->registry->loader->getParam('countryid'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'), 'rules' => array(new FormEngine\Rules\Custom(_('ERR_WRONG_NIP'), array(App::getModel('vat'), 'checkVAT'))))));
     $shippingData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'shipping_data', 'label' => _('TXT_EDIT_ORDER_SHIPPING_DATA'))));
     $copy = $shippingData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<a href="#" id="copy">' . _('TXT_JS_ADDRESS_COPY_FROM') . '</a>')));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placename', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), "/[0-9]{2}\\-[0-9]{3}/")))));
     $shippingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => $this->registry->loader->getParam('countryid'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'), 'rules' => array(new FormEngine\Rules\Custom(_('ERR_WRONG_NIP'), array(App::getModel('vat'), 'checkVAT'))))));
     if ((int) $this->registry->core->getParam() > 0) {
         $clientsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'orders', 'label' => _('TXT_CLIENT_ORDERS'))));
         $history = App::getModel('order')->getclientOrderHistory((int) $this->registry->core->getParam());
         if (count($history) > 0) {
             $html = '<div class="view-order"><ul class="changes-detailed">';
             foreach ($history as $order) {
                 $url = App::getURLAdressWithAdminPane() . 'order/edit/' . $order['idorder'];
                 $html .= "<li>";
                 $html .= "<h4><span>{$order['adddate']}</span></h4>";
                 $html .= "<p>Nr. zamówienia:  <strong><a href=\"{$url}\" target=\"_blank\">#{$order['idorder']}</a></strong></p>";
                 $html .= "<p class=\"author\">" . _('TXT_ALL_ORDERS_PRICE') . ": <strong>{$order['globalprice']}</strong></p>";
                 $html .= "<p class=\"author\">" . _('TXT_ORDER_STATUS') . ": <strong>{$order['status']}</strong></p>";
                 $html .= "</li>";
             }
             $html .= '</div>';
         } else {
             $html = '<p>' . _('TXT_ORDER_HISTORY_EMPTY') . '</p>';
         }
         $clientsData->AddChild(new FormEngine\Elements\StaticText(array('text' => $html)));
     }
     $Data = Event::dispatch($this, 'admin.client.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
Esempio n. 19
0
 public function edit()
 {
     Event::dispatch($this, 'admin.order.checkPaymentStatus', array('id' => (int) $this->registry->core->getParam()));
     $rawOrderData = $this->model->getOrderById($this->registry->core->getParam());
     if (isset($rawOrderData['currencyid']) && !empty($rawOrderData['currencyid'])) {
         $currencyid = $rawOrderData['currencyid'];
     } else {
         $currencyid = Session::getActiveShopCurrencyId();
     }
     try {
         $order = $this->model->getOrderById((int) $this->registry->core->getParam());
         $order['id'] = (int) $this->registry->core->getParam();
         $orderNotes = $this->model->getOrderNotes($order['id']);
         $clientOrderHistory = $this->model->getclientOrderHistory($order['clientid']);
     } catch (Exception $e) {
         throw new CoreException($e->getMessage());
     }
     $addNotes = new FormEngine\Elements\Form(array('name' => 'add_notes', 'class' => 'statusChange', 'action' => '', 'method' => 'post'));
     $addNotes->AddChild(new FormEngine\Elements\Textarea(array('name' => 'contents', 'label' => _('TXT_CONTENT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CONTENT'))))));
     $addNotes->AddChild(new FormEngine\Elements\Submit(array('name' => 'add', 'label' => _('TXT_ADD'), 'icon' => '_images_panel/icons/buttons/add.png')));
     $form = new FormEngine\Elements\Form(array('name' => 'order', 'action' => '', 'class' => 'editOrder', 'method' => 'post'));
     $productsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'products_data', 'label' => _('TXT_EDIT_ORDER_ORDERED_PRODUCTS'))));
     $products = $productsData->AddChild(new FormEngine\Elements\OrderEditor(array('name' => 'products', 'label' => _('TXT_EDIT_ORDER_ORDERED_PRODUCTS'), 'advanced_editor' => true, 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'clientgroupid' => (int) $rawOrderData['clientgroupid'], 'currencyid' => (int) $rawOrderData['currencyid'], 'viewid' => $rawOrderData['viewid'], 'on_change' => 'OnProductListChanged')));
     $addressData = $form->AddChild(new FormEngine\Elements\Columns(array('name' => 'address_data')));
     $billingData = $addressData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'billing_data', 'label' => _('TXT_EDIT_ORDER_BILLING_DATA'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'place', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE'))))));
     $billingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => 0, 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone2', 'label' => _('TXT_ADDITIONAL_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL'))))));
     $shippingData = $addressData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'shipping_data', 'label' => _('TXT_EDIT_ORDER_SHIPPING_DATA'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'place', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE'))))));
     $shippingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => 0, 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PHONE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone2', 'label' => _('TXT_ADDITIONAL_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL'))))));
     $additionalData = $form->AddChild(new FormEngine\Elements\Columns(array('name' => 'additional_data')));
     $paymentData = $additionalData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'payment_data', 'label' => _('TXT_EDIT_ORDER_PAYMENT_METHOD'))));
     $paymentData->AddChild(new FormEngine\Elements\Select(array('name' => 'payment_method', 'label' => _('TXT_EDIT_ORDER_PAYMENT_METHOD'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + $this->model->getPaymentmethodAllToSelect($this->registry->core->getParam())))));
     $weight = 0;
     foreach ($order['products'] as $product) {
         $weight += $product['weight'];
     }
     $paymentData->AddChild(new FormEngine\Elements\Select(array('name' => 'delivery_method', 'label' => _('TXT_EDIT_ORDER_DELIVERY_METHOD'), 'options' => FormEngine\Option::Make($this->model->getDispatchmethodAllToSelect($order['total'], $this->registry->core->getParam(), $weight)))));
     $paymentData->AddChild(new FormEngine\Elements\Select(array('name' => 'rules_cart', 'label' => _('TXT_RULES_CART'), 'options' => FormEngine\Option::Make($this->model->getAllRulesForOrder($this->registry->core->getParam())))));
     $paymentData->AddChild(new FormEngine\Elements\Constant(array('name' => 'currency', 'label' => _('TXT_KIND_OF_CURRENCY'))));
     $summaryData = $additionalData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'summary_data', 'label' => _('TXT_VIEW_ORDER_SUMMARY'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_net_total', 'label' => _('TXT_NETTO_AMOUNT'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_vat_value', 'label' => _('TXT_VIEW_ORDER_TAX'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_delivery', 'label' => _('TXT_DELIVERERPRICE'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_total', 'label' => _('TXT_VIEW_ORDER_TOTAL'))));
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     $orderData = array('address_data' => array('billing_data' => array('firstname' => $rawOrderData['billing_address']['firstname'], 'surname' => $rawOrderData['billing_address']['surname'], 'street' => $rawOrderData['billing_address']['street'], 'streetno' => $rawOrderData['billing_address']['streetno'], 'placeno' => $rawOrderData['billing_address']['placeno'], 'place' => $rawOrderData['billing_address']['city'], 'postcode' => $rawOrderData['billing_address']['postcode'], 'countryid' => $rawOrderData['billing_address']['countryid'], 'companyname' => $rawOrderData['billing_address']['companyname'], 'nip' => $rawOrderData['billing_address']['nip'], 'phone' => $rawOrderData['billing_address']['phone'], 'phone2' => $rawOrderData['billing_address']['phone2'], 'email' => $rawOrderData['billing_address']['email']), 'shipping_data' => array('firstname' => $rawOrderData['delivery_address']['firstname'], 'surname' => $rawOrderData['delivery_address']['surname'], 'street' => $rawOrderData['delivery_address']['street'], 'streetno' => $rawOrderData['delivery_address']['streetno'], 'placeno' => $rawOrderData['delivery_address']['placeno'], 'place' => $rawOrderData['delivery_address']['city'], 'postcode' => $rawOrderData['delivery_address']['postcode'], 'countryid' => $rawOrderData['delivery_address']['countryid'], 'companyname' => $rawOrderData['delivery_address']['companyname'], 'nip' => $rawOrderData['delivery_address']['nip'], 'phone' => $rawOrderData['delivery_address']['phone'], 'phone2' => $rawOrderData['billing_address']['phone2'], 'email' => $rawOrderData['delivery_address']['email'])), 'additional_data' => array('payment_data' => array('delivery_method' => $rawOrderData['delivery_method']['dispatchmethodid'], 'payment_method' => $rawOrderData['payment_method']['paymentmethodid'], 'rules_cart' => $rawOrderData['rulescartid'], 'currency' => $rawOrderData['currencysymbol']), 'summary_data' => array('total_net_total' => 132)), 'products_data' => array('products' => $this->model->getProductsDataGrid((int) $this->registry->core->getParam())));
     $form->Populate($orderData);
     $statusChange = new FormEngine\Elements\Form(array('name' => 'add_status_change', 'class' => 'statusChange', 'action' => '', 'method' => 'post'));
     $idstatus = $statusChange->AddChild(new FormEngine\Elements\Select(array('name' => 'status', 'label' => _('TXT_VIEW_ORDER_CHANGE_STATUS'), 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $statusChange->AddChild(new FormEngine\Elements\Textarea(array('name' => 'comment', 'label' => _('TXT_VIEW_ORDER_CHANGE_COMMENT'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SUGGEST, $idstatus, array(App::getModel('orderstatus'), 'getDefaultComment'))))));
     $statusChange->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'inform', 'label' => _('TXT_VIEW_ORDER_CHANGE_INFORM_CLIENT'))));
     $statusChange->AddChild(new FormEngine\Elements\Submit(array('name' => 'update', 'label' => _('TXT_VIEW_ORDER_CHANGE_UPDATE'), 'icon' => '_images_panel/icons/buttons/flag-green.png')));
     $statusChange->Populate(array('status' => $order['current_status_id']));
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     if ($addNotes->Validate(FormEngine\FE::SubmittedData())) {
         try {
             $notes = $addNotes->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
             $this->model->addOrderNotes($addNotes->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $order['id']);
             Session::setVolatileMessage("Dodano notatkę do zamówienia {$this->id}");
             App::redirect(__ADMINPANE__ . '/order/edit/' . (int) $this->registry->core->getParam());
         } catch (Exception $e) {
             $this->registry->template->assign('error', $e->getMessage());
         }
     }
     if ($statusChange->Validate(FormEngine\FE::SubmittedData())) {
         $this->model->addOrderHistory($statusChange->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam());
         try {
             $email = $statusChange->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
             if ($email['inform'] == 1) {
                 $this->model->notifyUser($order, $email['status']);
             }
             Session::setVolatileMessage("Zaktualizowano status zamówienia {$this->id}");
             $this->model->updateOrderStatus($_POST, $this->registry->core->getParam());
             App::redirect(__ADMINPANE__ . '/order/edit/' . (int) $this->registry->core->getParam());
         } catch (Exception $e) {
             $this->registry->template->assign('error', $e->getMessage());
         }
     }
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         try {
             $this->model->updateOrderById($_POST, $this->registry->core->getParam());
             App::redirect(__ADMINPANE__ . '/order/');
         } catch (Exception $e) {
             $this->registry->template->assign('error', $e->getMessage());
         }
     }
     $this->registry->template->assign('viewid', Helper::getViewId());
     $this->registry->xajaxInterface->registerFunction(array('CalculateDeliveryCost', $this->model, 'calculateDeliveryCostEdit'));
     $this->registry->xajaxInterface->registerFunction(array('GetDispatchMethodForPrice', $this->model, 'getDispatchMethodForPriceForAjaxEdit'));
     $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
     $this->registry->xajax->processRequest();
     $this->registry->template->assign('statusChange', $statusChange->Render());
     $this->registry->template->assign('addNotes', $addNotes->Render());
     $this->registry->template->assign('orderNotes', $orderNotes);
     $this->registry->template->assign('clientOrderHistory', $clientOrderHistory);
     $this->registry->template->assign('order', $order);
     $this->registry->template->assign('currencyid', Session::getActiveCurrencyId());
     $this->registry->template->assign('currencysymbol', Session::getActiveCurrencySymbol());
     $this->registry->template->assign('form', $form->Render());
     $this->registry->template->display($this->loadTemplate('edit.tpl'));
 }
Esempio n. 20
0
 public function edit()
 {
     $rawUserData = App::getModel('users')->getUserById($this->registry->core->getParam());
     if (empty($rawUserData)) {
         App::redirect(__ADMINPANE__ . '/users');
     }
     $layers = App::getModel('users')->getLayersAll();
     $form = new FormEngine\Elements\Form(array('name' => 'user', 'action' => '', 'method' => 'post'));
     $personalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'personal_data', 'label' => _('TXT_PERSONAL_DATA'))));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL')), new FormEngine\Rules\Email(_('ERR_WRONG_EMAIL')), new FormEngine\Rules\Unique(_('ERR_EMAIL_ALREADY_EXISTS'), 'userdata', 'email', null, array('column' => 'userid', 'values' => $this->registry->core->getParam()))))));
     $changePassword = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'change_password', 'label' => _('TXT_CHANGE_USERS_PASSWORD'))));
     $userid = Session::getActiveUserid();
     $edituserid = $this->registry->core->getParam();
     if ($userid == $edituserid) {
         $newPasswordChange = $changePassword->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'changepassword', 'label' => _('TXT_CHANGE_PASS'))));
         $oldPassword = $changePassword->AddChild(new FormEngine\Elements\Password(array('name' => 'oldpasswd', 'label' => _('TXT_PASSWORD_OLD'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $newPasswordChange, new FormEngine\Conditions\Equals('1'))))));
         $newPassword = $changePassword->AddChild(new FormEngine\Elements\Password(array('name' => 'newppasswd', 'label' => _('TXT_PASSWORD_NEW'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PASSWORD')), new FormEngine\Rules\Format(_('ERR_PASSWORD_NEW_INVALID'), '/^.{6,}$/')), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $newPasswordChange, new FormEngine\Conditions\Equals('1'))))));
         $changePassword->AddChild(new FormEngine\Elements\Password(array('name' => 'newpasswdrep', 'label' => _('TXT_PASSWORD_REPEAT'), 'rules' => array(new FormEngine\Rules\Compare(_('ERR_PASSWORDS_NOT_COMPATIBILE'), $newPassword)), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $newPasswordChange, new FormEngine\Conditions\Equals('1'))))));
     } else {
         $changePassword->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . _('TXT_PASSWORD_CHANGE_INSTRUCTION') . '</p>')));
         $newPassword = $changePassword->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'newpassword', 'label' => _('TXT_PASSWORD_NEW'))));
     }
     $isglobal = App::getModel('users')->checkActiveUserIsGlobal();
     if ($isglobal == 1) {
         $rightsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'rights_data', 'label' => _('TXT_RIGHTS'))));
         $rightsData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . _('TXT_SET_USER_LAYER_RIGHTS') . '</p>')));
         $global = $rightsData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'global', 'label' => _('TXT_GLOBAL_USER'))));
         $rightsData->AddChild(new FormEngine\Elements\Select(array('name' => 'group', 'label' => _('TXT_GROUPS'), 'options' => FormEngine\Option::Make(App::getModel('groups/groups')->getGroupsAllToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_GROUP'))), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $global, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
         $layers = App::getModel('users')->getLayersAll();
         foreach ($layers as $key => $store) {
             $storeRightsData[$store['id']] = $rightsData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'store_' . $store['id'], 'label' => _('TXT_RIGHTS') . ' dla ' . $store['name'], 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $global, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
             foreach ($store['views'] as $v => $view) {
                 $storeRightsData[$store['id']]->AddChild(new FormEngine\Elements\Select(array('name' => 'view_' . $view['id'], 'label' => $view['name'], 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('groups/groups')->getGroupsAllToSelect()))));
             }
         }
     }
     $additionalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'additional_data', 'label' => _('TXT_ADDITIONAL_DATA'))));
     $additionalData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 3000', 'max_length' => 3000)));
     $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'active', 'label' => _('TXT_ENABLE_USER'))));
     $photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'photos_pane', 'label' => _('TXT_PHOTO'))));
     $photosPane->AddChild(new FormEngine\Elements\Image(array('name' => 'photo', 'label' => _('TXT_PHOTO'), 'repeat_min' => 0, 'repeat_max' => 1, 'upload_url' => App::getURLAdressWithAdminPane() . 'files/add')));
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     $userData = array('personal_data' => array('firstname' => $rawUserData['firstname'], 'surname' => $rawUserData['surname'], 'email' => $rawUserData['email']), 'additional_data' => array('description' => $rawUserData['description'], 'active' => $rawUserData['active']), 'photos_pane' => array('photo' => $rawUserData['photo']), 'rights_data' => array('global' => $rawUserData['globaluser'], 'group' => $rawUserData['idgroup']));
     foreach ($rawUserData['layer'] as $key => $layer) {
         $userData['rights_data']['store_' . $layer['store']][] = array('view_' . $layer['view'] => $layer['group']);
     }
     $form->Populate($userData);
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         try {
             $edituser = $form->getSubmitValues();
             App::getModel('users')->updateUser($edituser, $this->registry->core->getParam());
             if ($userid == $edituserid) {
                 if ($edituser['change_password']['changepassword'] == 1) {
                     $editpassword = $edituser['change_password']['newppasswd'];
                     $changPassword = App::getModel('users')->updateUserPassword($edituser['change_password']['newppasswd']);
                     Session::setActiveUserFirstname($edituser['personal_data']['firstname']);
                     Session::setActiveUserSurname($edituser['personal_data']['surname']);
                     Session::setActiveUserEmail($edituser['personal_data']['email']);
                 }
             } else {
                 if ($edituser['change_password']['newpassword'] == 1) {
                     $editpassword = Core::passwordGenerate();
                     $changPassword = App::getModel('users')->updateUserPassword($editpassword);
                     if ($changPassword == true) {
                         $password = Core::passwordGenerate();
                         $this->registry->template->assign('password', $editpassword);
                         App::getModel('mailer')->sendEmail(array('template' => 'newPasswordForUser', 'email' => array($edituser['personal_data']['email']), 'bcc' => false, 'subject' => _('TXT_EDIT_PASSWORD_USER'), 'viewid' => Helper::getViewId()));
                     }
                 }
             }
         } catch (Exception $e) {
             Session::setVolatileUsereditError(1, false);
         }
         App::redirect(__ADMINPANE__ . '/users');
     }
     $error = Session::getVolatileUsereditError();
     if ($error[0] == 1) {
         $this->registry->template->assign('error', $e->getMessage());
     }
     $this->registry->template->assign('form', $form->Render());
     $this->registry->xajax->processRequest();
     $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
     $this->registry->template->display($this->loadTemplate('edit.tpl'));
 }
Esempio n. 21
0
    public function edit()
    {
        $rulescartArray = array();
        $rulescartRaw = App::getModel('rulescart')->getRulesCartAll();
        foreach ($rulescartRaw as $rulescartruleRaw) {
            $rulescartArray[$rulescartruleRaw['id']]['name'] = $rulescartruleRaw['name'];
            $rulescartArray[$rulescartruleRaw['id']]['parent'] = $rulescartruleRaw['parent'];
            $rulescartArray[$rulescartruleRaw['id']]['weight'] = $rulescartruleRaw['distinction'];
        }
        $tree = new FormEngine\Elements\Form(array('name' => 'rulescart_tree', 'class' => 'rulescart-select', 'action' => '', 'method' => 'post'));
        $tree->AddChild(new FormEngine\Elements\SortableList(array('name' => 'rulescart', 'label' => _('TXT_RULES_CART'), 'add_item_prompt' => _('TXT_ENTER_NEW_CART_RULE_NAME'), 'delete_item_prompt' => _('TXT_DELETE_CART_RULE'), 'sortable' => false, 'selectable' => false, 'clickable' => true, 'deletable' => true, 'addable' => true, 'total' => count($rulescartArray), 'items' => $rulescartArray, 'onClick' => 'openRulesCartEditor', 'onSaveOrder' => 'xajax_ChangeRulesCartOrder', 'onAdd' => 'xajax_AddRulesCart', 'onAfterAdd' => 'openRulesCartEditor', 'onDelete' => 'xajax_DeleteRulesCart', 'onAfterDelete' => 'openRulesCartEditor', 'active' => $this->registry->core->getParam())));
        $this->registry->template->assign('tree', $tree->Render());
        // //////////////////////////////////// EDIT RULE CART
        // ///////////////////////////////////////////////
        $form = new FormEngine\Elements\Form(array('name' => 'rulescart', 'action' => '', 'method' => 'post'));
        $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
        $languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
        $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'rulescarttranslation', 'name', null, array('column' => 'rulescartid', 'values' => (int) $this->registry->core->getParam()))))));
        $languageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'))));
        $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Jeśli chcesz, by reguła obowiązywała zawsze, zostaw puste pola z datą</strong></p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
        $datefrom = $requiredData->AddChild(new FormEngine\Elements\Date(array('name' => 'datefrom', 'label' => _('TXT_START_DATE'))));
        $requiredData->AddChild(new FormEngine\Elements\Date(array('name' => 'dateto', 'label' => _('TXT_END_DATE'))));
        // //////////////////////////////// CLIENT GROUPS
        // //////////////////////////////////////////
        $additionalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'additional_data', 'label' => _('TXT_PROMOTIONRULE_DISCOUNT_DATA'))));
        $additionalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Możesz podać wysokość zniżki kwotowo (modyfikator "-") lub procentową wartość zamówienia. Wprowadzając wartość 10:</p>
				<ul>
					<li><strong>dla modyfikatora "-"</strong> obniżysz kwotę zamówienia o 10 w danej walucie</li>
					<li><strong>dla modyfikatora "%"</strong> kwota zamówienia wyniesie 10% pierwotnej wartości</li>
				</ul>
				<p><strong>Przykład:</strong> Chcąc udzielić 10% rabatu na zamówienie, wprowadź wartość 90 i wybierz modyfikator "%".</p>
			')));
        $discountForAll = $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'discountforall', 'label' => _('TXT_DISCOUNT_FOR_ALL_GROUP'))));
        $suffixtypeid = $additionalData->AddChild(new FormEngine\Elements\Select(array('name' => 'suffixtypeid', 'label' => _('TXT_SUFFIXTYPE'), 'options' => FormEngine\Option::Make(App::getModel('suffix/suffix')->getRulesSuffixTypesForSelect()), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
        $additionalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'discount', 'label' => _('TXT_VALUE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
        $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'freeshipping', 'label' => _('TXT_FREE_DELIVERY'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
        $clientGroups = App::getModel('clientgroup/clientgroup')->getClientGroupAll();
        foreach ($clientGroups as $clientGroup) {
            $additionalData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'field_' . $clientGroup['id'], 'label' => 'Rabat dla ' . $clientGroup['name'], 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
            $groups[$clientGroup['id']] = $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'groupid_' . $clientGroup['id'], 'label' => $clientGroup['name'], 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
            $suffix = $additionalData->AddChild(new FormEngine\Elements\Select(array('name' => 'suffixtypeid_' . $clientGroup['id'], 'label' => _('TXT_SUFFIXTYPE'), 'options' => FormEngine\Option::Make(App::getModel('suffix/suffix')->getRulesSuffixTypesForSelect()), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $groups[$clientGroup['id']], new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals(1))), new FormEngine\Dependency(FormEngine\Dependency::SHOW, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
            $additionalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'discount_' . $clientGroup['id'], 'label' => _('TXT_VALUE'), 'default' => '0.00', 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/'), new FormEngine\Rules\Custom(_('ERR_VALUE_INVALID'), array($this, 'checkDiscountValue'), array('suffixType' => $suffix))), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $groups[$clientGroup['id']], new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals(1))), new FormEngine\Dependency(FormEngine\Dependency::SHOW, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))), 'filters' => array(new FormEngine\Filters\CommaToDotChanger()))));
            $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'freeshipping_' . $clientGroup['id'], 'label' => _('TXT_FREE_DELIVERY'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $discountForAll, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
        }
        $deliverers = App::getModel('dispatchmethod')->getDispatchmethodToSelect();
        $deliverersData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'deliverers_data', 'label' => _('TXT_DELIVER'))));
        if (count($deliverers)) {
            $deliverersData->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'deliverers', 'label' => _('TXT_DISPATCHMETHOD'), 'options' => FormEngine\Option::Make($deliverers))));
        } else {
            $deliverersData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p><strong>' . _('TXT_EMPTY_DISPATCHMETHODS') . '</strong><br/>
						<a href="/admin/dispatchmethod/add" target="_blank">' . _('TXT_ADD_DISPATCHMETHOD') . '</a></p>')));
        }
        // ///////////////////////////////// PAYMENT METHODS
        // /////////////////////////////////////////////
        $payments = App::getModel('paymentmethod')->getPaymentmethodToSelect();
        $paymentsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'payments_data', 'label' => _('TXT_PAYMENTMETHODS'))));
        if (count($payments)) {
            $paymentsData->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'payments', 'label' => _('TXT_PAYMENTMETHODS'), 'options' => FormEngine\Option::Make($payments))));
        } else {
            $paymentsData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p><strong>' . _('TXT_EMPTY_PAYMENTMETHODS') . '</strong><br/>
						<a href="/admin/paymentmethod/add" target="_blank">' . _('TXT_ADD_PAYMENTMETHOD') . '</a></p>')));
        }
        $pricePane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'price_pane', 'label' => _('TXT_SUM_PRICE'))));
        $pricePane->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p><strong>' . _('TXT_FINAL_CART_PRICE') . '</strong></p>')));
        $pricePane->AddChild(new FormEngine\Elements\TextField(array('name' => 'cart_price_from', 'label' => _('TXT_PRICE_FROM'), 'suffix' => 'brutto', 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')))));
        $pricePane->AddChild(new FormEngine\Elements\TextField(array('name' => 'cart_price_to', 'label' => _('TXT_PRICE_TO'), 'suffix' => 'brutto', 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')))));
        $pricePane->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p><strong>' . _('TXT_TOTAL_COST') . '</strong></p>')));
        $pricePane->AddChild(new FormEngine\Elements\TextField(array('name' => 'dispatch_price_from', 'label' => _('TXT_PRICE_FROM'), 'suffix' => 'brutto', 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')))));
        $pricePane->AddChild(new FormEngine\Elements\TextField(array('name' => 'dispatch_price_to', 'label' => _('TXT_PRICE_TO'), 'suffix' => 'brutto', 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')))));
        // /////////////////////////////////// VIEW DATA
        // /////////////////////////////////////////////
        $layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
        $layers = $layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'))));
        $form->AddFilter(new FormEngine\Filters\NoCode());
        $form->AddFilter(new FormEngine\Filters\Trim());
        $form->AddFilter(new FormEngine\Filters\Secure());
        // //////////////////////////////////// POPULATE
        // //////////////////////////////////////////////////
        // ////////////////////////////////// REQUIRED_DATA
        // ////////////////////////////////////////////////
        $rawRulesCartData = App::getModel('rulescart')->getRulesCartView($this->registry->core->getParam());
        $rulesCartRuleData['required_data'] = array('language_data' => $rawRulesCartData['language'], 'suffixtypeid' => $rawRulesCartData['suffixtypeid'], 'discount' => round($rawRulesCartData['discount'], 0), 'datefrom' => $rawRulesCartData['datefrom'], 'dateto' => $rawRulesCartData['dateto'], 'freeshipping' => $rawRulesCartData['freeshipping']);
        // ////////////////////////////////// ADDITIONAL_DATA
        // ////////////////////////////////////////////////
        $rawRulesCartClientGroupData = App::getModel('rulescart')->getRulesCartClientGroupView($this->registry->core->getParam());
        if (isset($rawRulesCartData['discountforall']) && $rawRulesCartData['discountforall'] == 1) {
            $rulesCartRuleData['additional_data']['discountforall'] = $rawRulesCartData['discountforall'];
            $rulesCartRuleData['additional_data']['suffixtypeid'] = $rawRulesCartData['suffixtypeid'];
            $rulesCartRuleData['additional_data']['discount'] = round($rawRulesCartData['discount'], 0);
            $rulesCartRuleData['additional_data']['freeshipping'] = $rawRulesCartData['freeshipping'];
        } else {
            $rawRulesCartClientGroupData = App::getModel('rulescart')->getRulesCartClientGroupView($this->registry->core->getParam());
            if (count($rawRulesCartClientGroupData) > 0) {
                foreach ($rawRulesCartClientGroupData as $clientGroupKey => $clientGroupValue) {
                    $rulesCartRuleData['additional_data']['groupid_' . $clientGroupValue['clientgroupid']] = 1;
                    $rulesCartRuleData['additional_data']['discount_' . $clientGroupValue['clientgroupid']] = $clientGroupValue['discount'];
                    $rulesCartRuleData['additional_data']['suffixtypeid_' . $clientGroupValue['clientgroupid']] = $clientGroupValue['suffixtypeid'];
                    $rulesCartRuleData['additional_data']['freeshipping_' . $clientGroupValue['clientgroupid']] = $clientGroupValue['freeshipping'];
                }
            }
        }
        // ////////////////////////////////// DELIVERER_DATA
        // ////////////////////////////////////////////////
        $rawRulesCartDeliverersData = App::getModel('rulescart')->getRulesCartDeliverersView($this->registry->core->getParam());
        if (count($rawRulesCartDeliverersData) > 0) {
            foreach ($rawRulesCartDeliverersData as $delivererId) {
                $rulesCartRuleData['deliverers_data']['deliverers'][] = $delivererId;
            }
        }
        // ///////////////////////////////// PAYMENT METHODS
        // /////////////////////////////////////////////
        $rawRulesCartPaymentData = App::getModel('rulescart')->getRulesCartPaymentsView($this->registry->core->getParam());
        if (count($rawRulesCartPaymentData) > 0) {
            foreach ($rawRulesCartPaymentData as $paymentId) {
                $rulesCartRuleData['payments_data']['payments'][] = $paymentId;
            }
        }
        // /////////////////////////////////// CART PRICE
        // ////////////////////////////////////////////////
        $rawRulesCartDynamicData = App::getModel('rulescart')->getRulesCartOtherDinamicDataConditionsView($this->registry->core->getParam());
        if (count($rawRulesCartDynamicData) > 0) {
            foreach ($rawRulesCartDynamicData as $dynamicData) {
                if ($dynamicData['ruleid'] == 11 && $dynamicData['field'] == 'globalpricefrom') {
                    $rulesCartRuleData['price_pane']['cart_price_from'] = $dynamicData['pricefrom'];
                }
                if ($dynamicData['ruleid'] == 12 && $dynamicData['field'] == 'globalpriceto') {
                    $rulesCartRuleData['price_pane']['cart_price_to'] = $dynamicData['priceto'];
                }
                if ($dynamicData['ruleid'] == 13 && $dynamicData['field'] == 'globalpricewithdispatchmethodfrom') {
                    $rulesCartRuleData['price_pane']['dispatch_price_from'] = $dynamicData['pricefrom'];
                }
                if ($dynamicData['ruleid'] == 14 && $dynamicData['field'] == 'globalpricewithdispatchmethodto') {
                    $rulesCartRuleData['price_pane']['dispatch_price_to'] = $dynamicData['priceto'];
                }
            }
        }
        // /////////////////////////////////// VIEW DATA
        // /////////////////////////////////////////////
        $rawRulesCartViewData = App::getModel('rulescart')->getRulesCartViews($this->registry->core->getParam());
        if (count($rawRulesCartViewData) > 0) {
            foreach ($rawRulesCartViewData as $viewKey => $viewValue) {
                $rulesCartRuleData['view_data']['view'][] = $viewValue;
            }
        }
        $form->Populate($rulesCartRuleData);
        // ///////////////////////////////////// SUBMIT
        // /////////////////////////////////////////////////////
        if ($form->Validate(FormEngine\FE::SubmittedData())) {
            try {
                $formData = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
                App::getModel('rulescart')->editRulesCart($formData, $this->registry->core->getParam());
            } catch (Exception $e) {
                $this->registry->template->assign('error', $e->getMessage());
            }
            App::redirect(__ADMINPANE__ . '/rulescart/edit/' . $this->id);
        }
        // //////////////////////////////////////////////////////////////////////////////////////////////////////////
        $this->registry->template->assign('form', $form->Render());
        $this->registry->xajaxInterface->registerFunction(array('DeleteRulesCart', App::getModel('rulescart'), 'deleteRulesCart'));
        $this->registry->xajaxInterface->registerFunction(array('AddRulesCart', App::getModel('rulescart'), 'addEmptyRulesCart'));
        $this->registry->xajaxInterface->registerFunction(array('ChangeRulesCartOrder', App::getModel('rulescart'), 'changeRulesCartOrder'));
        $this->registry->xajax->processRequest();
        $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
        $this->registry->template->display($this->loadTemplate('edit.tpl'));
    }
Esempio n. 22
0
 public function edit()
 {
     $subpages = $this->model->getSubpageTree();
     $pagescheme_id = $this->id;
     // selected by user
     if (Helper::getViewId() > 0 && $pagescheme_id != $this->registry->core->getParam(0)) {
         // if it is not current view pagescheme change it
         App::redirect(__ADMINPANE__ . '/subpagelayout/edit/' . $pagescheme_id . ',' . $this->model->getFirstPageScheme($pagescheme_id));
     }
     $subpage_id = $this->registry->core->getParam(1);
     // id from URL
     if ((int) $subpage_id == 0 || empty($subpages[$pagescheme_id . ',' . $subpage_id])) {
         // change pagescheme if subpage is not inside active
         $pagescheme_id = App::getModel('view')->getViewPagescheme(Helper::getViewId());
         App::redirect(__ADMINPANE__ . '/subpagelayout/edit/' . $pagescheme_id . ',' . $this->model->getFirstPageScheme($pagescheme_id));
     }
     $subpageLayout = App::getModel('subpagelayout')->getSubPageLayoutAll($subpage_id);
     if (!isset($subpageLayout[0]['name'])) {
         App::redirect(__ADMINPANE__ . '/subpagelayout');
     }
     $tree = new FormEngine\Elements\Form(array('name' => 'scheme_tree', 'action' => '', 'method' => 'post'));
     $tree->AddChild(new FormEngine\Elements\Tree(array('name' => 'pagescheme', 'sortable' => false, 'retractable' => false, 'selectable' => false, 'clickable' => true, 'deletable' => false, 'addable' => false, 'items' => $subpages, 'onClick' => 'openSubpageEditor', 'active' => $pagescheme_id . ',' . $subpage_id)));
     $form = new FormEngine\Elements\Form(array('name' => 'subpagelayout', 'action' => '', 'method' => 'post'));
     $columnsEdit = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'columns', 'label' => _('TXT_SUBPAGE_COLUMNS'))));
     $subpages = App::getModel('subpagelayout')->getSubPageLayoutAllToSelect($subpage_id);
     $subpagelayoutid = $columnsEdit->AddChild(new FormEngine\Elements\Constant(array('name' => 'subpagelayout_subpage', 'label' => _('Podstrona'))));
     $subpagelayoutid = $columnsEdit->AddChild(new FormEngine\Elements\Hidden(array('name' => 'subpagelayoutid')));
     $columnsDataEdit = $columnsEdit->AddChild(new FormEngine\Elements\FieldsetRepeatable(array('name' => 'columns_data', 'label' => _('TXT_COLUMNS_DATA'), 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE)));
     $columnsDataEdit->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Aby kolumna rozciągnęła się na całą, pozostałą część strony, jako jej szerokość podaj wartość <strong>0</strong>.</p><p>Jeśli kilka kolumn będzie miało szerokość 0, wówczas zostaną im automatycznie przyznane równe części pozostałego miejsca.</p>', 'retractable' => false)));
     $columnsDataEdit->AddChild(new FormEngine\Elements\TextField(array('name' => 'columns_width', 'label' => _('TXT_WIDTH'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_WIDTH'))))));
     $boxDataEdit = $columnsDataEdit->AddChild(new FormEngine\Elements\LayoutBoxesList(array('name' => 'layout_boxes', 'label' => 'Wybierz boksy', 'boxes' => FormEngine\Option::Make(App::getModel('subpagelayout')->getBoxesAllToSelect($subpageLayout[0]['name'], $pagescheme_id)))));
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     $subpagelayoutcolumn = App::getModel('subpagelayout')->getSubPageLayoutColumn($subpage_id);
     $populate = array();
     if (is_array($subpagelayoutcolumn) && count($subpagelayoutcolumn) > 0) {
         if (isset($subpagelayoutcolumn['subpagelayoutid']) && $subpagelayoutcolumn['subpagelayoutid'] > 0) {
             $populate['columns']['subpagelayout_subpage'] = $subpages[$subpagelayoutcolumn['subpagelayoutid']];
             $populate['columns']['subpagelayoutid'] = $subpagelayoutcolumn['subpagelayoutid'];
         }
         if (isset($subpagelayoutcolumn['columns']) && count($subpagelayoutcolumn['columns']) > 0) {
             foreach ($subpagelayoutcolumn['columns'] as $column) {
                 $populate['columns']['columns_data'][$column['idsubpagelayoutcolumn']] = array('columns_width' => $column['width']);
                 if (count($column['subpagelayoutcolumnbox']) > 0) {
                     foreach ($column['subpagelayoutcolumnbox'] as $boxes) {
                         $populate['columns']['columns_data'][$column['idsubpagelayoutcolumn']]['layout_boxes'][$boxes['order']] = array('box' => $boxes['layoutboxid'], 'span' => $boxes['colspan'], 'collapsed' => (int) $boxes['collapsed']);
                     }
                 }
             }
         }
         $form->Populate($populate);
     }
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         try {
             App::getModel('subpagelayout')->editSubpageLayout($form->getSubmitValues(), $subpage_id);
             App::getModel('subpagelayout')->flushCache($subpages[$subpagelayoutcolumn['subpagelayoutid']]);
             App::redirect(__ADMINPANE__ . '/subpagelayout/edit/' . $pagescheme_id . ',' . $subpage_id);
         } catch (Exception $e) {
             Session::setVolatileSubpageLayoutAdd(1, false);
         }
     }
     $error = Session::getVolatileSubpageLayoutAdd();
     if ($error[0] == 1) {
         $this->registry->template->assign('error', $e->getMessage());
     }
     $this->registry->xajaxInterface->registerFunction(array('DeleteSubpageLayout', $this, 'DeleteSubpageLayoutForAjax'));
     $this->renderLayout(array('subpageLayout' => $subpageLayout[0], 'form' => $form->Render(), 'tree' => $tree->Render()));
 }
Esempio n. 23
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'view', 'action' => '', 'method' => 'post'));
     $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME'))))));
     $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz domyślny szablon sklepu. Szablonami możesz zarządzać na stronie <a href="' . App::getURLAdressWithAdminPane() . 'templateeditor' . '" target="_blank">Szablony stylów &raquo; Biblioteka szablonów</a>.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'pageschemeid', 'label' => _('TXT_PAGESCHEME'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('pagescheme')->getPageschemeAllToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PAGESCHEME'))))));
     $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz firmę/podmiot obsługujący sklep. Firmami możesz zarządzać na stronie <a href="' . App::getURLAdressWithAdminPane() . 'store' . '" target="_blank">Konfiguracja &raquo; Firmy</a>.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'store', 'label' => _('TXT_STORE'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('store')->getStoreToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STORE'))))));
     $requiredData->AddChild(new FormEngine\Elements\Hidden(array('name' => 'currencyid')));
     $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz domyślny kontakt dla sklepu. Kontaktami możesz zarządzać na stronie <a href="' . App::getURLAdressWithAdminPane() . 'contact' . '" target="_blank">Konfiguracja &raquo; Kontakt</a>.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'contactid', 'label' => _('TXT_DEFAULT_CONTACT'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('contact')->getContactToSelect()))));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'showtax', 'label' => _('TXT_SHOW_TAX_VALUE'), 'options' => FormEngine\Option::Make(App::getModel('suffix/suffix')->getPrice()), 'default' => 1)));
     $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'defaultvatid', 'label' => _('TXT_DEFAULT_VAT'), 'options' => FormEngine\Option::Make(App::getModel('vat')->getVATAll()), 'default' => 2)));
     $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'namespace', 'label' => _('TXT_NAMESPACE'))));
     $offline = $requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'offline', 'label' => _('TXT_SHOP_OFFLINE'), 'comment' => _('TXT_OFFLINE_INSTRUCTION'))));
     $requiredData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'offlinetext', 'label' => _('TXT_OFFLINE_MESSAGE'), 'comment' => _('TXT_MAX_LENGTH') . ' 5000', 'rows' => 50, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $offline, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('1')))))));
     $metaData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'meta_data', 'label' => _('TXT_META_INFORMATION'))));
     $languageData = $metaData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
     $languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'keyword_title', 'label' => _('TXT_KEYWORD_TITLE'))));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword_description', 'label' => _('TXT_KEYWORD_DESCRIPTION'))));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword', 'label' => _('TXT_KEYWORDS'), 'comment' => _('TXT_KEYWORDS_HELP'))));
     $languageData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Możesz dodać dowolne znaczniki do sekcji HEAD szablonu sklepu. Wykorzystaj to pole np. do przeprowadzenia weryfikacji domeny dla Google Apps.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'additionalmeta', 'label' => _('TXT_ADDITIONAL_META'), 'rows' => 10)));
     $url = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'url_pane', 'label' => _('TXT_WWW'))));
     $url->AddChild(new FormEngine\Elements\TextField(array('name' => 'url', 'label' => _('TXT_URL'))));
     $categoryPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'category_pane', 'label' => _('TXT_CATEGORY'))));
     $categories = App::getModel('view')->getChildCategories();
     if (count($categories) > 0) {
         $categoryPane->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . _('TXT_VIEW_CATEGORY_INSTRUCTION') . '</p>')));
     } else {
         $categoryPane->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . _('TXT_VIEW_CATEGORY_EMPTY_INSTRUCTION') . '</p>')));
     }
     $category = $categoryPane->AddChild(new FormEngine\Elements\Tree(array('name' => 'category', 'label' => _('TXT_CATEGORY'), 'sortable' => false, 'selectable' => true, 'clickable' => false, 'items' => $categories, 'load_children' => array(App::getModel('view'), 'getChildCategories'))));
     $dispatchmethodPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'dispatchmethod_pane', 'label' => _('TXT_DISPATCHMETHOD_PANE'))));
     $dispatchmethodPane->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'dispatchmethod', 'label' => _('TXT_DISPATCHMETHOD'), 'options' => FormEngine\Option::Make(App::getModel('dispatchmethod')->getDispatchmethodToSelect()))));
     $paymentmethodPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'paymentmethod_pane', 'label' => _('TXT_PAYMENTMETHOD_PANE'))));
     $paymentmethodPane->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'paymentmethod', 'label' => _('TXT_PAYMENTMETHOD'), 'options' => FormEngine\Option::Make(App::getModel('paymentmethod')->getPaymentmethodToSelect()))));
     $assignToGroupData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'assigntogroup_data', 'label' => _('TXT_AUTOMATICLY_ASSIGN_TO_GROUP'))));
     $assignToGroupData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Automatyczny awans umożliwia przechodzenie klientom Twojego sklepu do wyższych grup rabatowych w zależności od tego ile zakupów zrealizują w określonym czasie.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $assignToGroupData->AddChild(new FormEngine\Elements\Select(array('name' => 'taxes', 'label' => _('TXT_TAKE_THE_VALUE'), 'options' => array(new FormEngine\Option('0', _('TXT_NETTO')), new FormEngine\Option('1', _('TXT_PRICE_GROSS'))), 'suffix' => _('TXT_CLIENT_ORDERS'))));
     $assignToGroupData->AddChild(new FormEngine\Elements\Select(array('name' => 'periodid', 'label' => _('TXT_PERIOD'), 'options' => FormEngine\Option::Make(App::getModel('period/period')->getPeriod()))));
     $assignToGroupData->AddChild(new FormEngine\Elements\RangeEditor(array('name' => 'table', 'label' => _('TXT_DISPATCHMETHOD_TABLE_PRICE'), 'suffix' => _('TXT_CURRENCY'), 'range_suffix' => _('TXT_CURRENCY'), 'options' => FormEngine\Option::Make(App::getModel('clientgroup')->getClientGroupToRangeEditor()))));
     $registrationData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'registration_data', 'label' => _('TXT_REGISTRATION_SETTINGS'))));
     $registrationData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'forcelogin', 'label' => _('TXT_FORCE_CLIENT_LOGIN'), 'comment' => _('TXT_FORCE_CLIENT_LOGIN_HELP'))));
     $registrationData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'enableregistration', 'label' => _('TXT_ENABLE_REGISTRATION'), 'comment' => _('TXT_ENABLE_REGISTRATION_HELP'))));
     $registrationData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'confirmregistration', 'label' => _('TXT_REGISTRATION_CONFIRM'), 'comment' => _('TXT_REGISTRATION_CONFIRM_HELP'))));
     $cartData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'cart_data', 'label' => _('TXT_CART_SETTINGS'))));
     $cartData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'cartredirect', 'label' => _('TXT_CART_REDIRECT'))));
     $cartData->AddChild(new FormEngine\Elements\TextField(array('name' => 'minimumordervalue', 'label' => _('TXT_MINIMUM_ORDER_VALUE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')), 'default' => 0)));
     $photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'logo', 'label' => _('TXT_LOGO'))));
     $photosPane->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'photo', 'label' => _('TXT_LOGO'), 'file_source' => 'design/_images_frontend/core/logos/', 'file_types' => array('png', 'jpg', 'gif'))));
     $photosPane->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'favicon', 'label' => _('TXT_FAVICON'), 'file_source' => 'design/_images_frontend/core/logos/', 'file_types' => array('ico'))));
     $photosPane->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'watermark', 'label' => _('TXT_WATERMARK'), 'file_source' => 'design/_images_frontend/core/logos/', 'file_types' => array('png'))));
     $mailerdata = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'mailer_data', 'label' => _('TXT_MAIL_SETTINGS'))));
     $mailerType = $mailerdata->AddChild(new FormEngine\Elements\Select(array('name' => 'mailer', 'label' => _('TXT_MAIL_TYPE'), 'options' => FormEngine\Option::Make(array('mail' => 'mail', 'sendmail' => 'sendmail', 'smtp' => 'smtp')))));
     $mailerdata->AddChild(new FormEngine\Elements\TextField(array('name' => 'server', 'label' => _('TXT_MAIL_SERVER'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $mailerType, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('smtp')))), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_SERVER'))))));
     $mailerdata->AddChild(new FormEngine\Elements\TextField(array('name' => 'port', 'label' => _('TXT_MAIL_SERVER_PORT'), 'default' => 587, 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $mailerType, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('smtp')))), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_SERVER_PORT'))))));
     $mailerdata->AddChild(new FormEngine\Elements\Select(array('name' => 'smtpsecure', 'label' => _('TXT_MAIL_SMTP_SECURE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $mailerType, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('smtp')))), 'options' => FormEngine\Option::Make(array('' => 'brak', 'ssl' => 'ssl', 'tls' => 'tls')), 'value' => '')));
     $mailerdata->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'smtpauth', 'label' => _('TXT_MAIL_SMTP_AUTH'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $mailerType, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('smtp')))))));
     $mailerdata->AddChild(new FormEngine\Elements\TextField(array('name' => 'smtpusername', 'label' => _('TXT_MAIL_SMTP_USERNAME'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $mailerType, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('smtp')))))));
     $mailerdata->AddChild(new FormEngine\Elements\Password(array('name' => 'smtppassword', 'label' => _('TXT_MAIL_SMTP_PASSWORD'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $mailerType, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals('smtp')))))));
     $mailerdata->AddChild(new FormEngine\Elements\TextField(array('name' => 'fromname', 'label' => _('TXT_MAIL_FROMNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMNAME'))))));
     $mailerdata->AddChild(new FormEngine\Elements\TextField(array('name' => 'fromemail', 'label' => _('TXT_MAIL_FROMEMAIL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_MAIL_FROMEMAIL'))))));
     $mailerdata->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'terms', 'label' => 'Plik regulaminu', 'comment' => 'Zostanie załączony do każdego maila z potwierdzeniem zamówienia', 'file_source' => 'upload/', 'file_types' => array('pdf'))));
     $invoicedata = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'invoice_data', 'label' => _('TXT_INVOICE'))));
     $invoicedata->AddChild(new FormEngine\Elements\Select(array('name' => 'invoicenumerationkind', 'label' => _('TXT_INVOICE_NUMERATION'), 'options' => FormEngine\Option::Make(App::getModel('invoice')->getInvoiceNumerationTypes()))));
     $invoicedata->AddChild(new FormEngine\Elements\TextField(array('name' => 'invoicedefaultpaymentdue', 'label' => _('TXT_INVOICE_DEFAULT_PAYMENT_DUE'), 'suffix' => _('TXT_DAYS'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_NUMERIC_INVALID'), '/[0-9]{1,}/')))));
     $Data = Event::dispatch($this, 'admin.view.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     return $form;
 }
Esempio n. 24
0
 public function edit()
 {
     $this->registry->xajax->registerFunction(array('DeleteLayoutBox', $this->model, 'deleteLayoutbox'));
     $layoutboxes = $this->model->getLayoutBoxTree();
     $pagescheme_id = $this->id;
     // selected by user
     if (Helper::getViewId() > 0 && $pagescheme_id != $this->registry->core->getParam(0)) {
         // if it is not current view pagescheme change it
         App::redirect(__ADMINPANE__ . '/layoutbox/edit/' . $pagescheme_id . ',' . $this->model->getFirstLayoutBox($pagescheme_id));
     }
     $layoutbox_id = $this->registry->core->getParam(1);
     // id from URL
     if ((int) $layoutbox_id == 0 || empty($layoutboxes[$pagescheme_id . ',' . $layoutbox_id])) {
         // change pagescheme if subpage is not inside active
         $pagescheme_id = App::getModel('view')->getViewPagescheme(Helper::getViewId());
         App::redirect(__ADMINPANE__ . '/layoutbox/edit/' . $pagescheme_id . ',' . $this->model->getFirstLayoutBox($pagescheme_id));
     }
     $layoutBox = $this->model->getLayoutBoxToEdit($layoutbox_id);
     $behaviourBoxArray = $this->model->getLayoutBoxJSValuesToEdit($layoutbox_id);
     $ctValues = $this->model->getLayoutBoxContentTypeSpecificValues($layoutbox_id);
     if (isset($ctValues['categoryId']) && $ctValues['categoryId'] > 0) {
         $this->categoryActive = $ctValues['categoryId'];
         $this->categories = App::getModel('category')->getChildCategories(0, array($this->categoryActive));
     }
     $tree = new FormEngine\Elements\Form(array('name' => 'scheme_tree', 'action' => '', 'method' => 'post'));
     $tree->AddChild(new FormEngine\Elements\Tree(array('name' => 'pagescheme', 'sortable' => false, 'retractable' => false, 'selectable' => false, 'clickable' => true, 'deletable' => true, 'addable' => false, 'items' => $layoutboxes, 'onClick' => 'openLayoutBoxEditor', 'active' => $pagescheme_id . ',' . $layoutbox_id)));
     $form = new FormEngine\Elements\Form(array('name' => 'layoutbox', 'action' => '', 'method' => 'post'));
     $contentTypes = $this->model->getLayoutBoxContentTypeOptions();
     $boxEdit = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'box', 'label' => _('TXT_BOX_SETTINGS'))));
     $boxEdit->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'comment' => 'Wewnętrzna nazwa boksu, niewidoczna dla Klientów', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME'))))));
     $title = $boxEdit->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data')));
     $title->AddChild(new FormEngine\Elements\TextField(array('name' => 'title', 'label' => _('TXT_BOX_TITLE'), 'comment' => 'Tytuł boksu, który zobaczą Klienci', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_BOX_TITLE'))))));
     $boxContent = $boxEdit->AddChild(new FormEngine\Elements\Select(array('name' => 'box_content', 'label' => _('TXT_BOX_CONTENT'), 'options' => FormEngine\Option::Make($this->model->getLayoutBoxContentTypeOptionsAllToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_BOX_CONTENT'))))));
     $this->_addContentTypeSpecificFields($form, $boxContent, $contentTypes);
     $boxBehaviourEdit = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'behaviour', 'label' => _('TXT_BOX_BEHAVOIUR'))));
     $boxBehaviourEdit->AddChild(new FormEngine\Elements\Select(array('name' => 'bNoHeader', 'label' => 'Wyświetlaj nagłówek', 'options' => array(new FormEngine\Option('0', 'Tak'), new FormEngine\Option('1', 'Nie')))));
     $boxBehaviourEdit->AddChild(new FormEngine\Elements\TextField(array('name' => 'iDefaultSpan', 'label' => 'Domyślne rozciągnięcie', 'comment' => 'Wpisz liczbę kolumn', 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^(([0-9]{1,2})|(\\0)?)$/')))));
     $boxBehaviourEdit->AddChild(new FormEngine\Elements\Select(array('name' => 'iEnableBox', 'label' => 'Wyświetlanie boksu', 'options' => array(new FormEngine\Option('0', 'Dla wszystkich'), new FormEngine\Option('1', 'Dla zalogowanych'), new FormEngine\Option('2', 'Dla niezalogowanych'), new FormEngine\Option('3', 'Nie wyświetlaj')))));
     $populate = array('box' => array('name' => $layoutBox['name'], 'language_data' => array('title' => $layoutBox['title']), 'box_content' => $layoutBox['controller']), 'behaviour' => array('bNoHeader' => 0, 'iDefaultSpan' => '1', 'iEnableBox' => 0));
     if (isset($behaviourBoxArray) && count($behaviourBoxArray) > 0) {
         foreach ($behaviourBoxArray as $js => $value) {
             $populate['behaviour'][$js] = $value;
         }
     }
     $populate = $this->_populateContentTypeFields($contentTypes, $populate, $ctValues, $layoutBox['controller']);
     $form->Populate($populate);
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         $this->model->editLayoutBox($this->_performArtificialMechanics($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT)), $layoutbox_id);
         if (FormEngine\FE::IsAction('continue')) {
             App::redirect(__ADMINPANE__ . '/layoutbox/edit/' . $pagescheme_id . ',' . $layoutbox_id);
         } else {
             App::redirect(__ADMINPANE__ . '/layoutbox');
         }
     }
     $this->renderLayout(array('tree' => $tree->Render(), 'id' => $layoutbox_id, 'form' => $form->Render()));
 }