export_type=$type_convert; $export_type=$type_convert; //Récupération du répertoire $i = 0; $param_path = ""; if (file_exists("$base_path/admin/convert/imports/catalog_subst.xml")) { $fic_catal = "$base_path/admin/convert/imports/catalog_subst.xml"; } else { $fic_catal = "$base_path/admin/convert/imports/catalog.xml"; } _parser_($fic_catal, array("ITEM" => "_item_convert_"), "CATALOG"); //Lecture des paramètres _parser_("$base_path/admin/convert/imports/".$param_path."/params.xml", array("IMPORTNAME" => "_import_name_convert_","STEP" => "_step_convert_","OUTPUT" => "_output_convert_","INPUT" => "_input_convert_"), "PARAMS"); //En fonction du type de fichier de sortie, inclusion du script de gestion des sorties $output_instance = start_export::get_instance_from_output_type($output_type); $this->prepared_notice=$notice; if (!$do_not_start_yet) { $this->output_notice.=$this->transform(); } } public function get_exports() { global $export_list; global $i, $iall; global $base_path; $i=0; $iall=0; if (file_exists("$base_path/admin/convert/imports/catalog_subst.xml")) $fic_catal = "$base_path/admin/convert/imports/catalog_subst.xml"; else $fic_catal = "$base_path/admin/convert/imports/catalog.xml"; _parser_($fic_catal, array("ITEM" => "_item_export_list_convert_"), "CATALOG"); return $export_list; } public function get_header() { global $output_params; global $output_type; if(isset($output_params['SCRIPT'])) { $class_name = str_replace('.class.php', '', $output_params['SCRIPT']); if(class_exists($class_name)) { $instance = new $class_name(); return $instance->_get_header_($output_params); } } $output_instance = start_export::get_instance_from_output_type($output_type); if(is_object($output_instance)) { return $output_instance->_get_header_($output_params); } else { return _get_header_($output_params); } } public function get_footer() { global $output_params; global $output_type; if(isset($output_params['SCRIPT'])) { $class_name = str_replace('.class.php', '', $output_params['SCRIPT']); if(class_exists($class_name)) { $instance = new $class_name(); return $instance->_get_footer_($output_params); } } $output_instance = start_export::get_instance_from_output_type($output_type); if(is_object($output_instance)) { return $output_instance->_get_footer_($output_params); } else { return _get_footer_($output_params); } } public function transform() { global $step; global $param_path; global $n_errors; global $message_convert; global $input_type; global $base_path; global $include_path; global $class_path; global $input_params; global $msg; $notice=$this->prepared_notice; //Inclusion des librairies éventuelles for ($i = 0; $i < count($step); $i ++) { if ($step[$i]['TYPE'] == "custom") { //echo "imports/".$param_path."/".$step[$i][SCRIPT][0][value]; require_once ("$base_path/admin/convert/imports/".$param_path."/".$step[$i]['SCRIPT'][0]['value']); } } require_once ("$base_path/admin/convert/xmltransform.php"); //En fonction du type de fichier d'entrée, inclusion du script de gestion des entrées $input_instance = start_import::get_instance_from_input_type($input_type); for ($i = 0; $i < count($step); $i ++) { $s = $step[$i]; $islast=($i==count($step)-1); $isfirst=($i==0); switch ($s['TYPE']) { case "xmltransform" : $r = perform_xslt($notice, $s, $islast, $isfirst, $param_path); break; case "toiso" : $r = toiso($notice, $s, $islast, $isfirst, $param_path); break; case "isotoxml" : $r = isotoxml($notice, $s, $islast, $isfirst, $param_path); break; case "texttoxml": $r = texttoxml($notice, $s, $islast, $isfirst, $param_path); break; case "custom" : eval("\$r=".$s['CALLBACK'][0]['value']."(\$notice, \$s, \$islast, \$isfirst, \$param_path);"); break; } if (!$r['VALID']) { $this->n_errors=true; $this->message_convert= $r['ERROR']; $notice = ""; break; } else { $notice = $r['DATA']; if($r['WARNING']){ $this->n_errors=true; $this->message_convert= $r['WARNING']; } } } return $notice; } // Récupération de l'id à partir du nom de l'export public function get_id_by_path($path) { global $export_list; if (empty($export_list)) start_export::get_exports() ; for ($i=0;$i