"),ENT_QUOTES, $charset)."";
$retour_aff .= $desc_explnum;
$retour_aff .= "" ;
}
}
return $retour_aff;
}
private function aff_external_notices_list($notices_list){
global $charset;
$retour_aff="";
foreach($notices_list as $notice_id){
$req = "select source_id from external_count where rid = $notice_id";
$res = @pmb_mysql_query($req);
if(0 < pmb_mysql_num_rows($res)){
$notice = new notice_affichage_unimarc($notice_id, []);
$notice->do_isbd(0,0);
$notice->do_header();
$retour_aff .= "-
".htmlspecialchars (strip_tags($notice->notice_header),ENT_QUOTES, $charset)."
".htmlspecialchars ($notice->year,ENT_QUOTES, $charset)."
".htmlspecialchars ($notice->notice->lien,ENT_QUOTES, $charset)."" ;
$image = $this->do_image($notice->notice->code,'',$notice->notice->tit1) ;
$desc=$notice->notice_isbd;
$desc = str_replace("
"," ",$desc);
$retour_aff .= " ".htmlspecialchars(strip_tags($image.$desc," "),ENT_QUOTES, $charset)."";
$retour_aff .= "" ;
}
}
return $retour_aff;
}
private function sort_external_notices_list($notices_list){
$notices_tab = array();
$i = 0;
foreach($notices_list as $notice_id){
$req = "select source_id from external_count where rid = $notice_id";
$res = @pmb_mysql_query($req);
if($r=pmb_mysql_fetch_object($res)){
$query = "SELECT date_import FROM entrepot_source_$r->source_id WHERE recid = $notice_id";
$result = pmb_mysql_query($query);
$resp = pmb_mysql_fetch_object($result);
$notices_tab[$i] = [
"id" => $notice_id,
"date_import" => $resp->date_import,
];
$i++;
}
}
//On tri
usort($notices_tab, array("records_flux", "sort_external_records"));
//On réajoute au tableau les ids triés
$notices_list = array();
foreach($notices_tab as $not){
$notices_list[] = $not['id'];
}
return ($notices_list);
}
private static function sort_external_records($a,$b){
if ($a['date_import'] == $b['date_import']) {
return 0;
}
return ($a['date_import'] < $b['date_import']) ? 1 : -1;
}
public function set_limit($limit){
$limit += 0;
$this->limit = $limit;
}
private function do_image($code,$vigurl="",$tit1="") {
global $charset;
global $opac_show_book_pics ;
global $opac_book_pics_url ;
global $opac_book_pics_msg ;
global $opac_url_base ;
global $msg;
$image = "";
if ($code<>"" || $vigurl<>"") {
if ($opac_show_book_pics=='1' && ($opac_book_pics_url || $vigurl)) {
$url_image_ok=getimage_url($code, $vigurl);
$title_image_ok = "";
if(!$vigurl) {
$title_image_ok = htmlentities($opac_book_pics_msg, ENT_QUOTES, $charset);
}
if(!trim($title_image_ok)){
$title_image_ok = htmlentities($tit1, ENT_QUOTES, $charset);
}
$image = "";
}
}
return $image ;
}
// fonction retournant les infos d'exemplaires numeriques pour une notice
private function do_explnum($no_notice, $niveau_biblio="m") {
global $dbh;
global $charset;
global $opac_url_base ;
if (!$no_notice) return "";
if (!$charset) $charset='ISO-8859-1';
create_tableau_mimetype() ;
// recuperation du nombre d'exemplaires
$requete = "SELECT explnum_id, explnum_notice, explnum_nom, explnum_mimetype, explnum_url, length(explnum_data) as taille ";
$requete .= "FROM explnum JOIN explnum_statut on explnum_statut.id_explnum_statut = explnum.explnum_docnum_statut ";
if($niveau_biblio != "b"){
$requete .= "JOIN notices ON explnum.explnum_notice=notice_id AND explnum.explnum_bulletin=0 ";
$requete .= "JOIN notice_statut ON notices.statut=notice_statut.id_notice_statut ";
$requete .= "WHERE explnum.explnum_notice='".$no_notice."' ";
}else{//Pour les notices de bulletin
$requete .= "JOIN bulletins ON explnum.explnum_bulletin=bulletins.bulletin_id AND explnum.explnum_notice=0 ";
$requete .= "JOIN notices ON bulletins.num_notice=notices.notice_id ";
$requete .= "JOIN notice_statut ON notices.statut=notice_statut.id_notice_statut ";
$requete .= "WHERE bulletins.num_notice='".$no_notice."' ";
}
$requete .= "AND explnum_statut.explnum_visible_opac=1 and explnum_statut.explnum_visible_opac_abon=0 ";
$requete .= "AND notice_statut.explnum_visible_opac=1 and notice_statut.explnum_visible_opac_abon=0 ";
$requete .= "ORDER BY explnum_mimetype, explnum_id";
$res = pmb_mysql_query($requete, $dbh);
$retour = "";
while (($expl = pmb_mysql_fetch_object($res))) {
$url=htmlspecialchars ($opac_url_base."doc_num.php?explnum_id=".$expl->explnum_id,ENT_QUOTES, $charset) ;
$mime=htmlspecialchars ($expl->explnum_mimetype,ENT_QUOTES, $charset) ;
$retour .= "taille."\" />";
}
return $retour;
}
} # fin de definition
|
|