} if (!function_exists('filter_export')) { function filter_export($value_arr, $doc_id = 0) { return $value_arr; } } $cf_config['files_import_dir'] = MODULE_PATH . "import/"; $cf_config['files_export_dir'] = MODULE_PATH . "export/"; $cf_config['files_config_dir'] = MODULE_PATH . "config/"; $cf_config['mod_page'] = "index.php?a=112&id=" . $_GET['id']; $cf_config['content_table'] = $cf_config['content_type'] == 'documents' ? $modx->getFullTableName('site_content') : $modx->getFullTableName('catalog'); $cf_config['tmplvar_content_table'] = $cf_config['content_type'] == 'documents' ? $modx->getFullTableName('site_tmplvar_contentvalues') : $modx->getFullTableName('catalog_tmplvar_contentvalues'); $cf_config['insert_group'] = 200; require MODULE_PATH . "classes/catalogfill.class.php"; $catalogFill = new catalogFill($modx, $cf_config); $cf_action = isset($_POST['cf_action']) ? $_POST['cf_action'] : (isset($_GET['cf_action']) ? $_GET['cf_action'] : 'default'); switch ($cf_action) { case "import": $parent_id = $_POST['parent']; $file_name = !empty($_POST['file_path']) ? $_POST['file_path'] : (!empty($_POST['file']) ? $_POST['file'] : false); $catalogFill->config['imp_update'] = isset($_POST['cleanimport']) && $_POST['cleanimport'] == "1" ? true : false; if (strtolower(substr($file_name, -3)) == 'csv') { $catalogFill->csv_import($parent_id, $file_name); } else { if (strtolower(substr($file_name, -3)) == 'xls') { $catalogFill->xls_import($parent_id, $file_name); } else { if (strtolower(substr($file_name, -4)) == 'xlsx') { $catalogFill->xls_import($parent_id, $file_name, 'Excel2007'); }
if (!function_exists('filter_export')) { function filter_export($value_arr, $doc_id = 0) { return $value_arr; } } $cf_config['files_import_dir'] = MODULE_PATH . "import/"; $cf_config['files_export_dir'] = MODULE_PATH . "export/"; $cf_config['files_config_dir'] = MODULE_PATH . "config/"; $cf_config['files_settings_dir'] = MODULE_PATH . "settings/"; $cf_config['mod_page'] = "index.php?a=112&id=" . $_GET['id']; $cf_config['content_table'] = $cf_config['content_type'] == 'documents' ? $modx->getFullTableName('site_content') : $modx->getFullTableName('catalog'); $cf_config['tmplvar_content_table'] = $cf_config['content_type'] == 'documents' ? $modx->getFullTableName('site_tmplvar_contentvalues') : $modx->getFullTableName('catalog_tmplvar_contentvalues'); $cf_config['insert_group'] = 200; require MODULE_PATH . "classes/catalogfill.class.php"; $catalogFill = new catalogFill($modx, $cf_config); $cf_action = isset($_POST['cf_action']) ? $_POST['cf_action'] : (isset($_GET['cf_action']) ? $_GET['cf_action'] : 'default'); if (isset($start1Csync)) { $cf_action = "import"; } switch ($cf_action) { case "save_settings_1C_sync": if (empty($_POST['link_settings']) || empty($_POST['file_settings']) || empty($_POST['parent_id_settings'])) { $catalogFill->message = "Ошибка при сохранении (не указан один из параметров)"; false; } else { $catalogFill->save_settings_1C_sync($_POST['link_settings'], $_POST['file_settings'], $_POST['parent_id_settings']); } break; case "import": $parent_id = $_POST['parent'];