本文整理汇总了PHP中Gekosale\App::getURLAdressWithAdminPane方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getURLAdressWithAdminPane方法的具体用法?PHP App::getURLAdressWithAdminPane怎么用?PHP App::getURLAdressWithAdminPane使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gekosale\App
的用法示例。
在下文中一共展示了App::getURLAdressWithAdminPane方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initForm
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;
}
示例2: initForm
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;
}
示例3: initForm
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;
}
示例4: edit
public function edit()
{
// dodawanie zdjec
$form = new FormEngine\Elements\Form(array('name' => 'edit_file', 'action' => '', 'method' => 'post'));
$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')));
$form->AddFilter(new FormEngine\Filters\Trim());
if ($form->Validate(FormEngine\FE::SubmittedData())) {
App::redirect(__ADMINPANE__ . '/files');
}
$this->renderLayout(array('form' => $form->Render()));
}
示例5: __construct
public function __construct($attributes)
{
parent::__construct($attributes);
$this->_attributes['session_name'] = session_name();
$this->_attributes['session_id'] = session_id();
$this->_attributes['file_types'] = array('jpg', 'png', 'gif', 'swf');
if (!isset($this->_attributes['file_source'])) {
$this->_attributes['file_source'] = 'upload/';
}
$this->_attributes['file_types_description'] = \Gekosale\Translation::get('TXT_FILE_TYPES_IMAGE');
$this->_attributes['upload_url'] = App::getURLAdressWithAdminPane() . 'files/add/' . base64_encode($this->_attributes['file_source']);
$this->_attributes['load_handler'] = 'xajax_LoadFiles_' . $this->_id;
App::getRegistry()->xajaxInterface->registerFunction(array('LoadFiles_' . $this->_id, $this, 'LoadFiles'));
$this->_attributes['delete_handler'] = 'xajax_DeleteFile_' . $this->_id;
App::getRegistry()->xajaxInterface->registerFunction(array('DeleteFile_' . $this->_id, $this, 'DeleteFile'));
$this->_attributes['type_icons'] = array('cdup' => DESIGNPATH . '_images_panel/icons/filetypes/cdup.png', 'unknown' => DESIGNPATH . '_images_panel/icons/filetypes/unknown.png', 'directory' => DESIGNPATH . '_images_panel/icons/filetypes/directory.png', 'gif' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'png' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'jpg' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'bmp' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'txt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'doc' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'rtf' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'odt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'htm' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'html' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'php' => DESIGNPATH . '_images_panel/icons/filetypes/document.png');
}
示例6: initForm
public function initForm()
{
$form = new FormEngine\Elements\Form(array('name' => 'deliverer', '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'), 'deliverertranslation', 'name', null, array('column' => 'delivererid', 'values' => (int) $this->registry->core->getParam()))))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'www', 'label' => _('TXT_WWW'))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'comment' => _('TXT_EXAMPLE') . ': gekosale@gekosale.pl', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL')), new FormEngine\Rules\Email(_('ERR_WRONG_EMAIL'))))));
$relatedProducts = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'related_products', 'label' => _('TXT_SELECT_PRODUCTS'))));
$relatedProducts->AddChild(new FormEngine\Elements\ProductSelect(array('name' => 'products', 'label' => _('TXT_SELECT_PRODUCTS'), 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE)));
$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')));
$Data = Event::dispatch($this, 'admin.deliverer.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;
}
示例7: initForm
public function initForm()
{
$form = new FormEngine\Elements\Form(array('name' => 'category', 'action' => '', 'method' => 'post'));
$requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_BASIC_INFORMATION'))));
$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\TextField(array('name' => 'seo', 'label' => _('TXT_SEO_URL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CATEGORY_SEO')), new FormEngine\Rules\Format(_('ERR_ALPHANUMERIC_INVALID'), '/^[A-Za-z0-9-_\\/\\",\'\\s]+$/'), new FormEngine\Rules\LanguageUnique(_('ERR_CATEGORY_SEO_ALREADY_EXISTS'), 'categorytranslation', 'seo', null, array('column' => 'categoryid', 'values' => (int) $this->registry->core->getParam()))))));
$requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'enable', 'label' => _('TXT_ENABLE_CATEGORY'), 'default' => '1')));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'distinction', 'label' => _('TXT_CATEGORY_ORDER'))));
$requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . _('TXT_PARENT_CATEGORY') . '</p>')));
if ($this->populateData['required_data']['categoryid']) {
$active = $this->populateData['required_data']['categoryid'];
} else {
$active = $this->registry->core->getParam();
}
$requiredData->AddChild(new FormEngine\Elements\Tree(array('name' => 'categoryid', 'label' => _('TXT_CATEGORY'), 'comment' => _('TXT_PARENT_CATEGORY_EXAMPLE'), 'choosable' => true, 'selectable' => false, 'sortable' => false, 'clickable' => false, 'items' => App::getModel('category')->getChildCategories(0, array($active)), 'restrict' => (int) $this->registry->core->getParam(), 'load_children' => array(App::getModel('category'), 'getChildCategories'), 'rules' => array(new FormEngine\Rules\Custom(_('ERR_BIND_SELF_PARENT_INVALID'), array(App::getModel('category'), 'checkParentValue'), array('categoryid' => (int) $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' => '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'), 'max_length' => 1000)));
$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' => 3000, 'rows' => 20)));
$descriptionLanguageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 5000', 'max_length' => 3000, 'rows' => 30)));
$products = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'category_products', 'label' => _('TXT_PRODUCTS'))));
$products->AddChild(new FormEngine\Elements\ProductSelect(array('name' => 'products', 'label' => _('TXT_PRODUCTS'), 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE)));
$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'))));
$Data = Event::dispatch($this, 'admin.category.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;
}
示例8: initForm
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 » 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;
}
示例9: initForm
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 » 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 » 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 » 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;
}
示例10: edit
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'));
}