";
}
$dsi_flux_form = str_replace('!!paniers!!', $paniers, $dsi_flux_form);
$rqt="select id_bannette as id_obj, nom_bannette as name_obj from bannettes where proprio_bannette=0 order by nom_bannette ";
$result = mysql_query($rqt, $dbh) or die ($rqt." in rss_flux.class.php : ".mysql_error());
$bannettes = "";
while (($contenant = mysql_fetch_object($result))) {
if (array_search($contenant->id_obj,$this->num_bannettes)!==false) $checked="checked" ;
else $checked="" ;
$bannettes .= "
";
}
$dsi_flux_form = str_replace('!!bannettes!!', $bannettes, $dsi_flux_form);
$dsi_flux_form = str_replace('!!delete!!', $button_delete, $dsi_flux_form);
// afin de revenir oł on etait : $form_cb, le critere de recherche
global $form_cb ;
$dsi_flux_form = str_replace('!!form_cb!!', $form_cb, $dsi_flux_form);
print $dsi_flux_form;
}
// ---------------------------------------------------------------
// delete() : suppression
// ---------------------------------------------------------------
function delete() {
global $dbh;
global $msg;
if (!$this->id_rss_flux) return $msg[dsi_flux_no_access]; // impossible d'acceder
$requete = "delete from rss_flux_content WHERE num_rss_flux='$this->id_rss_flux'";
mysql_query($requete, $dbh);
$requete = "delete from rss_flux WHERE id_rss_flux='$this->id_rss_flux'";
mysql_query($requete, $dbh);
}
// ---------------------------------------------------------------
// update
// ---------------------------------------------------------------
function update($temp) {
global $dbh;
if ($this->id_rss_flux) {
// update
$req = "UPDATE rss_flux set ";
$clause = " WHERE id_rss_flux='".$this->id_rss_flux."' ";
} else {
$req = "insert into rss_flux set ";
$clause = "";
}
$req .= "id_rss_flux ='".$temp->id_rss_flux ."', " ;
$req .= "nom_rss_flux ='".$temp->nom_rss_flux ."', " ;
$req .= "link_rss_flux ='".$temp->link_rss_flux ."', " ;
$req .= "descr_rss_flux ='".$temp->descr_rss_flux ."', " ;
$req .= "lang_rss_flux ='".$temp->lang_rss_flux ."', " ;
$req .= "copy_rss_flux ='".$temp->copy_rss_flux ."', " ;
$req .= "editor_rss_flux ='".$temp->editor_rss_flux ."', " ;
$req .= "webmaster_rss_flux='".$temp->webmaster_rss_flux ."', " ;
$req .= "ttl_rss_flux ='".$temp->ttl_rss_flux ."', " ;
$req .= "img_url_rss_flux ='".$temp->img_url_rss_flux ."', " ;
$req .= "img_title_rss_flux='".$temp->img_title_rss_flux ."', " ;
$req .= "img_link_rss_flux ='".$temp->img_link_rss_flux ."', " ;
$req .= "export_court_flux ='".$temp->export_court_flux ."', " ;
$req .= "tpl_rss_flux ='".$temp->tpl_rss_flux ."', " ;
$req .= "format_flux ='".$temp->format_flux ."' " ;
$req.=$clause ;
$res = mysql_query($req, $dbh) or die ($req) ;
if (!$this->id_rss_flux) $this->id_rss_flux = mysql_insert_id() ;
if (!$this->id_rss_flux) die ("Pb grave pendant l'enregistrement du flux");
mysql_query("delete from rss_flux_content where num_rss_flux='$this->id_rss_flux' " ) ;
for ($i=0;$inum_paniers);$i++) {
mysql_query("insert into rss_flux_content set num_rss_flux='$this->id_rss_flux', type_contenant='CAD', num_contenant='".$temp->num_paniers[$i]."' " ) ;
}
for ($i=0;$inum_bannettes);$i++) {
mysql_query("insert into rss_flux_content set num_rss_flux='$this->id_rss_flux', type_contenant='BAN', num_contenant='".$temp->num_bannettes[$i]."' " ) ;
}
}
// ---------------------------------------------------------------
// compte_elements() : methode pour pouvoir recompter en dehors !
// ---------------------------------------------------------------
function compte_elements() {
global $dbh ;
$this->nb_paniers=0;
$this->nb_bannettes=0;
$this->num_paniers=array();
$this->num_bannettes=array();
$req_nb = "SELECT num_contenant from rss_flux_content WHERE num_rss_flux='".$this->id_rss_flux."' and type_contenant='CAD' " ;
$res_nb = mysql_query($req_nb, $dbh) or die ($req_nb." in rss_flux.class.php : ".mysql_error());
while (($res = mysql_fetch_object($res_nb))) {
$this->num_paniers[]=$res->num_contenant ;
$this->nb_paniers++ ;
}
$req_nb = "SELECT num_contenant from rss_flux_content WHERE num_rss_flux='".$this->id_rss_flux."' and type_contenant='BAN' " ;
$res_nb = mysql_query($req_nb, $dbh) or die ($req_nb." in rss_flux.class.php : ".mysql_error());
while ($res = mysql_fetch_object($res_nb)) {
$this->num_bannettes[]=$res->num_contenant ;
$this->nb_bannettes++ ;
}
}
// ---------------------------------------------------------------
// generation du fichier XML
// ---------------------------------------------------------------
function xmlfile() {
global $pmb_bdd_version, $charset ;
if (!$charset) $charset='ISO-8859-1';
if (!$this->id_rss_flux) die();
$this->envoi="
".htmlspecialchars ($this->nom_rss_flux,ENT_QUOTES, $charset)."
".htmlspecialchars ($this->link_rss_flux,ENT_QUOTES, $charset)."
".htmlspecialchars ($this->descr_rss_flux,ENT_QUOTES, $charset)."".htmlspecialchars ($this->lang_rss_flux,ENT_QUOTES, $charset)."".htmlspecialchars ($this->copy_rss_flux,ENT_QUOTES, $charset)."".addslashes(date("D, d M Y H:i:s O"))."http://backend.userland.com/rssPMB Version ".$pmb_bdd_version."".htmlspecialchars ($this->editor_rss_flux,ENT_QUOTES, $charset)."".htmlspecialchars ($this->webmaster_rss_flux,ENT_QUOTES, $charset)."".$this->ttl_rss_flux."";
if ($this->img_url_rss_flux) {
$this->envoi.="
".htmlspecialchars ($this->img_url_rss_flux,ENT_QUOTES, $charset)."".htmlspecialchars ($this->img_title_rss_flux,ENT_QUOTES, $charset)."
".htmlspecialchars ($this->img_link_rss_flux,ENT_QUOTES, $charset)."
" ;
}
$this->envoi.="
!!items!!
";
}
// ---------------------------------------------------------------
// stocke_cache($cache) : stockage du flux en cache pour eviter de le recalculer a chaque appel
// ---------------------------------------------------------------
function stocke_cache() {
global $dbh;
global $msg;
if (!$this->id_rss_flux) return $msg[dsi_flux_no_access]; // impossible d'acceder
$requete = "update rss_flux set rss_flux_content='".addslashes($this->contenu_du_flux)."', rss_flux_last=sysdate() WHERE id_rss_flux='$this->id_rss_flux'";
mysql_query($requete, $dbh);
}
// ---------------------------------------------------------------
// id des notices concernees, attention, on n'envoie que les publiques (statuts de notices)
// ---------------------------------------------------------------
function items_notices() {
global $dbh, $liens_opac ;
global $charset;
global $opac_flux_rss_notices_order ;
global $opac_notice_affichage_class;
if (!$this->nb_bannettes && !$this->nb_paniers) {
$this->notices = "";
return;
}
if (!$opac_flux_rss_notices_order) $opac_flux_rss_notices_order="index_serie, tnvol, index_sew";
if (!$charset) $charset='ISO-8859-1';
if ($this->nb_bannettes) {
$rqt[] = "select distinct notice_id, index_sew, create_date, update_date, index_serie, tnvol
from notices join bannette_contenu on num_notice=notice_id
join notice_statut on statut=id_notice_statut
where notice_visible_opac=1 and notice_visible_opac_abon=0 and num_bannette in (".implode(",",$this->num_bannettes).") ";
}
if ($this->nb_paniers) {
$rqt[] = "select distinct notice_id, index_sew, create_date, update_date, index_serie, tnvol
from notices join caddie_content on object_id=notice_id
join notice_statut on statut=id_notice_statut
where notice_visible_opac=1 and notice_visible_opac_abon=0 and caddie_id in (".implode(",",$this->num_paniers).") ";
}
$rqtfinale = implode(' union ',$rqt) ;
mysql_query ("create temporary table tmpfluxrss ENGINE=MyISAM $rqtfinale ",$dbh); // Thu, 27 Apr 2006 23:40:11 +0100
$query_not = "select distinct notice_id, index_sew, DATE_FORMAT(create_date,'%a, %e %b %Y %T +0100') as pubdate from tmpfluxrss order by $opac_flux_rss_notices_order" ;
$res = mysql_query ($query_not,$dbh);
while (($tmp=mysql_fetch_object($res))) {
if($opac_notice_affichage_class != ""){
$notice = new $opac_notice_affichage_class($tmp->notice_id, $liens_opac, "", 1);
}else $notice = new notice_affichage($tmp->notice_id, $liens_opac, "", 1);
$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 ($tmp->pubdate,ENT_QUOTES, $charset)."
".htmlspecialchars (str_replace("!!id!!", $tmp->notice_id, $liens_opac['lien_rech_notice']),ENT_QUOTES, $charset)."" ;
$desc='';
$desc_explnum='';
if ($this->export_court_flux) {
$notice->do_isbd(1,0);
$desc=$notice->notice_isbd;
}elseif($this->tpl_rss_flux){
$noti_tpl=new notice_tpl_gen($this->tpl_rss_flux);
$desc.=$noti_tpl->build_notice($tmp->notice_id,$deflt2docs_location);
}else{
switch ($this->format_flux) {
case 'TITLE' :
$desc='';
break;
case 'ABSTRACT' :
$desc=$notice->notice->n_resume.' ';
break;
case 'ISBD' :
default :
$notice->do_isbd(0,0);
$desc=$notice->notice_isbd;
$desc_explnum=$this->do_explnum($tmp->notice_id);
}
}
if(!$this->tpl_rss_flux){
$image = $this->do_image($notice->notice->code,$notice->notice->thumbnail_url) ;
$desc = str_replace(" "," ",$desc);
$retour_aff .= " ".htmlspecialchars(strip_tags($image.$desc,"
"),ENT_QUOTES, $charset)."";
$retour_aff .= $desc_explnum;
}else{
$retour_aff .= " ".htmlspecialchars($desc,ENT_QUOTES, $charset)."";
}
$retour_aff .= "" ;
}
$this->notices = $retour_aff ;
}
function do_image($code,$vigurl="") {
global $charset;
global $opac_show_book_pics ;
global $opac_book_pics_url ;
global $opac_book_pics_msg ;
global $opac_url_base ;
if ($code<>"" || $vigurl<>"") {
if ($opac_show_book_pics=='1' && ($opac_book_pics_url || $vigurl)) {
$code_chiffre = pmb_preg_replace('/-|\.| /', '', $code);
$url_image = $opac_book_pics_url ;
$url_image = $opac_url_base."getimage.php?url_image=".urlencode($url_image)."¬icecode=!!noticecode!!&vigurl=".urlencode($vigurl) ;
$url_image_ok = str_replace("!!noticecode!!", $code_chiffre, $url_image) ;
if ($vigurl) {
$title_image_ok = "";
} else {
$title_image_ok = htmlentities($opac_book_pics_msg, ENT_QUOTES, $charset);
}
$image = "";
} else $image="" ;
} else $image="" ;
return $image ;
}
// fonction retournant les infos d'exemplaires numeriques pour une notice
function do_explnum($no_notice) {
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 notices on explnum_notice=notice_id join notice_statut on statut=id_notice_statut ";
$requete .= "WHERE explnum_notice='$no_notice' and explnum_visible_opac=1 and explnum_visible_opac_abon=0 ";
$requete .= "ORDER BY explnum_mimetype, explnum_id ";
$res = mysql_query($requete, $dbh);
$retour = "";
while (($expl = 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