getRecords(); $this->title = $msg["newrecord_rss_flux_name"]; } public function getRecords() { global $dbh; $this->notices_list=array(); $req = "SELECT notice_id FROM notices WHERE notice_is_new=1 ORDER by notice_date_is_new"; $res = pmb_mysql_query($req,$dbh); if (pmb_mysql_num_rows($res)) { while($r=pmb_mysql_fetch_object($res)){ $this->notices_list[] = $r->notice_id; } } if(!count($this->notices_list)) return array(); $filter=new filter_results($this->notices_list); $this->notices_list=$filter->get_array_results(); return $this->notices_list; } public function setRecords($notices_list) { global $dbh; $this->notices_list=array(); if(!count($notices_list)){ return array(); } $req = "SELECT notice_id FROM notices WHERE notice_is_new=1 and notice_id in (".implode(",", $notices_list).") ORDER by notice_date_is_new"; $res = pmb_mysql_query($req,$dbh); if (pmb_mysql_num_rows($res)) { while($r=pmb_mysql_fetch_object($res)){ $this->notices_list[]= $r->notice_id; } } if(!count($this->notices_list)) return array(); $filter=new filter_results($this->notices_list); $this->notices_list=$filter->get_array_results(); return $this->notices_list; } public function setTitle($title) { $this->title=$title; } public function setDescription($description) { $this->description=$description; } public function setCopyright($copyright) { $this->copyright=$copyright; } public function setLanguage($language) { $this->language=$language; } public function setManagingEditor($managingEditor) { $this->managingEditor=$managingEditor; } public function setWebMaster($webMaster) { $this->webMaster=$webMaster; } public function setLink($link) { $this->link=$link; } public function setImageUrl($url) { $this->imageUrl=$url; } public function setImageTitle($title) { $this->imageTitle=$title; } public function setImageLink($link) { $this->imageLink=$link; } public function setRssRecordsFormat($rssRecordsFormat) { $this->rssRecordsFormat=$rssRecordsFormat; } public function setIdTpl($idTpl) { $this->idTpl=$idTpl; } // --------------------------------------------------------------- // generation du fichier XML // --------------------------------------------------------------- public function xmlfile() { global $pmb_bdd_version, $charset, $msg; if (!$charset) $charset='ISO-8859-1'; $this->envoi=" ".htmlspecialchars ($this->title,ENT_QUOTES, $charset)." ".htmlspecialchars ($this->link,ENT_QUOTES, $charset)." ".htmlspecialchars ($this->description,ENT_QUOTES, $charset)." ".htmlspecialchars ($this->language,ENT_QUOTES, $charset)." ".htmlspecialchars ($this->copyright,ENT_QUOTES, $charset)." ".addslashes(date("D, d M Y H:i:s O"))." http://backend.userland.com/rss PMB Version ".$pmb_bdd_version." ".htmlspecialchars ($this->managingEditor,ENT_QUOTES, $charset)." ".htmlspecialchars ($this->webMaster,ENT_QUOTES, $charset)." ".$this->ttl_rss_flux.""; if ($this->img_url_rss_flux) { $this->envoi.=" ".htmlspecialchars ($this->imageUrl,ENT_QUOTES, $charset)." ".htmlspecialchars ($this->imageTitle,ENT_QUOTES, $charset)." ".htmlspecialchars ($this->imageLink,ENT_QUOTES, $charset)." " ; } $this->envoi.=$this->aff_notices_list($this->notices_list)." "; if($charset=='utf-8') { $this->envoi = preg_replace('/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'. '|[\x00-\x7F][\x80-\xBF]+'. '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'. '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'. '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/', '', $this->envoi ); } else { $this->envoi = preg_replace('/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]/', '', $this->envoi ); } return $this->envoi; } private function aff_notices_list($notices_list){ global $dbh,$charset,$opac_url_base ; global $opac_notice_affichage_class; global $opac_short_url_rss_records_format; $retour_aff=""; $this->rssRecordsFormat = substr($opac_short_url_rss_records_format,0,1); foreach($notices_list as $notice_id){ $req = "select notice_id, notice_date_is_new, niveau_biblio from notices where notice_id = $notice_id"; $res = @pmb_mysql_query($req,$dbh); if($r=pmb_mysql_fetch_object($res)){ if($opac_notice_affichage_class != ""){ $notice = new $opac_notice_affichage_class($r->notice_id, "", "", 1, 0, 0, 1, true); }else $notice = new notice_affichage($r->notice_id, "", "", 1, 0, 0, 1, true); $notice->visu_expl = 0 ; $notice->visu_explnum = 0 ; $notice->do_header_without_html(); $retour_aff .= " ".htmlspecialchars ($notice->notice_header_without_html,ENT_QUOTES, $charset)." ".htmlspecialchars ($r->notice_date_is_new,ENT_QUOTES, $charset)." ".htmlspecialchars ($opac_url_base."index.php?lvl=notice_display&id=".$r->notice_id,ENT_QUOTES, $charset)."" ; switch ($this->rssRecordsFormat) { case 'H': //Template de notices $image = ''; if(!$this->idTpl) $this->idTpl=substr($opac_short_url_rss_records_format,2); if($this->idTpl){ $tpl = notice_tpl_gen::get_instance($this->idTpl); $desc = $tpl->build_notice($r->notice_id); } break; case '9': //Templates Django de notices break; case '1': default: $image = $this->do_image($notice->notice->code,$notice->notice->thumbnail_url,$notice->notice->tit1) ; $notice->do_isbd(0,0); $desc=$notice->notice_isbd; break; } $desc_explnum=$this->do_explnum($notice->notice_id, $r->niveau_biblio); $desc = str_replace("
","
",$desc); $retour_aff .= " ".htmlspecialchars(strip_tags($image.$desc,"

"),ENT_QUOTES, $charset).""; $retour_aff .= $desc_explnum; $retour_aff .= "" ; } } return $retour_aff; } 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 = "".$msg["opac_notice_vignette_alt"].""; } } 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