type ;
// Afin de trier les éditions :
switch ($caddie_type) {
case 'NOTI' :
$fromc = " left join notices on object_id=notice_id " ;
$orderc = ", niveau_hierar desc " ;
break;
case 'EXPL' :
$fromc = " left join exemplaires on object_id=expl_id " ;
$orderc = ", expl_notice desc, expl_bulletin " ;
break;
case 'BULL' :
$fromc = " left join bulletins on object_id=bulletin_id " ;
$orderc = ", date_date " ;
break;
}
$requete = "SELECT caddie_content.* FROM caddie_content $fromc where caddie_id='".$idcaddie."' ";
if ($flag && $no_flag ) $complement_clause = "";
if (!$flag && $no_flag ) $complement_clause = " and flag is null ";
if ($flag && !$no_flag ) $complement_clause = " and flag is not null ";
if (!$flag && !$no_flag ) return ;
$requete .= $complement_clause." order by blob_type, content $orderc, object_id";
$liste=array();
$result = mysql_query($requete, $dbh) or die($requete."
".mysql_error($dbh));
if($dest=="EXPORT_NOTI"){
$noti_tpl=new notice_tpl_gen($notice_tpl);
}
if(mysql_num_rows($result)) {
while ($temp = mysql_fetch_object($result)) {
if($dest=="EXPORT_NOTI"){
if ($caddie_type=="EXPL"){
$rqt_test = "select expl_bulletin+expl_notice as id from exemplaires where expl_id='".$temp->object_id."' ";
$res_notice = mysql_query($rqt_test, $dbh);
$obj_notice = mysql_fetch_object($res_notice) ;
if(!$flag_notice_id[$obj_notice->id]){
$flag_notice_id[$obj_notice->id]=1;
$contents.=$noti_tpl->build_notice($obj_notice->id)."
";
}
} elseif ($caddie_type=="NOTI") $contents.=$noti_tpl->build_notice($temp->object_id)."
";
if ($caddie_type=="BULL"){
$rqt_test = $rqt_tout = "select num_notice as id from bulletins where bulletin_id = '".$temp->object_id."' ";
$res_notice = mysql_query($rqt_test, $dbh);
$obj_notice = mysql_fetch_object($res_notice);
if(!$flag_notice_id[$obj_notice->id] && $obj_notice->id){
$flag_notice_id[$obj_notice->id]=1;
$contents.=$noti_tpl->build_notice($obj_notice->id)."
";
}
}
} else
$liste[] = array('object_id' => $temp->object_id, 'content' => $temp->content, 'blob_type' => $temp->blob_type, 'flag' => $temp->flag ) ;
}
} else return;
switch($dest) {
case "TABLEAU":
break;
case "EXPORT_NOTI":
return "".$contents."";
break;
case "TABLEAUHTML":
default:
echo pmb_bidi("".$msg['panier_num']." $idcaddie / ".$myCart->name."
");
echo pmb_bidi($myCart->comment."
");
break;
}
// en fonction du type de caddie on affiche ce qu'il faut
if ($caddie_type=="NOTI") {
// calcul du nombre max de colonnes pour les auteurs
$rqt_compte1 = "create temporary table tmp_compte1 ENGINE=MyISAM as select count(*) as comptage from caddie_content join notices on object_id=notice_id left join responsability on responsability_notice=notice_id where caddie_id=$idcaddie group by notice_id" ;
$res_compte1 = mysql_query($rqt_compte1, $dbh) ;
$rqt_compte2 = "select max(comptage) as max_aut from tmp_compte1 " ;
$res_compte2 = mysql_query($rqt_compte2, $dbh) ;
$compte2 = mysql_fetch_object($res_compte2) ;
$max_aut = $compte2->max_aut ;
// calcul du nombre max de colonnes pour les champs perso
$rqt_compte3 = "select idchamp, titre from notices_custom order by ordre " ;
$res_compte3 = mysql_query($rqt_compte3, $dbh) ;
$max_perso = mysql_num_rows($res_compte3) ;
// boucle de parcours des notices trouvées
// inclusion du javascript de gestion des listes dépliables
// début de liste
$entete_bloc_prec="";
while(list($cle, $object) = each($liste)) {
if ($object[content]=="") {
//On regarde le type de notice
$requete="select niveau_biblio, niveau_hierar FROM notices WHERE notice_id='".$object[object_id]."' ";
$mon_res=mysql_query($requete,$dbh);
$sel=", '', '', '', '', '', '', ''";
$tabl="";
if(mysql_result($mon_res,0,0) == "a" && mysql_result($mon_res,0,1) == "2"){
$sel=" ,n2.tit1 as 'Périodique', n2.code as ISSN, b.bulletin_numero, b.mention_date, b.date_date, b.bulletin_titre, b.bulletin_cb ";
$tabl=" JOIN analysis ON n1.notice_id=analysis_notice JOIN bulletins b ON analysis_bulletin=b.bulletin_id JOIN notices n2 ON n2.notice_id=bulletin_notice ";
} elseif(mysql_result($mon_res,0,0) == "b" && mysql_result($mon_res,0,1) == "2"){
$sel=" ,n2.tit1, n2.code as ISSN, b.bulletin_numero, b.mention_date, b.date_date, b.bulletin_titre, b.bulletin_cb ";
$tabl=" JOIN bulletins b ON n1.notice_id=b.num_notice JOIN notices n2 ON n2.notice_id=bulletin_notice ";
}
$rqt_tout = "SELECT n1.notice_id, n1.typdoc, n1.tit1, n1.tit2, n1.tit3, n1.tit4, serie_name, n1.tnvol, p1.ed_name, p1.ed_ville, collection_name, sub_coll_name, n1.year, n1.nocoll, n1.mention_edition, p2.ed_name as '2nd editeur', p2.ed_ville as 'ville 2nd editeur', n1.code as ISBN, n1.npages, n1.ill, n1.size, n1.accomp, n1.n_gen, n1.n_contenu, n1.n_resume, n1.lien, n1.eformat, n1.index_l, indexint_name, n1.niveau_biblio, n1.niveau_hierar, n1.prix, n1.statut, n1.commentaire_gestion, n1.thumbnail_url, n1.create_date, n1.update_date ".$sel." FROM notices n1";
$rqt_tout.= " left join series on serie_id=n1.tparent_id ";
$rqt_tout.= " left join publishers p1 on p1.ed_id=n1.ed1_id ";
$rqt_tout.= " left join publishers p2 on p2.ed_id=n1.ed2_id ";
$rqt_tout.= " left join collections on n1.coll_id=collection_id ";
$rqt_tout.= " left join sub_collections on n1.subcoll_id=sub_coll_id ";
$rqt_tout.= " left join indexint on n1.indexint=indexint_id ";
$rqt_tout.=$tabl;
$rqt_tout.= " WHERE n1.notice_id='".$object[object_id]."' ";
//echo "requete :".$rqt_tout."\n";
$entete_bloc="MONO";
if ($entete_bloc!=$entete_bloc_prec) {
extrait_info_notice($rqt_tout, 1, $object[flag]);
$entete_bloc_prec=$entete_bloc ;
} else extrait_info_notice($rqt_tout, 0, $object[flag]);
} else {
$entete_bloc="BLOB";
if ($entete_bloc!=$entete_bloc_prec) {
extrait_blob($object[blob_type]." ".$object[content],1, $object[flag]);
$entete_bloc_prec=$entete_bloc ;
} else extrait_blob($object[blob_type]." ".$object[content],0, $object[flag]);;
}
} // fin de liste
} // fin si NOTI
// si EXPL
if ($caddie_type=="EXPL") {
// calcul du nombre max de colonnes pour les auteurs
$rqt_compte1 = "create temporary table tmp_compte1 ENGINE=MyISAM as select count(*) as comptage from caddie_content join notices on object_id=notice_id left join responsability on responsability_notice=notice_id where caddie_id=$idcaddie group by notice_id" ;
$res_compte1 = mysql_query($rqt_compte1, $dbh) ;
$rqt_compte2 = "select max(comptage) as max_aut from tmp_compte1 " ;
$res_compte2 = mysql_query($rqt_compte2, $dbh) ;
$compte2 = mysql_fetch_object($res_compte2) ;
$max_aut = $compte2->max_aut ;
// calcul du nombre max de colonnes pour les champs perso
$rqt_compte3 = "select idchamp, titre from expl_custom order by ordre " ;
$res_compte3 = mysql_query($rqt_compte3, $dbh) ;
$max_perso = mysql_num_rows($res_compte3) ;
// boucle de parcours des exemplaires trouvés
while(list($cle, $expl) = each($liste)) {
if (!$expl[content]) {
$rqt_test = "select expl_bulletin from exemplaires where expl_id='".$expl[object_id]."' ";
$result_test = mysql_query($rqt_test, $dbh);
$obj_test = mysql_fetch_object($result_test) ;
if ($obj_test->expl_bulletin==0) {
// expl de mono
$rqt_tout = "SELECT e.*, t.*, s.*, st.*, l.*, stat.*, n.*";
$rqt_tout .= " FROM exemplaires e";
$rqt_tout .= ", docs_type t";
$rqt_tout .= ", docs_section s";
$rqt_tout .= ", docs_statut st";
$rqt_tout .= ", docs_location l";
$rqt_tout .= ", docs_codestat stat";
$rqt_tout .= ", notices n";
$rqt_tout .= " WHERE e.expl_id='".$expl[object_id]."'";
$rqt_tout .= " AND e.expl_typdoc=t.idtyp_doc";
$rqt_tout .= " AND e.expl_section=s.idsection";
$rqt_tout .= " AND e.expl_statut=st.idstatut";
$rqt_tout .= " AND e.expl_location=l.idlocation";
$rqt_tout .= " AND e.expl_codestat=stat.idcode";
$rqt_tout .= " AND e.expl_notice=n.notice_id";
$entete_bloc="EXPLMONO" ;
} else {
// expl de bulletin
$rqt_tout = "SELECT e.*, t.*, s.*, st.*, l.*, stat.*, n.*, b.*";
$rqt_tout .= " FROM exemplaires e";
$rqt_tout .= ", docs_type t";
$rqt_tout .= ", docs_section s";
$rqt_tout .= ", docs_statut st";
$rqt_tout .= ", docs_location l";
$rqt_tout .= ", docs_codestat stat";
$rqt_tout .= ", notices n";
$rqt_tout .= ", bulletins b";
$rqt_tout .= " WHERE e.expl_id='".$expl[object_id]."'";
$rqt_tout .= " AND e.expl_typdoc=t.idtyp_doc";
$rqt_tout .= " AND e.expl_section=s.idsection";
$rqt_tout .= " AND e.expl_statut=st.idstatut";
$rqt_tout .= " AND e.expl_location=l.idlocation";
$rqt_tout .= " AND e.expl_codestat=stat.idcode";
$rqt_tout .= " AND e.expl_bulletin=b.bulletin_id";
$rqt_tout .= " AND n.notice_id=b.bulletin_notice";
$entete_bloc="EXPLBULL";
}
if ($entete_bloc!=$entete_bloc_prec) {
extrait_info_notice($rqt_tout, 1, $expl[flag]);
$entete_bloc_prec=$entete_bloc ;
} else extrait_info_notice($rqt_tout, 0, $expl[flag]);
} else {
$entete_bloc="BLOB";
if ($entete_bloc!=$entete_bloc_prec) {
extrait_blob($expl[blob_type]." ".$expl[content],1, $expl[flag]);
$entete_bloc_prec=$entete_bloc ;
} else extrait_blob($expl[blob_type]." ".$expl[content],0, $expl[flag]);
}
} // fin de liste
} // fin si EXPL
if ($caddie_type=="BULL") {
// boucle de parcours des bulletins trouvés
// inclusion du javascript de gestion des listes dépliables
// début de liste
while(list($cle, $expl) = each($liste)) {
if (!$expl[content]) {
$rqt_tout = "select * from bulletins where bulletin_id = '".$expl[object_id]."' ";
$entete_bloc="BULL";
if ($entete_bloc!=$entete_bloc_prec) {
extrait_info($rqt_tout, 1, $expl[flag]);
$entete_bloc_prec=$entete_bloc ;
} else extrait_info($rqt_tout, 0, $expl[flag]);
} else {
$entete_bloc="BLOB";
if ($entete_bloc!=$entete_bloc_prec) {
extrait_blob($expl[blob_type]." ".$expl[content],1, $expl[flag]);
$entete_bloc_prec=$entete_bloc ;
} else extrait_blob($expl[blob_type]." ".$expl[content],0, $expl[flag]);
}
} // fin de liste
} // fin si BULL
return;
}
function extrait_info ($sql="", $entete=1, $flag="") {
global $dbh ;
global $dest ;
global $worksheet ;
global $entete_bloc;
global $msg;
global $debligne_excel;
global $etat_table ; // permet de savoir si les tag table sont ouverts ou fermés
global $max_aut ; // le nombre max de colonnes d'auteurs
if (!$debligne_excel) $debligne_excel = 0 ;
$res = @mysql_query($sql, $dbh);
$nbr_lignes = @mysql_num_rows($res);
$nbr_champs = @mysql_num_fields($res);
if ($nbr_lignes) {
switch($dest) {
case "TABLEAU":
if ($entete) {
$worksheet->write_string((1+$debligne_excel),0,$msg["caddie_mess_edition_".$entete_bloc]);
$debligne_excel++ ;
}
for($i=0; $i < $nbr_champs; $i++) {
// entête de colonnes
$fieldname = mysql_field_name($res, $i);
if ($entete) {
$worksheet->write_string((1+$debligne_excel),0,$msg['caddie_action_marque']);
$worksheet->write_string((1+$debligne_excel),($i+1),${fieldname});
}
}
if ($entete) $debligne_excel++ ;
for($i=0; $i < $nbr_lignes; $i++) {
$debligne_excel++;
$row = mysql_fetch_row($res);
if ($flag) $worksheet->write_string(($i+$debligne_excel),0,"X");
$j=0;
foreach($row as $dummykey=>$col) {
if(!$col) $col=" ";
$worksheet->write_string(($i+$debligne_excel),($j+1),$col);
$j++;
}
}
break;
case "TABLEAUHTML":
if ($entete) {
if ($etat_table) echo "\n";
echo "".$msg["caddie_mess_edition_".$entete_bloc]."
";
echo "\n".$msg['caddie_action_marque']." | ";
$etat_table = 1 ;
}
for($i=0; $i < $nbr_champs; $i++) {
$fieldname = mysql_field_name($res, $i);
if ($entete) print("${fieldname} | ");
}
for($i=0; $i < $nbr_lignes; $i++) {
$row = mysql_fetch_row($res);
echo "";
if ($flag) print "X | "; else print " | ";
foreach($row as $dummykey=>$col) {
if (is_numeric($col)){
$col = "'".$col ;
}
if(!$col) $col=" ";
print pmb_bidi("$col | ");
}
echo "
";
}
break;
default:
if ($entete) {
if ($etat_table) echo "\n
";
echo "".$msg["caddie_mess_edition_".$entete_bloc]."
";
echo "\n".$msg['caddie_action_marque']." | ";
$etat_table = 1 ;
}
for($i=0; $i < $nbr_champs; $i++) {
$fieldname = mysql_field_name($res, $i);
if ($entete) print("${fieldname} | ");
}
$odd_even=0;
for($i=0; $i < $nbr_lignes; $i++) {
$row = mysql_fetch_row($res);
if ($odd_even==0) {
echo " ";
$odd_even=1;
} else if ($odd_even==1) {
echo "
";
$odd_even=0;
}
if ($flag) print "X | "; else print " | ";
foreach($row as $dummykey=>$col) {
if(!$col) $col=" ";
print pmb_bidi("$col | ");
}
echo "
";
}
break;
} // fin switch
} // fin if nbr_lignes
} // fin fonction extrait_info
function extrait_info_notice ($sql="", $entete=1, $flag="") {
global $dbh ;
global $dest ;
global $worksheet ;
global $myCart ;
global $entete_bloc;
global $msg;
global $debligne_excel;
global $etat_table ; // permet de savoir si les tag table sont ouverts ou fermés
global $max_aut ; // le nombre max de colonnes d'auteurs
global $thesaurus_mode_pmb;
global $thesaurus_defaut;
global $lang;
global $pmb_keyword_sep;
global $max_perso;
global $res_compte3 ;
if (!$debligne_excel) $debligne_excel = 0 ;
$res = @mysql_query($sql, $dbh);
$nbr_lignes = @mysql_num_rows($res);
$nbr_champs = @mysql_num_fields($res);
if ($nbr_lignes) {
// Pour les champs personnalisés
$caddie_type = $myCart->type ;
switch ($caddie_type) {
case 'EXPL' :
$libelle_caddie_type = "expl" ;
break;
case 'NOTI' :
default :
$libelle_caddie_type = "notices" ;
break;
}
switch($dest) {
case "TABLEAU":
if ($entete) {
$worksheet->write_string((1+$debligne_excel),0,$msg["caddie_mess_edition_".$entete_bloc]);
$debligne_excel++ ;
$worksheet->write_string((1+$debligne_excel),0,$msg['caddie_action_marque']);
for($i=0; $i < $nbr_champs; $i++) {
// entête de colonnes
$fieldname = mysql_field_name($res, $i);
$worksheet->write_string((1+$debligne_excel),($i+1),$fieldname);
}
for($i=0; $i < $max_aut; $i++) {
$worksheet->write_string((1+$debligne_excel),($i*6+1+$nbr_champs),"aut_entree_$i");
$worksheet->write_string((1+$debligne_excel),($i*6+2+$nbr_champs),"aut_rejete_$i");
$worksheet->write_string((1+$debligne_excel),($i*6+3+$nbr_champs),"aut_dates_$i");
$worksheet->write_string((1+$debligne_excel),($i*6+4+$nbr_champs),"aut_fonction_$i");
$worksheet->write_string((1+$debligne_excel),($i*6+5+$nbr_champs),"aut_type_$i");
$worksheet->write_string((1+$debligne_excel),($i*6+6+$nbr_champs),"aut_resp_type_$i");
}
$worksheet->write_string((1+$debligne_excel),($max_aut*6+$nbr_champs+1),"DESCR");
for($i=0; $i < $max_perso; $i++) {
$perso = mysql_fetch_object($res_compte3) ;
$worksheet->write_string((1+$debligne_excel),($max_aut*6+$nbr_champs+2+$i),$perso->titre);
}
$debligne_excel++;
}
//Fonctions d'auteurs
$codes_auteurs = get_functions_authors();
for($i=0; $i < $nbr_lignes; $i++) {
$debligne_excel++;
$row = mysql_fetch_row($res);
$id_notice = $row[0] ;
if ($flag) $worksheet->write_string($debligne_excel,0,"X");
$j=0;
foreach($row as $dummykey=>$col) {
if(!$col) $col=" ";
$worksheet->write_string($debligne_excel,($j+1),$col);
$j++;
}
$rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
$rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
$rqt_aut .= "WHERE responsability_notice=$id_notice " ;
$rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
$res_aut = @mysql_query($rqt_aut);
for($iaut=0; $iaut < $max_aut; $iaut++) {
$aut = @mysql_fetch_row($res_aut);
$worksheet->write_string($debligne_excel,($iaut*6+1+$nbr_champs),$aut[0]);
$worksheet->write_string($debligne_excel,($iaut*6+2+$nbr_champs),$aut[1]);
$worksheet->write_string($debligne_excel,($iaut*6+3+$nbr_champs),$aut[2]);
$worksheet->write_string($debligne_excel,($iaut*6+4+$nbr_champs),$codes_auteurs[$aut[3]]);
if ($aut[4] == "70") $lib_type_aut = $msg[203];
else if ($aut[4] == "71") $lib_type_aut = $msg[204];
else if ($aut[4] == "72") $lib_type_aut = $msg["congres_libelle"];
else $lib_type_aut=$aut[4];
$worksheet->write_string($debligne_excel,($iaut*6+5+$nbr_champs),$lib_type_aut);
$lib_resp_type="";
if ($aut[0]) {
if ($aut[5] == 0) $lib_resp_type=$msg["export_main_author"];
else if ($aut[5] == 1) $lib_resp_type=$msg["export_other_author"];
else if ($aut[5] == 2) $lib_resp_type=$msg["export_secondary_author"];
}
$worksheet->write_string($debligne_excel,($iaut*6+6+$nbr_champs),$lib_resp_type);
}
$q = "drop table if exists catlg ";
$r = mysql_query($q, $dbh);
$q = "CREATE TEMPORARY TABLE catlg ENGINE=MyISAM as ";
$q.= "SELECT categories.num_noeud, categories.libelle_categorie ";
$q.= "FROM noeuds, categories, notices_categories ";
$q.= "WHERE notices_categories.notcateg_notice = '".$id_notice."' ";
$q.= "AND categories.langue = '".$lang."' ";
$q.= "AND categories.num_noeud = notices_categories.num_noeud " ;
$q.= "AND categories.num_noeud = noeuds.id_noeud ";
$q.= "ORDER BY ordre_categorie";
$r = mysql_query($q, $dbh) ;
$q = "DROP TABLE IF EXISTS catdef ";
$r = mysql_query($q, $dbh);
$q = "CREATE TEMPORARY TABLE catdef ( ";
$q.= "num_noeud int(9) unsigned not null default '0', ";
$q.= "num_thesaurus int(3) unsigned not null default '0', ";
$q.= "libelle_categorie text not null ) ENGINE=MyISAM ";
$r = mysql_query($q, $dbh);
$thes_list = thesaurus::getThesaurusList();
$q = '';
foreach($thes_list as $id_thesaurus=>$libelle_thesaurus) {
$thes = new thesaurus($id_thesaurus);
$q = "INSERT INTO catdef ";
$q.= "SELECT categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
$q.= "FROM noeuds, categories, notices_categories ";
$q.= "WHERE noeuds.num_thesaurus=$id_thesaurus and notices_categories.notcateg_notice = '".$id_notice."' ";
$q.= "AND categories.langue = '".$thes->langue_defaut."' ";
$q.= "AND categories.num_noeud = notices_categories.num_noeud " ;
$q.= "AND categories.num_noeud = noeuds.id_noeud ";
$q.= "ORDER BY ordre_categorie";
$r = mysql_query($q, $dbh);
}
$q = "select catdef.num_thesaurus as num_thesaurus, ";
$q.= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
$q.= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
if (!$thesaurus_mode_pmb)
$q.= "where catdef.num_thesaurus = '".$thesaurus_defaut."' ";
$res_desc = mysql_query($q, $dbh);
while ($desc = mysql_fetch_object($res_desc)) {
$lib_desc.=($lib_desc?$pmb_keyword_sep:"");
if ($thesaurus_mode_pmb) $lib_desc .= '['.thesaurus::getLibelle($desc->num_thesaurus).'] ';
$lib_desc .= $desc->libelle_categorie ;
}
$worksheet->write_string($debligne_excel,($max_aut*6+$nbr_champs+1),"$lib_desc");
$p_perso=new parametres_perso($libelle_caddie_type);
//Champs personalisés
if (!$p_perso->no_special_fields) {
$perso_=$p_perso->show_fields($id_notice);
for ($i=0; $iwrite_string($debligne_excel,($max_aut*6+$nbr_champs+2+$i),html_entity_decode($p["AFF"],ENT_QUOTES|ENT_COMPAT,"iso-8859-15"));
}
}
}
break;
case "TABLEAUHTML":
if ($entete) {
if ($etat_table) echo "\n
";
echo "".$msg["caddie_mess_edition_".$entete_bloc]."
";
echo "\n".$msg['caddie_action_marque']." | ";
for($i=0; $i < $nbr_champs; $i++) {
$fieldname = mysql_field_name($res, $i);
print("${fieldname} | ");
}
for($i=0; $i < $max_aut; $i++) {
print pmb_bidi("aut_entree_$i | ") ;
print pmb_bidi("aut_rejete_$i | ") ;
print pmb_bidi("aut_dates_$i | ") ;
print pmb_bidi("aut_fonction_$i | ") ;
print pmb_bidi("aut_type_$i | ") ;
print pmb_bidi("aut_resp_type_$i | ") ;
}
print "DESCR | " ;
for($i=0; $i < $max_perso; $i++) {
$perso = mysql_fetch_object($res_compte3) ;
print "".$perso->titre." | " ;
}
$etat_table = 1 ;
}
//Fonctions d'auteurs
$codes_auteurs = get_functions_authors();
for($i=0; $i < $nbr_lignes; $i++) {
$row = mysql_fetch_row($res);
$id_notice = $row[0] ;
echo "";
if ($flag) print "X | "; else print " | ";
foreach($row as $dummykey=>$col) {
if (is_numeric($col)){
$col = "'".$col ;
}
if(!$col) $col=" ";
print pmb_bidi("$col | ");
}
$rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
$rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
$rqt_aut .= "WHERE responsability_notice=$id_notice " ;
$rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
$res_aut = @mysql_query($rqt_aut, $dbh);
for($i=0; $i < $max_aut; $i++) {
$aut = @mysql_fetch_row($res_aut);
print pmb_bidi("$aut[0] | ") ;
print pmb_bidi("$aut[1] | ") ;
print pmb_bidi("$aut[2] | ") ;
print pmb_bidi("".$codes_auteurs[$aut[3]]." | ") ;
if ($aut[4] == "70") $lib_type_aut = $msg[203];
else if ($aut[4] == "71") $lib_type_aut = $msg[204];
else if ($aut[4] == "72") $lib_type_aut = $msg["congres_libelle"];
else $lib_type_aut=$aut[4];
print pmb_bidi("$lib_type_aut | ") ;
$lib_resp_type="";
if ($aut[0]) {
if ($aut[5] == 0) $lib_resp_type=$msg["export_main_author"];
else if ($aut[5] == 1) $lib_resp_type=$msg["export_other_author"];
else if ($aut[5] == 2) $lib_resp_type=$msg["export_secondary_author"];
}
print pmb_bidi("$lib_resp_type | ") ;
}
$q = "drop table if exists catlg ";
$r = mysql_query($q, $dbh);
$q = "create temporary table catlg ENGINE=MyISAM as ";
$q.= "select categories.num_noeud, categories.libelle_categorie ";
$q.= "from noeuds, categories, notices_categories ";
$q.= "where notices_categories.notcateg_notice = '".$id_notice."' ";
$q.= "and categories.langue = '".$lang."' ";
$q.= "and categories.num_noeud = notices_categories.num_noeud " ;
$q.= "and categories.num_noeud = noeuds.id_noeud ";
$q.= "ORDER BY ordre_categorie";
$r = mysql_query($q, $dbh) ;
$q = "drop table if exists catdef ";
$r = mysql_query($q, $dbh);
$q = "create temporary table catdef ( ";
$q.= "num_noeud int(9) unsigned not null default '0', ";
$q.= "num_thesaurus int(3) unsigned not null default '0', ";
$q.= "libelle_categorie text not null ";
$q.= ") ENGINE=MyISAM ";
$r = mysql_query($q, $dbh);
$thes_list = thesaurus::getThesaurusList();
$q = '';
foreach($thes_list as $id_thesaurus=>$libelle_thesaurus) {
$thes = new thesaurus($id_thesaurus);
$q = "insert into catdef ";
$q.= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
$q.= "from noeuds, categories, notices_categories ";
$q.= "where noeuds.num_thesaurus=$id_thesaurus and notices_categories.notcateg_notice = '".$id_notice."' ";
$q.= "and categories.langue = '".$thes->langue_defaut."' ";
$q.= "and categories.num_noeud = notices_categories.num_noeud " ;
$q.= "and categories.num_noeud = noeuds.id_noeud ";
$q.= "ORDER BY ordre_categorie";
$r = mysql_query($q, $dbh);
}
$q = "select catdef.num_thesaurus as num_thesaurus, ";
$q.= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
$q.= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
if (!$thesaurus_mode_pmb)
$q.= "where catdef.num_thesaurus = '".$thesaurus_defaut."' ";
$res_desc = mysql_query($q, $dbh);
while ($desc = mysql_fetch_object($res_desc)) {
$lib_desc.=($lib_desc?$pmb_keyword_sep:"");
if ($thesaurus_mode_pmb) $lib_desc .= '['.thesaurus::getLibelle($desc->num_thesaurus).'] ';
$lib_desc .= $desc->libelle_categorie ;
}
print pmb_bidi("$lib_desc | " );
$p_perso=new parametres_perso($libelle_caddie_type);
//Champs personalisés
if (!$p_perso->no_special_fields) {
$perso_=$p_perso->show_fields($id_notice);
for ($i=0; $i".$p["AFF"]."" ;
}
}
echo "
";
}
break;
default:
if ($entete) {
if ($etat_table) echo "\n
";
echo "".$msg["caddie_mess_edition_".$entete_bloc]."
";
echo "\n".$msg['caddie_action_marque']." | ";
for($i=0; $i < $nbr_champs; $i++) {
$fieldname = mysql_field_name($res, $i);
print("${fieldname} | ");
}
for($i=0; $i < $max_aut; $i++) {
print pmb_bidi("aut_entree_$i | ") ;
print pmb_bidi("aut_rejete_$i | ") ;
print pmb_bidi("aut_dates_$i | ") ;
print pmb_bidi("aut_fonction_$i | ") ;
print pmb_bidi("aut_type_$i | ") ;
print pmb_bidi("aut_resp_type_$i | ") ;
}
print "DESCR | " ;
for($i=0; $i < $max_perso; $i++) {
$perso = mysql_fetch_object($res_compte3) ;
print "".$perso->titre." | " ;
}
$etat_table = 1 ;
}
//Fonctions d'auteurs
$codes_auteurs = get_functions_authors();
$odd_even=0;
for($i=0; $i < $nbr_lignes; $i++) {
$row = mysql_fetch_row($res);
$id_notice = $row[0] ;
if ($odd_even==0) {
echo " ";
$odd_even=1;
} else if ($odd_even==1) {
echo "
";
$odd_even=0;
}
if ($flag) print "X | "; else print " | ";
foreach($row as $dummykey=>$col) {
if(!$col) $col=" ";
print pmb_bidi("$col | ");
}
$rqt_aut = "SELECT author_name, author_rejete, author_date, responsability_fonction, author_type, responsability_type ";
$rqt_aut .= "FROM responsability JOIN authors ON responsability_author=author_id ";
$rqt_aut .= "WHERE responsability_notice=$id_notice " ;
$rqt_aut .= "ORDER BY responsability_type ASC, responsability_ordre ASC";
$res_aut = @mysql_query($rqt_aut, $dbh);
for($i=0; $i < $max_aut; $i++) {
$aut = @mysql_fetch_row($res_aut);
print pmb_bidi("$aut[0] | ") ;
print pmb_bidi("$aut[1] | ") ;
print pmb_bidi("$aut[2] | ") ;
print pmb_bidi("".$codes_auteurs[$aut[3]]." | ") ;
if ($aut[4] == "70") $lib_type_aut = $msg[203];
else if ($aut[4] == "71") $lib_type_aut = $msg[204];
else if ($aut[4] == "72") $lib_type_aut = $msg["congres_libelle"];
else $lib_type_aut=$aut[4];
print pmb_bidi("$lib_type_aut | ") ;
$lib_resp_type="";
if ($aut[0]) {
if ($aut[5] == 0) $lib_resp_type=$msg["export_main_author"];
else if ($aut[5] == 1) $lib_resp_type=$msg["export_other_author"];
else if ($aut[5] == 2) $lib_resp_type=$msg["export_secondary_author"];
}
print pmb_bidi("$lib_resp_type | ") ;
}
$q = "drop table if exists catlg ";
$r = mysql_query($q, $dbh);
$q = "create temporary table catlg ENGINE=MyISAM as ";
$q.= "select categories.num_noeud, categories.libelle_categorie ";
$q.= "from noeuds, categories, notices_categories ";
$q.= "where notices_categories.notcateg_notice = '".$id_notice."' ";
$q.= "and categories.langue = '".$lang."' ";
$q.= "and categories.num_noeud = notices_categories.num_noeud " ;
$q.= "and categories.num_noeud = noeuds.id_noeud ";
$q.= "ORDER BY ordre_categorie";
$r = mysql_query($q, $dbh) ;
$q = "drop table if exists catdef ";
$r = mysql_query($q, $dbh);
$q = "create temporary table catdef ( ";
$q.= "num_noeud int(9) unsigned not null default '0', ";
$q.= "num_thesaurus int(3) unsigned not null default '0', ";
$q.= "libelle_categorie text not null ";
$q.= ") ENGINE=MyISAM ";
$r = mysql_query($q, $dbh);
$thes_list = thesaurus::getThesaurusList();
$q = '';
foreach($thes_list as $id_thesaurus=>$libelle_thesaurus) {
$thes = new thesaurus($id_thesaurus);
$q = "insert into catdef ";
$q.= "select categories.num_noeud, noeuds.num_thesaurus, categories.libelle_categorie ";
$q.= "from noeuds, categories, notices_categories ";
$q.= "where noeuds.num_thesaurus=$id_thesaurus and notices_categories.notcateg_notice = '".$id_notice."' ";
$q.= "and categories.langue = '".$thes->langue_defaut."' ";
$q.= "and categories.num_noeud = notices_categories.num_noeud " ;
$q.= "and categories.num_noeud = noeuds.id_noeud ";
$q.= "ORDER BY ordre_categorie";
$r = mysql_query($q, $dbh);
}
$q = "select catdef.num_thesaurus as num_thesaurus, ";
$q.= "if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie) as libelle_categorie ";
$q.= "from catdef left join catlg on catdef.num_noeud = catlg.num_noeud ";
if (!$thesaurus_mode_pmb)
$q.= "where catdef.num_thesaurus = '".$thesaurus_defaut."' ";
$res_desc = mysql_query($q, $dbh);
while ($desc = mysql_fetch_object($res_desc)) {
$lib_desc.=($lib_desc?$pmb_keyword_sep:"");
if ($thesaurus_mode_pmb) $lib_desc .= '['.thesaurus::getLibelle($desc->num_thesaurus).'] ';
$lib_desc .= $desc->libelle_categorie ;
}
print pmb_bidi("$lib_desc | ") ;
$p_perso=new parametres_perso($libelle_caddie_type);
//Champs personalisés
if (!$p_perso->no_special_fields) {
$perso_=$p_perso->show_fields($id_notice);
for ($i=0; $i".$p["AFF"]."" ;
}
}
echo "
";
}
break;
} // fin switch
} // fin if nbr_lignes
} // fin fonction extrait_info_notice
function extrait_blob ($blob="", $entete=1, $flag="") {
global $dbh ;
global $dest ;
global $worksheet ;
global $entete_bloc;
global $msg;
global $debligne_excel;
global $etat_table ; // permet de savoir si les tag table sont ouverts ou fermés
if (!$debligne_excel) $debligne_excel = 0 ;
switch($dest) {
case "TABLEAU":
if ($entete) {
$worksheet->write_string((1+$debligne_excel),0,$msg["caddie_mess_edition_".$entete_bloc]);
$debligne_excel++ ;
}
if ($flag) $worksheet->write_string((1+$debligne_excel),0,"X");
$worksheet->write_string((1+$debligne_excel),1,$blob);
$debligne_excel++ ;
break;
case "TABLEAUHTML":
default:
if ($etat_table) echo "\n
";
if ($entete) echo "".$msg["caddie_mess_edition_".$entete_bloc]."
";
if ($flag) print "X "; else " ";
print pmb_bidi("$blob
");
break;
} // fin switch
} // fin fonction extrait_info
function get_functions_authors() {
global $include_path;
global $lang;
if (file_exists($include_path."/marc_tables/".$lang."/function.xml")) {
$file_name=$include_path."/marc_tables/".$lang."/function.xml";
} else if (file_exists($include_path."/marc_tables/fr_FR/function.xml")) {
$file_name=$include_path."/marc_tables/fr_FR/function.xml";
}
if ($file_name) {
$xmllist=new XMLlist($file_name);
$xmllist->analyser();
$codes_auteurs=$xmllist->table;
return $codes_auteurs;
} else return array();
} // fin fonction get_functions_authors