".mysql_error($dbh));
if(mysql_num_rows($result)) {
while ($temp = mysql_fetch_object($result))
$liste[] = array('object_id' => $temp->object_id, 'flag' => $temp->flag ) ;
} else return;
switch($dest) {
case "TABLEAU":
break;
case "TABLEAUHTML":
default:
echo pmb_bidi("
".$msg['panier_num']." $idcaddie / ".$myCart->name."
");
echo pmb_bidi($myCart->comment."
");
break;
}
// calcul du nombre max de colonnes pour les champs perso
$rqt_compte1 = "select idchamp, titre from empr_custom order by ordre " ;
$res_compte1 = mysql_query($rqt_compte1, $dbh) ;
$max_perso = mysql_num_rows($res_compte1) ;
// boucle de parcours des exemplaires trouvés
$entete=0;
while(list($cle, $empr) = each($liste)) {
$rqt_tout = "select id_empr,empr_cb,empr_nom,empr_prenom,empr_adr1,empr_adr2,empr_cp,empr_ville,empr_pays,empr_mail,empr_tel1,empr_tel2,empr_prof,empr_year,";
$rqt_tout .=" empr_categ.libelle as categ,";
$rqt_tout .=" empr_codestat.libelle as code_stat,statut_libelle,location_libelle,type_abt_libelle,";
$rqt_tout .=" empr_creation,empr_modif,empr_sexe,empr_login,empr_date_adhesion,empr_date_expiration,empr_msg,empr_lang,empr_ldap,last_loan_date,date_fin_blocage,total_loans";
$rqt_tout .=" from empr left join type_abts on id_type_abt=type_abt, empr_categ, empr_codestat, empr_statut, docs_location";
$rqt_tout .=" where id_empr='".$empr[object_id]."' and empr_categ=id_categ_empr and empr_codestat=idcode and empr_statut=idstatut and empr_location=idlocation";
if (!$entete) {
extrait_info_empr($rqt_tout, 1, $empr[flag]);
$entete=1;
} else extrait_info_empr($rqt_tout, 0, $empr[flag]);
} // fin de liste
return;
}
function extrait_info_empr ($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_perso;
global $res_compte1 ;
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) {
$worksheet->write_string((1+$debligne_excel),($nbr_champs+1),"DESCR");
for($i=0; $i < $max_perso; $i++) {
$perso = mysql_fetch_object($res_compte1) ;
$worksheet->write_string((1+$debligne_excel),($nbr_champs+2+$i),$perso->titre);
}
}
if ($entete) $debligne_excel++ ;
for($i=0; $i < $nbr_lignes; $i++) {
$debligne_excel++;
$row = mysql_fetch_row($res);
$id_notice = $row[0] ;
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++;
}
$p_perso=new parametres_perso("empr");
//Champs personalisés
if (!$p_perso->no_special_fields) {
$perso_=$p_perso->show_fields($id_notice);
for ($i=0; $iwrite_string($debligne_excel,($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']." | ";
$etat_table = 1 ;
for($i=0; $i < $nbr_champs; $i++) {
$fieldname = mysql_field_name($res, $i);
print("${fieldname} | ");
}
print "DESCR | " ;
for($i=0; $i < $max_perso; $i++) {
$perso = mysql_fetch_object($res_compte1) ;
print "".$perso->titre." | " ;
}
}
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 | ");
}
print " | " ;
$p_perso=new parametres_perso("empr");
//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']." | ";
$etat_table = 1 ;
for($i=0; $i < $nbr_champs; $i++) {
$fieldname = mysql_field_name($res, $i);
print("${fieldname} | ");
}
print "DESCR | " ;
for($i=0; $i < $max_perso; $i++) {
$perso = mysql_fetch_object($res_compte1) ;
print "".$perso->titre." | " ;
}
}
$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 | ");
}
print " | " ;
$p_perso=new parametres_perso("empr");
//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