Esempio n. 1
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'news', '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' => 'topic', 'label' => _('TXT_TOPIC'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_TOPIC')), new FormEngine\Rules\LanguageUnique(_('ERR_TOPIC_ALREADY_EXISTS'), 'newstranslation', 'topic', null, array('column' => 'newsid', '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' => 'summary', 'label' => _('TXT_NEWS_SUMMARY'))));
     $languageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'content', 'label' => _('TXT_CONTENT'), 'comment' => _('TXT_MAX_LENGTH') . ' 5000', 'max_length' => 5000)));
     $requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'publish', 'label' => _('TXT_PUBLISH'), 'default' => '1')));
     $requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'featured', 'label' => _('Polecany'), 'default' => '1')));
     $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)));
     $additionalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'additional_data', 'label' => _('TXT_ADDITIONAL_INFORMATION'))));
     $additionalData->AddChild(new FormEngine\Elements\Date(array('name' => 'startdate', 'label' => _('TXT_START_DATE'))));
     $additionalData->AddChild(new FormEngine\Elements\Date(array('name' => 'enddate', 'label' => _('TXT_END_DATE'))));
     $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_PHOTOS'))));
     $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'] : NULL)));
     $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.news.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. 2
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. 3
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. 4
0
 public function add()
 {
     $populateData = array('required_data' => array('controller' => 0), 'view_data' => array('view' => Helper::getViewIdsDefault()));
     $form = $this->formModel->initForm(1);
     $form->Populate($populateData);
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         $id = $this->model->addNewPaymentmethod($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT));
         if (FormEngine\FE::IsAction('next')) {
             App::redirect(__ADMINPANE__ . '/paymentmethod/add');
         } else {
             if (Helper::getViewId() > 0) {
                 Session::setVolatileMessage("Moduł płatności został dodany. Skonfiguruj go teraz w zakładce Konfiguracja.");
                 App::redirect(__ADMINPANE__ . '/paymentmethod/edit/' . $id);
             } else {
                 App::redirect(__ADMINPANE__ . '/paymentmethod');
             }
         }
     }
     $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('add.tpl'));
 }
Esempio n. 5
0
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'contentcategory', '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'))))));
     $languageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_CONTENT'))));
     $requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'header', 'label' => _('TXT_ENABLE_IN_HEADER'), 'default' => '1')));
     $requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'footer', 'label' => _('TXT_ENABLE_IN_FOOTER'), 'default' => '1')));
     $requiredData->AddChild(new FormEngine\Elements\Tip(array('direction' => FormEngine\Elements\Tip::DOWN, 'tip' => '<p>' . _('TXT_PARENT_CATEGORY_EXAMPLE') . '</p>')));
     $requiredData->AddChild(new FormEngine\Elements\Tree(array('name' => 'contentcategoryid', 'label' => _('TXT_CATEGORY'), 'choosable' => true, 'selectable' => false, 'sortable' => false, 'clickable' => false, 'restrict' => (int) $this->registry->core->getParam(), 'items' => App::getModel('contentcategory')->getContentCategoryALL($this->registry->core->getParam()))));
     $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'))));
     $languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword', 'label' => _('TXT_KEYWORDS'), 'comment' => _('TXT_KEYWORDS_HELP'))));
     $redirectData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'redirect_data', 'label' => _('TXT_CONTENTCATEGORY_REDIRECT'))));
     $redirect = $redirectData->AddChild(new FormEngine\Elements\Select(array('name' => 'redirect', 'label' => _('TXT_REDIRECT_TYPE'), 'options' => array(new FormEngine\Option(0, _('TXT_REDIRECT_NONE')), new FormEngine\Option(1, _('TXT_REDIRECT_INTERNAL')), new FormEngine\Option(2, _('TXT_REDIRECT_EXTERNAL'))), 'default' => 1)));
     $redirectData->AddChild(new FormEngine\Elements\Select(array('name' => 'redirect_route', 'label' => _('TXT_REDIRECT_INTERNAL_URL'), 'options' => array(new FormEngine\Option('frontend.mainside', _('TXT_CONTROLLER_MAINSIDE')), new FormEngine\Option('frontend.conditions', _('TXT_CONDITIONS')), new FormEngine\Option('frontend.clientlogin', _('TXT_CONTROLLER_CLIENTLOGIN')), new FormEngine\Option('frontend.registration', _('TXT_CONTROLLER_REGISTRATION')), new FormEngine\Option('frontend.contact', _('TXT_CONTROLLER_CONTACT')), new FormEngine\Option('frontend.sitemap', _('TXT_CONTROLLER_SITEMAP')), new FormEngine\Option('frontend.news', _('TXT_CONTROLLER_NEWS')), new FormEngine\Option('frontend.forgotpassword', _('TXT_CONTROLLER_FORGOTPASSWORD')), new FormEngine\Option('frontend.producerlist', _('TXT_CONTROLLER_PRODUCERLIST')), new FormEngine\Option('frontend.categorylist', _('TXT_CONTROLLER_CATEGORYLIST'))), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $redirect, new FormEngine\Conditions\Equals(1))), 'default' => 1)));
     $redirectData->AddChild(new FormEngine\Elements\TextField(array('name' => 'redirect_url', 'label' => _('TXT_REDIRECT_EXTERNAL_URL'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $redirect, new FormEngine\Conditions\Equals(2))))));
     $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.contentcategory.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. 6
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. 7
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. 8
0
 public function setViewId($viewid)
 {
     if ($viewid == 0) {
         $viewid = end(array_reverse(Helper::getViewIdsDefault()));
     }
     $this->viewid = $viewid;
 }