private function _validateField($group, $field, $value) { $this->load->library('config_manager'); $config_mngr = new AConfigManager(); $result = $config_mngr->validate($group, array($field => $value)); return is_array($result['error']) ? current($result['error']) : $result['error']; }
private function _validateForm($group) { if (!$this->user->canModify('setting/setting_quick_form')) { $this->error['warning'] = $this->language->get('error_permission'); } $this->load->library('config_manager'); $config_mngr = new AConfigManager(); $result = $config_mngr->validate($group, $this->request->post); $this->error = $result['error']; $this->request->post = $result['validated']; // for changed data saving $this->extensions->hk_ValidateData($this); if (!$this->error) { return TRUE; } else { return FALSE; } }
/** * @param string $group * @return bool */ private function _validate($group) { if (!$this->user->canModify('design/template')) { $this->error['warning'] = $this->language->get('error_permission'); } $this->load->library('config_manager'); $config_mngr = new AConfigManager(); $result = $config_mngr->validate($group, $this->request->post); $this->error = $result['error']; $this->request->post = $result['validated']; // for changed data saving $this->extensions->hk_ValidateData($this); if (!$this->error) { return true; } else { if (!isset($this->error['warning'])) { $this->error['warning'] = $this->language->get('error_required_data'); } return false; } }
private function _getQuickStartForm($section, $settings_data) { if ($settings_data['tmpl_id']) { //template settings $this->data['action'] = $this->html->getSecureURL('setting/setting_quick_form/quick_start_save_next', '&active=' . $section . '&store_id=' . $this->data['store_id'] . '&tmpl_id=' . $settings_data['tmpl_id']); $this->data['update'] = $this->html->getSecureURL('listing_grid/setting/update_field', '&group=' . $settings_data['tmpl_id'] . '&store_id=' . $this->data['store_id'] . '&tmpl_id=' . $settings_data['tmpl_id']); } else { $this->data['action'] = $this->html->getSecureURL('setting/setting_quick_form/quick_start_save_next', '&active=' . $section . '&store_id=' . $this->data['store_id']); $this->data['update'] = $this->html->getSecureURL('listing_grid/setting/update_field', '&group=' . $section . '&store_id=' . $this->data['store_id']); } $this->view->assign('language_code', $this->session->data['language']); $form = new AForm('HS'); $form->setForm(array('form_name' => 'settingFrm', 'update' => $this->data['update'])); $this->data['form']['id'] = 'settingFrm'; $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'settingFrm', 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"', 'action' => $this->data['action'])); $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1')); $this->data['form']['reset'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'reset', 'text' => $this->language->get('button_reset'))); $this->data['form']['fields'] = array(); require_once DIR_CORE . 'lib/config_manager.php'; $conf_mngr = new AConfigManager(); $set_fields = $conf_mngr->getFormFields($section, $form, $settings_data); foreach ($this->data['qs_fields'][$section] as $field_name) { $field = $set_fields[$field_name]; //replace wyswyg text editor to textarea inside modal-mode! if ($field->type == 'texteditor') { $ext_url = $this->html->getSecureURL('setting/setting', '&active=' . $section) . '#' . $field->element_id; $label_text = sprintf($this->language->get('text_texteditor_extended_mode'), $ext_url); $field = $form->getFieldHtml(array('type' => 'textarea', 'name' => $field->name, 'value' => $field->value, 'ovalue' => $field->ovalue, 'style' => $field->style, 'attr' => $field->attr, 'required' => $field->required, 'placeholder' => $field->placeholder, 'label_text' => $label_text)); } $this->data['form']['fields'][$field_name] = $field; } unset($set_fields); }
private function _getQuickStartForm($section, $settigs_data) { if ($settigs_data['tmpl_id']) { //template settings $this->data['action'] = $this->html->getSecureURL('setting/setting_quick_form/quick_start_save_next', '&active=' . $section . '&store_id=' . $this->data['store_id'] . '&tmpl_id=' . $settigs_data['tmpl_id']); $this->data['update'] = $this->html->getSecureURL('listing_grid/setting/update_field', '&group=' . $settigs_data['tmpl_id'] . '&store_id=' . $this->data['store_id'] . '&tmpl_id=' . $settigs_data['tmpl_id']); } else { $this->data['action'] = $this->html->getSecureURL('setting/setting_quick_form/quick_start_save_next', '&active=' . $section . '&store_id=' . $this->data['store_id']); $this->data['update'] = $this->html->getSecureURL('listing_grid/setting/update_field', '&group=' . $section . '&store_id=' . $this->data['store_id']); } $this->view->assign('language_code', $this->session->data['language']); $form = new AForm('HS'); $form->setForm(array('form_name' => 'settingFrm', 'update' => $this->data['update'])); $this->data['form']['id'] = 'settingFrm'; $this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'settingFrm', 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"', 'action' => $this->data['action'])); $this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => $this->language->get('button_save'), 'style' => 'button1')); $this->data['form']['reset'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'reset', 'text' => $this->language->get('button_reset'))); $this->data['form']['fields'] = array(); require_once DIR_CORE . 'lib/config_manager.php'; $conf_mngr = new AConfigManager(); $set_fields = $conf_mngr->getFormFields($section, $form, $settigs_data); foreach ($this->data['qs_fields'][$section] as $field) { $this->data['form']['fields'][$field] = $set_fields[$field]; } unset($set_fields); }