"_item_"), "CATALOG");
//Lecture des param�tres
_parser_("imports/".$param_path."/params.xml", array("OUTPUT" => "_output_","INPUT" => "_input_"), "PARAMS");
//Si l'export est sp�cial, on charge la fonction d'export
if ($specialexport) require_once("imports/".$param_path."/export.inc.php");
//En fonction du type de fichier de sortie, inclusion du script de gestion des sorties
switch ($output_type) {
case "xml" :
require_once ("imports/output_xml.inc.php");
break;
case "iso_2709" :
require_once ("imports/output_iso_2709.inc.php");
break;
case "custom" :
require_once ("imports/$param_path/".$output_params['SCRIPT']);
break;
case "txt":
require_once ("imports/output_txt.inc.php");
break;
default :
die($msg["export_cant_find_output_type"]);
}
//Cr�ation du fichier de sortie
$file_out = "export".$origine.".".$output_params['SUFFIX']."~";
} else {
//R�cup�ration du r�pertoire
$i = 0;
$param_path == "";
_parser_($fic_catal, array("ITEM" => "_item_"), "CATALOG");
//Lecture des param�tres
_parser_("imports/".$param_path."/params.xml", array("OUTPUT" => "_output_", "INPUT" => "_input_"), "PARAMS");
//Si l'export est sp�cial, on charge la fonction d'export
if ($specialexport) require_once("imports/".$param_path."/export.inc.php");
}
//Requ�te de s�lection et de comptage des notices
if ($n_current == "")
$n_current = 0;
$typdoc = "typdoc$lender";
$td = $$typdoc;
$statutdoc = "statut$lender";
$sd = $$statutdoc;
$requete = "select notice_id from notices";
$requete_count = "select count(distinct notice_id) from notices";
if (($lender != "x") || ($td != "") || ($sd != "")) {
$requete.= " , exemplaires";
$requete_count.= " , exemplaires";
$requete_where.= " expl_notice=notice_id";
}
if ($lender != "x") {
$requete_where.= " and expl_owner=$lender";
}
if ($td != "") {
$l_td = implode(",", $td);
$requete_where.= " and expl_typdoc in (".$l_td.")";
}
if ($sd != "") {
$l_sd = implode(",", $sd);
$requete_where.= " and expl_statut in (".$l_sd.")";
}
if ($requete_where != "") {
$requete.= " where ".$requete_where;
$requete_count.= " where ".$requete_where;
}
$requete.= " group by notice_id limit $n_current,200";
//Nombre de notices correspondantes aux crit�res
$resultat = mysql_query($requete_count);
$n_notices = mysql_result($resultat, 0, 0);
if ($first!=1) {
$_SESSION["param_export"]["notice_exporte"]="";
//On enregistre les variables post�es dans la session
export_param::init_session();
$fo = fopen("$base_path/temp/".$file_out, "w+");
//Ent�te
@ fwrite($fo, _get_header_($output_params));
fclose($fo);
}
if ($n_notices == 0) {
error_message($msg["export_no_notice_found"], $msg["export_no_notice_for_criterias"], 1, "export.php");
exit;
}
//Affichage de la progression
$percent = @ round(($n_current / $n_notices) * 100);
if ($percent == 0)
$percent = 1;
echo "".$msg["export_running"]."
\n";
echo " |
".round($percent)."% |
\n";
echo "".sprintf($msg["export_progress"],$n_current,$n_notices,($n_notices - $n_current))."";
//D�but d'export du lot
$resultat = mysql_query($requete);
//Recherche du no_notice le plus grand
$requete_max="select max(no_notice) from import_marc where origine='$origine'";
$resultat_max=mysql_query($requete_max);
$no_notice=mysql_result($resultat_max,0,0)*1+1;
$z = 0;
if($_SESSION["param_export"]["notice_exporte"]) $notice_exporte = $_SESSION["param_export"]["notice_exporte"];
else $notice_exporte=array();
if($_SESSION["param_export"]["bulletin_exporte"]) $bulletin_exporte = $_SESSION["param_export"]["bulletin_exporte"];
else $bulletin_exporte=array();
while (list ($id) = mysql_fetch_row($resultat)) {
if (!$specialexport) {
$e_notice=array();
$param = new export_param(EXP_SESSION_CONTEXT);
$e = new export(array($id),$notice_exporte, $bulletin_exporte);
do {
$nn=$e -> get_next_notice($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context));
if ($e->notice) $e_notice[]=$e->notice;
} while ($nn);
$notice_exporte=$e->notice_exporte;
//Pour les exemplaires de bulletin
do {
$nn=$e -> get_next_bulletin($lender, $td, $sd, $keep_expl,$param->get_parametres($param->context));
if ($e->notice) $e_notice[]=$e->notice;
} while ($nn);
$bulletin_exporte=$e->bulletins_exporte;
} else {
$e_notice = _export_($id,$keep_expl);
}
if (!is_array($e_notice)) {
$requete = "insert into import_marc (no_notice, notice, origine) values($no_notice,'".addslashes($e_notice)."', '$origine')";
mysql_query($requete);
$no_notice++;
$z ++;
} else {
for($i=0; $isetTimeout(\"document.location='start_import.php?first=1&import_type=$export_type&file_in=export".$origine.".fic&noimport=1&origine=$origine'\",1000)";
$_SESSION["param_export"]["notice_exporte"]='';
$_SESSION["param_export"]["bulletin_exporte"]='';
} else {
$_SESSION["param_export"]["notice_exporte"]=$notice_exporte;
$_SESSION["param_export"]["bulletin_exporte"]=$bulletin_exporte;
//Lot suivant
echo "";
}
?>