id){
$opac_view_class->set_parameters();
$opac_view_filter_class=$opac_view_class->opac_filters;
$_SESSION["opac_view"]=$opac_view_class->id;
if(!$opac_view_class->opac_view_wo_query) {
$_SESSION['opac_view_query']=1;
}
}else{
$_SESSION["opac_view"]=0;
}
$css=$_SESSION["css"]=$opac_default_style;
}
}
?>
notice_id,$cart_);
if (($as===null)||($as===false)) {
$cart_[]=$r->notice_id;
$n++;
} else $na++;
}
}
$message=sprintf($msg["cart_add_notices"],$n,$nbtotal);
if ($na) $message.=", ".sprintf($msg["cart_already_in"],$na);
if (count($cart_)==$opac_max_cart_items) $message.=", ".$msg["cart_full"];
return $message;
}
function add_notices_to_cart($notices){
global $cart_;
global $opac_max_cart_items;
global $msg;
$n=0; $na=0;
$tab_notices = explode(",",$notices);
$nbtotal=count($tab_notices);
for($i=0 ; $i
";
$cart_=$_SESSION["cart"];
if (!count($cart_)) $cart_=array();
$id=stripslashes($id);// attention id peut etre du type es123 (recherche externe)
$location+=0;
if (($id)&&(!$lvl)) {
if (count($cart_)<$opac_max_cart_items) {
$as=array_search($id,$cart_);
$notice_header=htmlentities(substr(strip_tags(stripslashes(html_entity_decode($header,ENT_QUOTES))),0,45),ENT_QUOTES,$charset);
if ($notice_header!=$header) $notice_header.="...";
if (($as!==null)&&($as!==false)) {
$message=sprintf($msg["cart_notice_exists"],$notice_header);
} else {
$cart_[]=$id;
$message=sprintf($msg["cart_notice_add"],$notice_header);
}
} else {
$message=$msg["cart_full"];
}
} else if ($lvl) {
switch ($lvl) {
case "more_results":
//changement de plan !
switch ($mode) {
case "tous" :
$searcher = new searcher_all_fields(stripslashes($user_query));
$notices = $searcher->get_result();
add_notices_to_cart($notices);
break;
case "title":
case "titre":
$searcher = new searcher_title(stripslashes($user_query));
$notices = $searcher->get_result();
add_notices_to_cart($notices);
break;
case "keyword":
$searcher = new searcher_keywords(stripslashes($user_query));
$notices = $searcher->get_result();
add_notices_to_cart($notices);
break;
case "abstract":
$searcher = new searcher_abstract(stripslashes($user_query));
$notices = $searcher->get_result();
add_notices_to_cart($notices);
break;
case "extended":
$es=new search();
$table=$es->make_search();
$notices = '';
$q="select distinct notice_id from $table ";
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notice_id;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "external":
if ($_SESSION["external_type"]=="multi") $es=new search("search_fields_unimarc"); else $es=new search("search_simple_fields_unimarc");
$table=$es->make_search();
$requete="select concat('es', notice_id) as notice_id from $table where 1;";
$message=add_query($requete);
break;
case 'docnum' :
$notices = '';
//droits d'acces emprunteur/notice
$acces_j='';
if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) {
require_once("$class_path/acces.class.php");
$ac= new acces();
$dom_2= $ac->setDomain(2);
$acces_j= $dom_2->getJoin($_SESSION['id_empr_session'],4,'notice_id');
}
if ($acces_j) {
$statut_j='';
} else {
$statut_j=',notice_statut';
}
$q_noti = "select notice_id from explnum, notices $statut_j $acces_j ".stripslashes($clause).' ';
$q_bull = "select notice_id from bulletins, explnum, notices $statut_j $acces_j ".stripslashes($clause_bull).' ';
$q_bull_num_notice = "select notice_id from bulletins, explnum, notices $statut_j $acces_j ".stripslashes($clause_bull_num_notice).' ';
$q = "select uni.notice_id from ($q_noti UNION $q_bull UNION $q_bull_num_notice) as uni";
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notice_id;
}
}
add_notices_to_cart($notices);
break;
}
break;
case "author_see":
$notices = '';
$rqt_auteurs = "select author_id as aut from authors where author_see='$id' and author_id!=0 union select author_see as aut from authors where author_id='$id' and author_see!=0 " ;
$res_auteurs = mysql_query($rqt_auteurs, $dbh);
$clause_auteurs = "responsability_author in ('$id'";
while($id_aut=mysql_fetch_object($res_auteurs)) {
$clause_auteurs .= ",'".$id_aut->aut."'";
}
$clause_auteurs .= ")" ;
$q = "select distinct responsability_notice as notice_id from responsability where $clause_auteurs ";
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)) {
$tab_notices=array();
while($row=mysql_fetch_object($res)) {
$tab_notices[] = $row->notice_id;
}
$notices = implode(',',$tab_notices);
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "categ_see":
$notices = '';
$q = "select notcateg_notice from notices_categories where num_noeud='$id' ";
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notcateg_notice;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "indexint_see":
$notices = '';
$q = "select notice_id from notices where indexint='$id' " ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notice_id;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "coll_see":
$notices = '';
$q = "select notice_id from notices where coll_id='$id' " ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notice_id;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "publisher_see":
$notices = '';
$q = "select distinct notice_id from notices where (ed1_id='$id' or ed2_id='$id')" ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)) {
$tab_notices=array();
while ($row= mysql_fetch_object($res)) {
$tab_notices[]=$row->notice_id;
}
$notices = implode(',',$tab_notices);
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "serie_see":
$notices = '';
$q = "select distinct notice_id from notices where tparent_id='$id' " ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notice_id;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "subcoll_see":
$notices = '';
$q = "select distinct notice_id from notices where subcoll_id='$id' " ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notice_id;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "etagere_see":
$notices = '';
$q = "select distinct object_id from caddie_content join etagere_caddie on caddie_content.caddie_id=etagere_caddie.caddie_id where etagere_id='$id'";
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->object_id;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "dsi":
$notices = '';
$q = "select distinct num_notice from bannette_contenu where num_bannette='$id' " ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->num_notice;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "analysis":
$notices='';
$q = "select distinct analysis_notice from analysis where analysis_bulletin='$id' " ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->analysis_notice;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
case "listlecture":
$notices='';
$q = "select notices_associees from opac_liste_lecture where id_liste=$id" ;
$res = mysql_query($q,$dbh);
if(mysql_num_rows($res)){
while ($row = mysql_fetch_object($res)){
if ($notices != "") $notices.= ",";
$notices.= $row->notices_associees;
}
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
if($sub == "consult")
print "";
else
print "";
break;
case "section_see":
//On regarde dans quelle type de navigation on se trouve
$requete="SELECT num_pclass FROM docsloc_section WHERE num_location='".$location."' AND num_section='".$id."' ";
$res=mysql_query($requete);
$type_aff_navigopac=0;
if(mysql_num_rows($res)){
$type_aff_navigopac=mysql_result($res,0,0);
}
if($type_aff_navigopac == 0 or ($type_aff_navigopac == -1 && !$plettreaut)or ($type_aff_navigopac != -1 && $type_aff_navigopac != 0 && !isset($dcote) && !isset($nc))){
//Pas de navigation ou navigation par les auteurs mais sans choix effectué
$requete="create temporary table temp_n_id ENGINE=MyISAM ( select distinct expl_notice as notice_id from exemplaires where expl_section='".$id."' and expl_location='".$location."' )";
mysql_query($requete);
//On récupère les notices de périodique avec au moins un exemplaire d'un bulletin dans la localisation et la section
$requete="INSERT INTO temp_n_id (select distinct bulletin_notice as notice_id from bulletins join exemplaires on bulletin_id=expl_bulletin where expl_section='".$id."' and expl_location='".$location."' )";
mysql_query($requete);
@mysql_query("alter table temp_n_id add index(notice_id)");
$requete = "SELECT notice_id FROM temp_n_id ";
}elseif($type_aff_navigopac == -1 ){
$requete="create temporary table temp_n_id ENGINE=MyISAM ( SELECT distinct expl_notice as notice_id from exemplaires where expl_section='".$id."' and expl_location='".$location."' )";
mysql_query($requete);
//On récupère les notices de périodique avec au moins un exemplaire d'un bulletin dans la localisation et la section
$requete="INSERT INTO temp_n_id (select distinct bulletin_notice as notice_id from bulletins join exemplaires on bulletin_id=expl_bulletin where expl_section='".$id."' and expl_location='".$location."' )";
mysql_query($requete);
if($plettreaut == "num"){
$requete = "SELECT temp_n_id.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[0-9]' GROUP BY temp_n_id.notice_id";
}elseif($plettreaut == "vide"){
$requete = "SELECT temp_n_id.notice_id FROM temp_n_id LEFT JOIN responsability ON responsability_notice=temp_n_id.notice_id WHERE responsability_author IS NULL GROUP BY temp_n_id.notice_id";
}else{
$requete = "SELECT temp_n_id.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[".$plettreaut."]' GROUP BY temp_n_id.notice_id";
}
}else{
//Navigation par plan de classement
//Table temporaire de tous les id
if ($ssub) {
$t_dcote=explode(",",$dcote);
$t_expl_cote_cond=array();
for ($i=0; $iexpl_cote,$c)) {
$found=false;
$lcote=(strlen($c[0])>=3) ? 3 : strlen($c[0]);
$level=$level_ref;
while ((!$found)&&($level<=$lcote)) {
$cote=substr($c[0],0,$level);
$compl=str_repeat("0",$lcote-$level);
$rq_index="select indexint_name,indexint_comment from indexint where indexint_name='".$cote.$compl."' and length(indexint_name)>=$lcote and num_pclass='".$type_aff_navigopac."' order by indexint_name limit 1";
$res_index_1=mysql_query($rq_index);
if (mysql_num_rows($res_index_1)) {
$rq_del="select distinct notice_id from notices, exemplaires where expl_cote='".$ct->expl_cote."' and expl_notice=notice_id ";
$rq_del.=" union select distinct notice_id from notices, exemplaires, bulletins where expl_cote='".$ct->expl_cote."' and expl_bulletin=bulletin_id and bulletin_notice=notice_id ";
$res_del=mysql_query($rq_del) ;
while (list($n_id)=mysql_fetch_row($res_del)) {
mysql_query("delete from temp_n_id where notice_id=".$n_id);
}
$found=true;
} else $level++;
}
}
}
$requete = "SELECT notice_id FROM temp_n_id " ;
}
$notices='';
$r =mysql_query($requete,$dbh);
if (mysql_num_rows($r)) {
$tab_notices=array();
while($row=mysql_fetch_object($r)) {
$tab_notices[]=$row->notice_id;
}
$notices=implode(',',$tab_notices);
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
add_notices_to_cart($notices);
break;
}
} else $message="";
if(!count($cart_)) echo $msg["cart_empty"]; else echo $message." ".sprintf($msg["cart_contents"],count($cart_))."";
$_SESSION["cart"]=$cart_;
?>