update
This commit is contained in:
@@ -96,26 +96,26 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$action = Tools::getValue('action');
|
||||
// $type = Tools::getValue('type');
|
||||
|
||||
|
||||
if ($action == 'processPosition') {
|
||||
$this->processPosition();
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'selectPosition') {
|
||||
$this->selectPosition();
|
||||
}
|
||||
|
||||
|
||||
if (Tools::isSubmit('submitImportData')) {
|
||||
$this->importData(Language::getLanguages(false), (int)$this->context->language->id);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'export') {
|
||||
$this->exportData();
|
||||
}
|
||||
|
||||
|
||||
//DONGND:: submit save
|
||||
if (Tools::isSubmit('submitSaveAndStay')) {
|
||||
if (Tools::getValue('data_profile') && Tools::getValue('data_profile') != '') {
|
||||
@@ -179,7 +179,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
$obj_model->add();
|
||||
}
|
||||
$path = _PS_ROOT_DIR_.'/cache/smarty/cache/'.$this->module_name;
|
||||
|
||||
|
||||
$this->deleteDirectory($path);
|
||||
};
|
||||
|
||||
@@ -203,10 +203,10 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}
|
||||
$this->error[] = $this->trans('Not exist data_profile', array(), 'Admin.Notifications.Success');
|
||||
}
|
||||
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessShowImportForm()
|
||||
{
|
||||
$id_profile = Tools::getValue('idProfile');
|
||||
@@ -276,7 +276,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
$array = array('hasError' => false, 'result' => $helper->generateForm(array($fields_form)));
|
||||
die(Tools::jsonEncode($array));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show panel : widgets and modules
|
||||
* .group-add
|
||||
@@ -326,13 +326,13 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
$array = array('hasError' => false, 'result' => $tpl->fetch());
|
||||
die(Tools::jsonEncode($array));
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessSaveData()
|
||||
{
|
||||
$type = Tools::getValue('type');
|
||||
$this->saveData('save', $type);
|
||||
}
|
||||
|
||||
|
||||
public function saveData($action, $type)
|
||||
{
|
||||
$data_form = Tools::getValue('dataForm');
|
||||
@@ -563,7 +563,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
//load javascript for menu tree, Product Carousel widget
|
||||
$tree = new HelperTreeCategories('123', null);
|
||||
$tree->render();
|
||||
|
||||
|
||||
$model = new ApPageBuilderModel();
|
||||
$id_profile = Tools::getValue('id_appagebuilder_profiles');
|
||||
if (!$id_profile) {
|
||||
@@ -611,7 +611,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}
|
||||
$positions[$key] = $temp;
|
||||
}
|
||||
|
||||
|
||||
// Get list position for dropdowns
|
||||
$list_positions = array();
|
||||
$list_positions['header'] = $model->getListPositisionByType('header', $this->context->shop->id);
|
||||
@@ -662,10 +662,10 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}
|
||||
$shortcode_form[] = $this->tpl_path.'/ap_page_builder_shortcodes/'.$s_from;
|
||||
}
|
||||
|
||||
|
||||
// ROOT//modules/appagebuilder/views/templates/admin/ap_page_builder_home/home.tpl
|
||||
$tpl = $this->createTemplate('home.tpl');
|
||||
|
||||
|
||||
$languages = array();
|
||||
foreach (Language::getLanguages(false) as $lang) {
|
||||
$languages[$lang['iso_code']] = $lang['id_lang'];
|
||||
@@ -676,20 +676,20 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
} else {
|
||||
$check_save_multithreading = 0;
|
||||
};
|
||||
|
||||
|
||||
//DONGND: check enable save submit
|
||||
if (Configuration::get('APPAGEBUILDER_SAVE_SUBMIT')) {
|
||||
$check_save_submit = 1;
|
||||
} else {
|
||||
$check_save_submit = 0;
|
||||
};
|
||||
|
||||
|
||||
//DONGND: error when submit
|
||||
$errorSubmit = '';
|
||||
if (Tools::isSubmit('errorSubmit')) {
|
||||
$errorSubmit = $this->l('There was an error during save. Please try again and check the value of server config: max_input_vars, make sure it is greater than 30000');
|
||||
}
|
||||
|
||||
|
||||
$tpl->assign(array(
|
||||
'positions' => $positions,
|
||||
'listPositions' => $list_positions,
|
||||
@@ -719,7 +719,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
'checkSaveSubmit' => $check_save_submit,
|
||||
'errorSubmit' => $errorSubmit,
|
||||
'listAnimation' => ApPageSetting::getAnimationsColumnGroup(),
|
||||
|
||||
|
||||
));
|
||||
$path_guide = $this->getTemplatePath().'guide.tpl';
|
||||
$guide_box = ApPageSetting::buildGuide($this->context, $path_guide, 3);
|
||||
@@ -728,12 +728,12 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
$this->errors[] = $this->l('Your Profile ID is not exist!');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function exportData()
|
||||
{
|
||||
$action = Tools::getValue('action');
|
||||
$type = Tools::getValue('type');
|
||||
|
||||
|
||||
$data = $this->saveData($action, $type);
|
||||
if ($data) {
|
||||
if ($type == 'all') {
|
||||
@@ -791,7 +791,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
die(Tools::jsonEncode($array));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function importData($language, $lang_id)
|
||||
{
|
||||
$upload_file = new Uploader('importFile');
|
||||
@@ -1021,7 +1021,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}
|
||||
return array('id' => '0', 'name' => '');
|
||||
}
|
||||
|
||||
|
||||
private function getParamByHook($groups, $params, $hook, $action = 'save')
|
||||
{
|
||||
$groups['params']['specific_type'] = (isset($groups['params']['specific_type']) && $groups['params']['specific_type']) ? $groups['params']['specific_type'] : '';
|
||||
@@ -1073,13 +1073,13 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
$params .= '[/ApRow]';
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
||||
public function clearModuleCache()
|
||||
{
|
||||
$module = APPageBuilder::getInstance();
|
||||
$module->clearHookCache();
|
||||
}
|
||||
|
||||
|
||||
private function deleteDirectory($dir)
|
||||
{
|
||||
if (!file_exists($dir)) {
|
||||
@@ -1101,18 +1101,18 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
|
||||
private function deleteModuleFromHook($hook_name, $module_name)
|
||||
{
|
||||
$res = true;
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'hook_module`
|
||||
WHERE `id_hook` IN(
|
||||
WHERE `id_hook` IN(
|
||||
SELECT `id_hook` FROM `'._DB_PREFIX_.'hook`
|
||||
WHERE name ="'.pSQL($hook_name).'") AND `id_module` IN( SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE name ="'.pSQL($module_name).'")';
|
||||
$res &= Db::getInstance()->execute($sql);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
private function saveExceptionConfig($hook, $type, $page, $ids)
|
||||
{
|
||||
if (!$type) {
|
||||
@@ -1142,7 +1142,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function createXmlFile($title)
|
||||
{
|
||||
$file_content = '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
@@ -1163,7 +1163,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
|
||||
return _THEMES_DIR_._THEME_NAME_.'/'.'export/'.$title.'.xml';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
@@ -1172,7 +1172,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
public function getTabSlug()
|
||||
{
|
||||
if (empty($this->tabSlug)) {
|
||||
|
||||
|
||||
// GET RULE FOLLOW AdminApPageBuilderProfiles
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT `id_tab`
|
||||
@@ -1185,7 +1185,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
|
||||
return $this->tabSlug;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
@@ -1194,7 +1194,7 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
{
|
||||
parent::initProcess();
|
||||
if (count($this->errors) <= 0) {
|
||||
|
||||
|
||||
if (!$this->access('edit')){
|
||||
if (Tools::isSubmit('submitSaveAndStay')) {
|
||||
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
|
||||
@@ -1203,9 +1203,9 @@ class AdminApPageBuilderHomeController extends ModuleAdminControllerCore
|
||||
}elseif( Tools::getIsset('action') && Tools::getValue('action') == 'export'){
|
||||
$this->errors[] = $this->trans('You do not have permission to export this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!$this->access('edit') && $this->ajax){
|
||||
if(Tools::getValue('action') == 'showImportForm')
|
||||
{
|
||||
|
||||
@@ -121,11 +121,11 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
|
||||
public function postProcess()
|
||||
{
|
||||
parent::postProcess();
|
||||
|
||||
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Tools::getIsset('duplicateappagebuilder_products')) {
|
||||
$id = Tools::getValue('id_appagebuilder_products');
|
||||
$model = new ApPageBuilderProductsModel($id);
|
||||
@@ -147,8 +147,8 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
|
||||
Tools::displayError('Can not duplicate Profiles');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Tools::isSubmit('saveELement')) {
|
||||
$filecontent = Tools::getValue('filecontent');
|
||||
$fileName = Tools::getValue('fileName');
|
||||
@@ -442,7 +442,7 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
public function displayDuplicateLink($token = null, $id = null, $name = null)
|
||||
{
|
||||
$controller = 'AdminApPageBuilderProducts';
|
||||
@@ -450,13 +450,13 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
|
||||
$html = '<a href="#" title="Duplicate" onclick="confirm_link(\'\', \'Duplicate Product List ID '.$id.'. If you wish to proceed, click "Yes". If not, click "No".\', \'Yes\', \'No\', \'index.php?controller='.$controller.'&id_appagebuilder_products='.$id.'&duplicateappagebuilder_products&token='.$token.'\', \'#\')">
|
||||
<i class="icon-copy"></i> Duplicate
|
||||
</a>';
|
||||
|
||||
|
||||
// validate module
|
||||
unset($name);
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
@@ -469,7 +469,7 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
|
||||
}
|
||||
return parent::access($action, $disable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
@@ -477,7 +477,7 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if( Tools::isSubmit('duplicate'.$this->table) ) {
|
||||
if ($this->id_object) {
|
||||
|
||||
@@ -98,10 +98,10 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
|
||||
$this->_where = ' AND sa.id_shop='.(int)$this->context->shop->id;
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
|
||||
|
||||
$this->profile_css_folder = _PS_THEME_DIR_.apPageHelper::getCssDir().'profiles/';
|
||||
$this->profile_js_folder = _PS_THEME_DIR_.apPageHelper::getJsDir().'profiles/';
|
||||
|
||||
|
||||
if (!is_dir($this->profile_css_folder)) {
|
||||
mkdir($this->profile_css_folder, 0755, true);
|
||||
}
|
||||
@@ -109,11 +109,11 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
mkdir($this->profile_js_folder, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
|
||||
|
||||
|
||||
$this->page_header_toolbar_btn['SaveAndStay'] = array(
|
||||
'href' => 'javascript:void(0);',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
@@ -128,7 +128,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
);
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
|
||||
public function setMedia($isNewTheme = false)
|
||||
{
|
||||
parent::setMedia($isNewTheme);
|
||||
@@ -138,7 +138,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
public function processDelete()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
|
||||
|
||||
if ($object && !$object->active) {
|
||||
$object = parent::processDelete();
|
||||
if ($object->profile_key) {
|
||||
@@ -186,7 +186,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
$this->redirect_after .= '&id_appagebuilder_profiles='.$object->id;
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
|
||||
public function displayViewLink($token = null, $id, $name = null)
|
||||
{
|
||||
// validate module
|
||||
@@ -273,7 +273,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
// $id_shop = $context->shop->id;
|
||||
$id = Tools::getValue('id_appagebuilder_profiles');
|
||||
$model = new ApPageBuilderProfilesModel($id);
|
||||
|
||||
|
||||
if($model){
|
||||
$old_key = $model->profile_key;
|
||||
$model->profile_key = $profile_key = 'profile'.ApPageSetting::getRandomNumber();
|
||||
@@ -282,7 +282,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
$model->active = '';
|
||||
$model->friendly_url = array();
|
||||
$duplicate_object = $model->save();
|
||||
|
||||
|
||||
if($duplicate_object){
|
||||
//duplicate shortCode
|
||||
$id_new = $model->id;
|
||||
@@ -673,7 +673,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
unset($key);
|
||||
}
|
||||
$params->fullwidth_other_hook = $post_other_hooks;
|
||||
|
||||
|
||||
# get post disable hook
|
||||
$cache_hooks = ApPageSetting::getCacheHook();
|
||||
$post_disable_hooks = array();
|
||||
@@ -684,18 +684,18 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
unset($key);
|
||||
}
|
||||
$params->disable_cache_hook = $post_disable_hooks;
|
||||
|
||||
|
||||
|
||||
# Save to params
|
||||
$this->object->params = Tools::jsonEncode($params);
|
||||
|
||||
|
||||
# Save group_box
|
||||
if (Tools::getValue('groupBox')) {
|
||||
$this->object->group_box = implode(',', Tools::getValue('groupBox'));
|
||||
} else {
|
||||
$this->object->group_box = '';
|
||||
}
|
||||
|
||||
|
||||
$this->object->save();
|
||||
}
|
||||
|
||||
@@ -710,7 +710,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
if (Tools::getValue('js') != '') {
|
||||
ApPageSetting::writeFile($this->profile_js_folder, $key.'.js', Tools::getValue('js'));
|
||||
}
|
||||
|
||||
|
||||
if (Tools::getValue('css') != '') {
|
||||
# FIX CUSTOMER CAN NOT TYPE "\"
|
||||
$temp = Tools::getAllValues();
|
||||
@@ -775,7 +775,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
$params = Tools::jsonDecode($this->object->params);
|
||||
return isset($params->disable_cache_hook) ? $params->disable_cache_hook : ApPageSetting::getCacheHook(3);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
@@ -783,7 +783,7 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if( Tools::isSubmit('duplicate'.$this->table) ) {
|
||||
if ($this->id_object) {
|
||||
|
||||
Reference in New Issue
Block a user