public function add() { $form = new FormEngine\Elements\Form(array('name' => 'promotion', 'action' => '', 'method' => 'post')); $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_SELECT_PRODUCTS')))); $productid = $requiredData->AddChild(new FormEngine\Elements\ProductSelect(array('name' => 'productid', 'label' => _('TXT_SELECT_PRODUCTS'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_SELECT_PRODUCTS'))), 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE))); $pricePane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'discount_pane', 'label' => _('TXT_DISCOUNT')))); $standardPrice = $pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'standard_price', 'label' => _('TXT_STANDARD_SELLPRICE')))); $enablePromotion = $standardPrice->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion', 'label' => _('TXT_ENABLE_PROMOTION'), 'default' => '0'))); $standardPrice->AddChild(new FormEngine\Elements\TextField(array('name' => 'discount', 'label' => _('TXT_DISCOUNT'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')), 'default' => '0.00', 'suffix' => '%', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), '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)))))); $clientGroups = App::getModel('clientgroup/clientgroup')->getClientGroupAll(); foreach ($clientGroups as $clientGroup) { $pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'field_' . $clientGroup['id'], 'label' => $clientGroup['name']))); $promotion[$clientGroup['id']] = $pricePane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion_' . $clientGroup['id'], 'label' => _('TXT_ENABLE_CLIENTGROUP_PROMOTION'), 'default' => '0'))); $pricePane->AddChild(new FormEngine\Elements\TextField(array('name' => 'discount_' . $clientGroup['id'], 'label' => _('TXT_DISCOUNT'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')), 'default' => '0.00', 'suffix' => '%', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $promotion[$clientGroup['id']], new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals(1))))))); $pricePane->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)))))); $pricePane->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)))))); } $form->AddFilter(new FormEngine\Filters\NoCode()); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); if ($form->Validate(FormEngine\FE::SubmittedData())) { $Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); $this->model->addPromotion($Data); App::getModel('product')->updateProductAttributesetPricesAll(); App::redirect(__ADMINPANE__ . '/productpromotion'); } $this->registry->template->assign('form', $form->Render()); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->xajax->processRequest(); $this->registry->template->display($this->loadTemplate('add.tpl')); }
public function edit() { $rawStoreData = $this->model->getStoreView($this->id); if (empty($rawStoreData)) { App::redirect(__ADMINPANE__ . '/store'); } $slogan = 0; if ($rawStoreData['isinvoiceshopname'] == 1) { $slogan = 1; } if ($rawStoreData['isinvoiceshopslogan'] == 1) { $slogan = 2; } $populateData = array('address_data' => array('placename' => $rawStoreData['placename'], 'postcode' => $rawStoreData['postcode'], 'street' => $rawStoreData['street'], 'streetno' => $rawStoreData['streetno'], 'placeno' => $rawStoreData['placeno'], 'province' => $rawStoreData['province'], 'countries' => $rawStoreData['countryid']), 'company_data' => array('companyname' => $rawStoreData['companyname'], 'shortcompanyname' => $rawStoreData['shortcompanyname'], 'nip' => $rawStoreData['nip'], 'krs' => $rawStoreData['krs']), 'bank_data' => array('bankname' => $rawStoreData['bankname'], 'banknr' => $rawStoreData['banknr']), 'photos_pane' => array('photo' => $rawStoreData['photo']), 'invoice_data' => array('isinvoiceshopslogan' => array('value' => $slogan), 'invoiceshopslogan' => $rawStoreData['invoiceshopslogan'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editStore($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/store'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $form = new FormEngine\Elements\Form(array('name' => 'rangetype', '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'), 'rangetypetranslation', 'name', null, array('column' => 'rangetypeid', 'values' => (int) $this->registry->core->getParam())))))); $categoryData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'category_data', 'label' => _('TXT_CATEGORY_DATA')))); $rawRangetypeData = App::getModel('rangetype')->getRangeTypeView($this->registry->core->getParam()); $categoryData->AddChild(new FormEngine\Elements\Tree(array('name' => 'category', 'label' => _('TXT_CATEGORY'), 'choosable' => false, 'selectable' => true, 'sortable' => false, 'clickable' => false, 'items' => App::getModel('category')->getChildCategories(0, $rawRangetypeData['rangetypecategorys']), 'load_children' => array(App::getModel('category'), 'getChildCategories')))); $form->AddFilter(new FormEngine\Filters\NoCode()); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); $rangetypeData = array('required_data' => array('language_data' => $rawRangetypeData['language']), 'category_data' => array('category' => $rawRangetypeData['rangetypecategorys'])); $form->Populate($rangetypeData); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { App::getModel('rangetype')->editRangeType($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam()); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/rangetype'); } $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')); }
public function add() { $form = new FormEngine\Elements\Form(array('name' => 'pagescheme', 'action' => '', 'method' => 'post')); $filesPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'files_pane', 'label' => 'Dodaj nowy szablon'))); $filesPane->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">Wybierz z dysku lub wgraj plik zip z szablonem sklepu. Po imporcie będziesz mógł zmienić jego ustawienia oraz ustawić jako domyślny dla sklepu.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $files = $filesPane->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'files', 'label' => 'Plik', 'file_source' => 'themes/', 'traversable' => false, 'file_types' => array('zip')))); if ($form->Validate(FormEngine\FE::SubmittedData())) { $Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); $check = App::getModel('pagescheme/import')->check($Data['files']['file']); $bValid = false; if (is_array($check)) { foreach ($check as $file) { if ($file['filename'] == 'settings/export.json') { $bValid = true; break; } } } if ($bValid) { App::getModel('pagescheme/import')->importPagescheme($Data['files']['file']); App::redirect(__ADMINPANE__ . '/templateeditor'); } else { Session::setVolatileMessage("Musisz wybrać prawidłowe archiwum ZIP."); App::redirect(__ADMINPANE__ . '/templateeditor/add'); } } $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')); }
public function index() { $Config = App::getConfig(); $configData = array('config_data' => array('admin_panel_link' => __ADMINPANE__, 'ssl' => (string) (isset($Config['ssl']) && $Config['ssl'] == 1) ? 1 : 0), 'gallerysettings_data' => App::getModel('globalsettings')->getGallerySettings()); $settingsData = App::getModel('globalsettings')->getSettings(); $colour = $settingsData['gallerysettings_data']['colour']; unset($settingsData['gallerysettings_data']); $settingsData['gallerysettings_data']['colour'] = array('type' => 1, 'start' => $colour); $this->formModel->setPopulateData(array_merge_recursive($configData, $settingsData)); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); $Settings = $form->getSubmitValues(); Event::notify($this, 'admin.globalsettings.model.save', array('id' => 1, 'data' => $Data)); App::getModel('globalsettings')->updateGallerySettings($Data); App::getModel('globalsettings')->updateGlobalSettings($Settings['interface'], 'interface'); App::getModel('globalsettings')->updateGlobalSettings(array('colour' => $Settings['gallerysettings_data']['colour']['start']), 'gallerysettings_data'); Session::setActiveGlobalSettings(NULL); App::getModel('globalsettings')->configWriter($Data); if (__ADMINPANE__ != $Data['admin_panel_link']) { Session::flush(); App::redirect(''); } else { App::redirect(__ADMINPANE__ . '/globalsettings'); } } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawGroupData = $this->model->getGroupsView((int) $this->id); if (empty($rawGroupData)) { App::redirect(__ADMINPANE__ . '/groups'); } $controllers = array(); $controllersRaw = App::getModel('groups')->getFullPermission(); foreach ($controllersRaw as $controller) { $controllers[] = array('name' => $controller['name'], 'id' => $controller['id']); } $actions = array(); $actionsRaw = $this->registry->right->getRightsToSmarty(); foreach ($actionsRaw as $right) { $actions[] = array('name' => $right['name'], 'id' => $right['value']); } $rightsData = array(); foreach ($controllersRaw as $controller) { $mask = 1; $rights = array(); for ($i = 0; $i < count($actions); $i++) { $rights[$actions[$i]['id']] = $controller['permission'] & $mask ? 1 : 0; $mask = $mask << 1; } $rightsData[$controller['id']] = $rights; } $populateData = array('basic_data' => array('name' => $rawGroupData['name']), 'rights_data' => array('rights' => $rightsData)); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { $this->model->editPermission($form->getSubmitValues(), $this->id); App::redirect(__ADMINPANE__ . '/groups'); } $this->renderLayout(array('form' => $form->Render())); }
public function index() { if (Session::getActiveUserid() != null) { App::redirect(__ADMINPANE__ . '/mainside'); } $form = new FormEngine\Elements\Form(array('name' => 'forgotlogin', 'action' => '', 'method' => 'post', 'class' => 'login-form')); $form->AddChild(new FormEngine\Elements\TextField(array('name' => 'login', 'label' => _('TXT_EMAIL_FORM_LOGIN'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_LOGIN_FORM_LOGIN')))))); $form->AddChild(new FormEngine\Elements\Submit(array('name' => 'log_in', 'label' => _('TXT_FORGOT_PASSWORD')))); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\NoCode()); if ($form->Validate(FormEngine\FE::SubmittedData())) { $loginValues = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); $result = App::getModel('login')->checkUsers($loginValues['login']); if ($result == 0) { Session::setVolatileLoginError(1, false); } else { $password = Core::passwordGenerate(); App::getModel('login')->changeUsersPassword($result, $password); $this->registry->template->assign('password', $password); App::getModel('mailer')->sendEmail(array('template' => 'forgotUsers', 'email' => array($_POST['login']), 'bcc' => false, 'subject' => _('TXT_FORGOT_PASSWORD'), 'viewid' => Helper::getViewId())); Session::setVolatileMessage("Nowe hasło zostało wysłane na podany adres e-mail."); App::redirect('login'); } } $error = Session::getVolatileLoginError(); if ($error[0] == 1) { $this->registry->template->assign('error', _('ERR_BAD_EMAIL')); } $languages = App::getModel('language')->getLanguages(); $this->registry->xajax->processRequest(); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->template->assign('form', $form->Render()); $this->registry->template->assign('languages', json_encode($languages)); $this->registry->template->display($this->loadTemplate('index.tpl')); }
public function edit() { $rawAttributeGroupData = $this->model->getGroup($this->id); if (empty($rawAttributeGroupData)) { App::redirect(__ADMINPANE__ . '/attributegroup/'); } $this->registry->xajaxInterface->registerFunction(array('AddGroup', $this->model, 'addEmptyGroup')); $this->registry->xajaxInterface->registerFunction(array('DeleteGroup', $this->model, 'deleteGroup')); $populateData = array('group_data' => array('attributegroupname' => $rawAttributeGroupData['name'], 'category' => $rawAttributeGroupData['category']), 'attribute_data' => array('attributes' => $rawAttributeGroupData['attributes'])); $error = Session::getVolatileErrorMessage(); if ($error) { $this->registry->template->assign('errormessage', print_r($error, 1)); } $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editAttributeGroup($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/attributegroup/edit/' . $this->id); } $this->renderLayout(array('form' => $form->Render(), 'existingGroups' => $this->model->getAllAttributeGroupName(), 'currentGroup' => $rawAttributeGroupData)); }
public function index() { if (strlen($this->registry->core->getParam()) > 0) { $result = App::getModel('login')->authProccessSha($this->registry->core->getParam()); if ($result == 1) { Session::setActiveLoginError(null); Session::setActiveUserid($result); App::getModel('login')->checkInstanceIsValid(); App::getModel('login')->setLoginTime(); App::getModel('login')->getUserData(); App::getModel('login')->setDefaultView($result); App::redirect(__ADMINPANE__ . '/mainside'); } } if (Session::getActiveUserid() != null) { App::redirect(__ADMINPANE__ . '/mainside'); } $form = new FormEngine\Elements\Form(array('name' => 'login', 'action' => '', 'method' => 'post', 'class' => 'login-form', 'csrf' => false)); $form->AddChild(new FormEngine\Elements\TextField(array('name' => 'login', 'label' => _('TXT_EMAIL_FORM_LOGIN'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL_FORM_LOGIN')))))); $form->AddChild(new FormEngine\Elements\Password(array('name' => 'password', 'label' => _('TXT_LOGIN_FORM_PASSWORD'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_LOGIN_FORM_PASSWORD')))))); $form->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'autologin', 'label' => _('TXT_AUTOLOGIN')))); $form->AddChild(new FormEngine\Elements\Submit(array('name' => 'log_in', 'label' => _('TXT_LOG_IN')))); $form->AddChild(new FormEngine\Elements\StaticText(array('text' => '<a href="' . App::getURLAdress() . 'forgotlogin">' . _('TXT_LOGIN_FORM_RESET_PASSWORD') . '</a>'))); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\NoCode()); if ($form->Validate(FormEngine\FE::SubmittedData())) { $loginValues = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); $result = App::getModel('login')->authProccess($loginValues['login'], $loginValues['password']); if ($result == 0) { Session::setVolatileLoginError(1, false); } else { if (isset($loginValues['autologin']) && $loginValues['autologin'] == 1) { App::getModel('login')->setAdminAutologinKey($result); } else { App::getModel('login')->destroyAdminAutologinKey(); } Session::setActiveLoginError(null); Session::setActiveUserid($result); App::getModel('login')->checkInstanceIsValid(); App::getModel('login')->setLoginTime(); App::getModel('login')->getUserData(); App::getModel('login')->setDefaultView($result); App::redirect(__ADMINPANE__ . '/mainside'); } } $error = Session::getVolatileLoginError(); if ($error[0] == 1) { $this->registry->template->assign('error', _('ERR_BAD_LOGIN_OR_PASSWORD')); } $languages = App::getModel('language')->getLanguages(); $this->registry->xajax->processRequest(); $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript()); $this->registry->template->assign('form', $form->Render()); $this->registry->template->assign('languages', json_encode($languages)); $this->registry->template->display($this->loadTemplate('index.tpl')); }
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())); }
public function edit() { $similarproduct = $this->model->getSimilarView((int) $this->id); $populateData = array('required_data' => array('name' => $similarproduct['name']), 'related_products' => array('products' => $this->model->getProductsDataGrid((int) $this->id))); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { $this->model->editRelated($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); App::redirect(__ADMINPANE__ . '/similarproduct'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $populateData = $this->model->getDataById($this->id); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editSitemaps($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/sitemaps'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawClientgroupData = $this->model->getClientGroupById($this->registry->core->getParam()); $populateData = array('required_data' => array('language_data' => $rawClientgroupData['language']), 'clients_data' => array('clients' => $rawClientgroupData['clients'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editClientGroup($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam()); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/clientgroup'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawOrderStatusGroupsData = $this->model->getOrderStatusGroupsView($this->registry->core->getParam()); $populateData = array('required_data' => array('language_data' => $rawOrderStatusGroupsData['language'], 'orderstatus' => $rawOrderStatusGroupsData['orderstatus'], 'colour' => array('type' => 1, 'start' => $rawOrderStatusGroupsData['colour']))); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editOrderStatusGroups($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/orderstatusgroups'); } $this->renderLayout(array('form' => $form->Render(), 'orderstatusgroupsedit' => _('TXT_ORDER_STATUS_GROUPS_EDIT'))); }
public function edit() { $rawAttributeproductData = $this->model->getAttributeProductName($this->registry->core->getParam()); $populateData = array('required_data' => array('attributeproductname' => $rawAttributeproductData['attributeproductname']), 'attributes_data' => array('attributeproductvalues' => $rawAttributeproductData['attributes'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->updateAttribute($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam()); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/attributeproduct'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawUnitmeasureData = $this->model->getUnitMeasureView($this->id); $populateData = array('required_data' => array('language_data' => $rawUnitmeasureData['language'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(\FormEngine\FE::SubmittedData())) { try { $this->model->editUnitMeasure($form->getSubmitValues(\FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/unitmeasure'); } $this->renderLayout(array('form' => $form->Render())); }
public function index() { if (App::getConfig('devmode') == 0) { App::redirect(__ADMINPANE__ . '/mainside'); } if ((int) $this->getParam() == 0) { $form = new FormEngine\Elements\Form(array('name' => 'exchange', 'action' => '', 'method' => 'post')); $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'type_pane', 'label' => _('TXT_EXCHANGE_TYPE_MIGRATION_SETTINGS')))); $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Podaj adres URL wtyczki integracyjnej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'apiurl', 'label' => _('TXT_MIGRATION_API_URL')))); $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Podaj klucz jaki został ustawiony w pliku integracyjnym ($key)</p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'apikey', 'label' => _('TXT_MIGRATION_API_KEY')))); $requiredData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Wybierz rodzaj importowanych danych.Sugerujemy import w następującej kolejności: <ul> <li>Zdjęcia</li> <li>Producenci</li> <li>Kategorie</li> <li>Wartości cech</li> <li>Produkty</li> </ul></p>', 'direction' => FormEngine\Elements\Tip::DOWN))); $requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'entity', 'label' => _('TXT_EXCHANGE_ENTITY'), 'options' => array(new FormEngine\Option(1, _('TXT_PRODUCTS')), new FormEngine\Option(2, _('TXT_CATEGORIES')), new FormEngine\Option(3, _('TXT_PRODUCERS')), new FormEngine\Option(4, _('TXT_PHOTOS')), new FormEngine\Option(5, _('TXT_ATTRIBUTES')), new FormEngine\Option(6, _('TXT_ORDERS')), new FormEngine\Option(7, _('TXT_SIMILARPRODUCT'))), 'default' => 1))); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); if ($form->Validate(FormEngine\FE::SubmittedData())) { $Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT); Session::setActiveMigrationData(json_encode($Data)); App::redirect(__ADMINPANE__ . '/migration/index/' . $Data['entity']); } $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('index.tpl')); } else { if (Session::getActiveMigrationData() == NULL) { App::redirect(__ADMINPANE__ . '/migration/'); } $form = new FormEngine\Elements\Form(array('name' => 'add_migration', 'action' => '', 'method' => 'post')); $progress = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'progres_data', 'label' => 'Aktualizacja'))); $progress->AddChild(new FormEngine\Elements\ProgressIndicator(array('name' => 'progress', 'label' => 'Postęp migracji', 'chunks' => 1, 'load' => array(App::getModel('migration'), 'doLoadQueque'), 'process' => array(App::getModel('migration'), 'doProcessQueque'), 'success' => array(App::getModel('migration'), 'doSuccessQueque'), 'preventSubmit' => true))); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); $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('index.tpl')); } }
public function edit() { $this->registry->xajaxInterface->registerFunction(array('AddClientGroup', App::getModel('clientgroup'), 'addEmptyClientGroup')); $rawClientData = $this->model->getClientView($this->id); $populateData = array('personal_data' => array('viewid' => $rawClientData['viewid'], 'firstname' => $rawClientData['firstname'], 'surname' => $rawClientData['surname'], 'email' => $rawClientData['email'], 'newsletter' => $rawClientData['newsletter'], 'phone' => $rawClientData['phone'], 'phone2' => $rawClientData['phone2'], 'clientgroupid' => $rawClientData['clientgroupid'], 'autoassign' => $rawClientData['autoassign']), 'billing_data' => array('firstname' => $rawClientData['billing_address']['firstname'], 'surname' => $rawClientData['billing_address']['surname'], 'street' => $rawClientData['billing_address']['street'], 'streetno' => $rawClientData['billing_address']['streetno'], 'placeno' => $rawClientData['billing_address']['placeno'], 'placename' => $rawClientData['billing_address']['placename'], 'postcode' => $rawClientData['billing_address']['postcode'], 'companyname' => $rawClientData['billing_address']['companyname'], 'nip' => $rawClientData['billing_address']['nip'], 'countryid' => $rawClientData['billing_address']['countryid']), 'shipping_data' => array('firstname' => $rawClientData['delivery_address']['firstname'], 'surname' => $rawClientData['delivery_address']['surname'], 'street' => $rawClientData['delivery_address']['street'], 'streetno' => $rawClientData['delivery_address']['streetno'], 'placeno' => $rawClientData['delivery_address']['placeno'], 'placename' => $rawClientData['delivery_address']['placename'], 'postcode' => $rawClientData['delivery_address']['postcode'], 'companyname' => $rawClientData['delivery_address']['companyname'], 'nip' => $rawClientData['delivery_address']['nip'], 'countryid' => $rawClientData['delivery_address']['countryid']), 'additional_data' => array('description' => $rawClientData['description'], 'disable' => $rawClientData['disable'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editClient($form->getSubmitValues(), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/client'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawNewsData = $this->model->getNewsView((int) $this->registry->core->getParam()); $populateData = array('required_data' => array('publish' => $rawNewsData['publish'], 'featured' => $rawNewsData['featured'], 'language_data' => $rawNewsData['language']), 'meta_data' => array('language_data' => $rawNewsData['language']), 'additional_data' => array('startdate' => $rawNewsData['startdate'], 'enddate' => $rawNewsData['enddate']), 'photos_pane' => array('photo' => $rawNewsData['photo'], 'mainphotoid' => $rawNewsData['mainphotoid']), 'view_data' => array('view' => $rawNewsData['view'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(\FormEngine\FE::SubmittedData())) { try { $this->model->editNews($form->getSubmitValues(\FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam()); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/news'); } $this->registry->xajaxInterface->registerFunction(array('doAJAXCreateSeo', App::getModel('seo'), 'doAJAXCreateSeo')); $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $data = $this->model->getOpinion($this->id); $form = new FormEngine\Elements\Form(array('name' => 'productrange', 'action' => '', 'method' => 'post')); $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'data', 'label' => _('TXT_OPINION')))); $requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . $data['nick'] . '</p>'))); $requiredData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'review', 'label' => _('TXT_CONTENT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_FILL_AN_OPINION')))))); $requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'enable', 'label' => _('TXT_PUBLISH')))); $form->Populate(array('data' => array('review' => $data['review'], 'enable' => (int) $data['enable']))); $form->AddFilter(new FormEngine\Filters\NoCode()); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); if ($form->Validate(FormEngine\FE::SubmittedData())) { $this->model->editOpinion($form->getSubmitValues(), $this->registry->core->getParam()); App::redirect(__ADMINPANE__ . '/productrange'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawControllerSeoData = $this->model->getControllerSeoView($this->id); if (empty($rawControllerSeoData)) { App::redirect(__ADMINPANE__ . '/controllerseo'); } $populateData = array('required_data' => array('controller' => $rawControllerSeoData['name'], 'language_data' => $rawControllerSeoData['translation'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->updateControllerSeo($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/controllerseo'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawDelivererData = $this->model->getDelivererView($this->id); if (empty($rawDelivererData)) { App::redirect(__ADMINPANE__ . '/deliverer'); } $populateData = array('required_data' => array('language_data' => $rawDelivererData['language']), 'related_products' => array('products' => $this->model->getProductsForDelilverer((int) $this->id)), 'photos_pane' => array('photo' => $rawDelivererData['photo'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editDeliverer($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/deliverer'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawProductStatusData = $this->model->getProductStatusView($this->id); if (empty($rawProductStatusData)) { App::redirect(__ADMINPANE__ . '/productstatus'); } $populateData = array('required_data' => array('name' => $rawProductStatusData['name'], 'symbol' => $rawProductStatusData['symbol'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editProductStatus($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/productstatus'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawLanguageData = $this->model->getLanguageView($this->id); if (empty($rawLanguageData)) { App::redirect(__ADMINPANE__ . '/language'); } $populateData = array('required_data' => array('name' => $rawLanguageData['name'], 'translation' => $rawLanguageData['translation']), 'currency_data' => array('currencyid' => $rawLanguageData['currencyid']), 'flag_pane' => array('flag' => $rawLanguageData['flag']), 'view_data' => array('view' => $rawLanguageData['view'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editLanguage($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/language'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $Data = $this->model->getCurrencieslistView($this->id); if (empty($Data)) { App::redirect(__ADMINPANE__ . '/currencieslist'); } $populateData = array('required_data' => array('name' => $Data['name'], 'symbol' => $Data['symbol'], 'decimalseparator' => $Data['decimalseparator'], 'decimalcount' => $Data['decimalcount'], 'thousandseparator' => $Data['thousandseparator'], 'positivepreffix' => $Data['positivepreffix'], 'positivesuffix' => $Data['positivesuffix'], 'negativepreffix' => $Data['negativepreffix'], 'negativesuffix' => $Data['negativesuffix']), 'exchange_data' => array($Data['exchangerates']), 'view_data' => array('view' => $Data['view'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editCurrencieslist($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/currencieslist'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $populateData = $this->model->getDataById($this->id); if (empty($populateData)) { App::redirect(__ADMINPANE__ . '/producer'); } $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->save($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/producer'); } $this->registry->xajaxInterface->registerFunction(array('doAJAXCreateSeo', App::getModel('seo'), 'doAJAXCreateSeo')); $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawData = $this->model->getContactView($this->registry->core->getParam()); if (empty($rawData)) { App::redirect(__ADMINPANE__ . '/contact'); } $populateData = array('required_data' => array('language_data' => $rawData['language'], 'publish' => $rawData['publish']), 'address_data' => array('language_data' => $rawData['language']), 'view_data' => array('view' => $rawData['view'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editContact($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam()); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/contact'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $ViewData = $this->model->getView((int) $this->id); if (empty($ViewData)) { App::redirect(__ADMINPANE__ . '/view'); } $populateData = array('required_data' => array('name' => $ViewData['name'], 'namespace' => $ViewData['namespace'], 'store' => $ViewData['store'], 'defaultvatid' => $ViewData['defaultvatid'], 'showtax' => $ViewData['showtax'], 'offline' => $ViewData['offline'], 'offlinetext' => $ViewData['offlinetext'], 'pageschemeid' => $ViewData['pageschemeid'], 'currencyid' => $ViewData['currencyid'], 'contactid' => $ViewData['contactid']), 'meta_data' => array('language_data' => $ViewData['language']), 'url_pane' => array('url' => $ViewData['url']), 'category_pane' => array('category' => $ViewData['category']), 'paymentmethod_pane' => array('paymentmethod' => $ViewData['paymentmethods']), 'dispatchmethod_pane' => array('dispatchmethod' => $ViewData['dispatchmethods']), 'assigntogroup_data' => array('taxes' => $ViewData['taxes'], 'periodid' => $ViewData['periodid'], 'table' => App::getModel('clientgroup')->getAssignToGroupPerView((int) $this->id)), 'registration_data' => array('forcelogin' => $ViewData['forcelogin'], 'confirmregistration' => $ViewData['confirmregistration'], 'enableregistration' => $ViewData['enableregistration']), 'cart_data' => array('cartredirect' => $ViewData['cartredirect'], 'minimumordervalue' => $ViewData['minimumordervalue']), 'logo' => array('photo' => $ViewData['photo'], 'favicon' => $ViewData['favicon'], 'watermark' => $ViewData['watermark']), 'invoice_data' => array('invoicenumerationkind' => $ViewData['invoicenumerationkind'], 'invoicedefaultpaymentdue' => $ViewData['invoicedefaultpaymentdue']), 'mailer_data' => array('mailer' => $ViewData['mailer']['mailer'], 'fromname' => $ViewData['mailer']['fromname'], 'fromemail' => $ViewData['mailer']['fromemail'], 'server' => $ViewData['mailer']['server'], 'port' => $ViewData['mailer']['port'], 'smtpsecure' => $ViewData['mailer']['smtpsecure'], 'smtpauth' => $ViewData['mailer']['smtpauth'], 'smtpusername' => $ViewData['mailer']['smtpusername'], 'smtppassword' => $ViewData['mailer']['smtppassword'], 'terms' => array('file' => $ViewData['terms']))); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(\FormEngine\FE::SubmittedData())) { try { $this->model->editView($form->getSubmitValues(\FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/view'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $rawDispatchmethodData = $this->model->getDispatchmethodView($this->registry->core->getParam()); if (empty($rawDispatchmethodData)) { App::redirect(__ADMINPANE__ . '/dispatchmethod'); } $populateData = array('required_data' => array('language_data' => $rawDispatchmethodData['language'], 'paymentmethodname' => $rawDispatchmethodData['paymentmethods'], 'type' => $rawDispatchmethodData['type'], 'currencyid' => $rawDispatchmethodData['currencyid']), 'dispatchmethod_data' => array('table' => $this->model->getDispatchmethodPrice((int) $this->registry->core->getParam()), 'maximumweight' => $rawDispatchmethodData['maximumweight']), 'dispatchmethodweight_data' => array('tableweight' => $this->model->getDispatchmethodWeight((int) $this->registry->core->getParam()), 'freedelivery' => $rawDispatchmethodData['freedelivery']), 'description_data' => array('description' => $rawDispatchmethodData['description']), 'photos_pane' => array('photo' => $rawDispatchmethodData['photo']), 'view_data' => array('view' => $rawDispatchmethodData['view']), 'country_pane' => array('countryids' => $rawDispatchmethodData['countryids'])); $this->formModel->setPopulateData($populateData); $form = $this->formModel->initForm(); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editDispatchmethod($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam()); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/dispatchmethod'); } $this->renderLayout(array('form' => $form->Render())); }
public function edit() { $integrationModel = $this->model->getIntegrationModelById($this->id); if (empty($integrationModel)) { App::redirect(__ADMINPANE__ . '/integration'); } $form = new FormEngine\Elements\Form(array('name' => 'edit_integration', 'action' => '', 'method' => 'post')); if (method_exists(App::getModel('integration/' . $integrationModel), 'updateCategories')) { App::getModel('integration/' . $integrationModel)->updateCategories(); } $requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_INFORMATION')))); $requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p>' . App::getModel('integration/' . $integrationModel)->getDescription() . '</p>'))); $url = $this->registry->router->generate('frontend.integration', true, array('param' => $integrationModel)); $requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p><a href="' . $url . '" target="_blank"><b>Link do pliku integracyjnego</b></a></p>'))); $configurationFields = App::getModel('integration/' . $integrationModel)->getConfigurationFields(); if (is_array($configurationFields) && !empty($configurationFields)) { $configurationData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'configuration_data', 'label' => _('TXT_CONFIGURATION_DATA')))); } $whitelist = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'whitelist_data', 'label' => _('TXT_INTEGRATION_WHITELIST')))); $whitelist->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>' . _('TXT_INTEGRATION_WHITELIST_HELP') . '</p>'))); $whitelist->AddChild(new FormEngine\Elements\StaticText(array('text' => '<strong>Twój adres IP: ' . Core::getRealIpAddress() . '</strong>'))); $fieldset = $whitelist->AddChild(new FormEngine\Elements\FieldsetRepeatable(array('name' => 'whitelist', 'label' => _('TXT_INTEGRATION_WHITELIST'), 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE))); $fieldset->AddChild(new FormEngine\Elements\TextField(array('name' => 'ip', 'label' => 'IP'))); $rawData = $this->model->getIntegrationView($this->id); $pollData = array('whitelist_data' => array('whitelist' => $rawData['whitelist'])); $form->Populate($pollData); $form->AddFilter(new FormEngine\Filters\NoCode()); $form->AddFilter(new FormEngine\Filters\Trim()); $form->AddFilter(new FormEngine\Filters\Secure()); if ($form->Validate(FormEngine\FE::SubmittedData())) { try { $this->model->editIntegration($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->id); } catch (Exception $e) { $this->registry->template->assign('error', $e->getMessage()); } App::redirect(__ADMINPANE__ . '/integration'); } $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')); }