예제 #1
0
 /**
  * Affichage sous forme de tableau des exemplaires
  */
 function construire_tableau()
 {
     global $_mimetypes_bymimetype_, $_mimetypes_byext_, $dbh, $charset, $opac_url_base;
     global $opac_visionneuse_allow;
     if (!$this->tableau_id) {
         $this->display = "";
     } else {
         create_tableau_mimetype();
         $url_docnum = "";
         switch ($this->type_elt) {
             case DOCNUM_DMDE:
                 $url_docnum = "/explnum_doc.php?explnumdoc_id=";
                 $requete = "SELECT id_explnum_doc as explnum_id, explnum_doc_nomfichier as explnum_nom,  explnum_doc_mimetype as explnum_mimetype,\n\t\t\t\t\t\t explnum_doc_url as explnum_url, explnum_doc_data as explnum_data, explnum_doc_extfichier as explnum_extfichier\n\t\t\t\t\t\t  FROM explnum_doc join explnum_doc_actions on id_explnum_doc=num_explnum_doc WHERE prive=0 and num_action in (" . implode(',', $this->tableau_id) . ")";
                 break;
             case DOCNUM_SUGG:
                 $url_docnum = "/explnum_doc.php?explnumdoc_id=";
                 $requete = "SELECT id_explnum_doc as explnum_id, explnum_doc_nomfichier as explnum_nom,  explnum_doc_mimetype as explnum_mimetype,\n\t\t\t\t\t\t explnum_doc_url as explnum_url, explnum_doc_data as explnum_data, explnum_doc_extfichier as explnum_extfichier\n\t\t\t\t\t\t  FROM explnum_doc join explnum_doc_sugg on id_explnum_doc=num_explnum_doc WHERE num_suggestion in (" . implode(',', $this->tableau_id) . ")";
                 break;
             case DOCNUM_NOTI:
             default:
                 // récupération des infos des explnum
                 $requete = "SELECT explnum_id, explnum_notice, explnum_bulletin, explnum_nom, explnum_mimetype,\n\t\t\t\t\t\t explnum_url, explnum_data, explnum_vignette, explnum_nomfichier, explnum_extfichier\n\t\t\t\t\t\t  FROM explnum WHERE explnum_id in (" . implode(',', $this->tableau_id) . ")";
                 $url_docnum = "/doc_num.php?explnum_id=";
                 break;
         }
         $res = mysql_query($requete, $dbh);
         $i = 1;
         $allowed_mimetype = array();
         if ($opac_visionneuse_allow) {
             global $opac_photo_filtre_mimetype;
             $allowed_mimetype = explode(",", str_replace("'", "", $opac_photo_filtre_mimetype));
         }
         while ($expl = mysql_fetch_object($res)) {
             if ($expl->explnum_notice) {
                 $notice_aff = new notice_affichage($expl->explnum_notice, '');
                 $notice_aff->do_header_without_html();
                 $titre = $notice_aff->notice_header_without_html;
             } elseif ($expl->explnum_bulletin) {
                 $titre = $this->get_header_bulletin($expl->explnum_bulletin);
             }
             if ($i == 1) {
                 $ligne = "<div class='row'><div class='colonne3' >!!1!!</div><div class='colonne3' width='33%'>!!2!!</div><div class='colonne3' >!!3!!</div></div>";
             }
             $alt = htmlentities($expl->explnum_nom . " - " . $expl->explnum_mimetype, ENT_QUOTES, $charset);
             if ($expl->explnum_vignette) {
                 $obj = "<img src='" . $opac_url_base . "/vig_num.php?explnum_id={$expl->explnum_id}' alt='{$alt}' title='{$alt}' border='0'>";
             } else {
                 // trouver l'icone correspondant au mime_type
                 $obj = "<img src='" . $opac_url_base . "/images/mimetype/" . icone_mimetype($expl->explnum_mimetype, $expl->explnum_extfichier) . "' alt='{$alt}' title='{$alt}' border='0'>";
             }
             $lien = "";
             if ($expl->explnum_notice) {
                 $lien = "index.php?lvl=notice_display&id=" . $expl->explnum_notice;
             } elseif ($expl->explnum_bulletin) {
                 $lien = "index.php?lvl=bulletin_display&id=" . $expl->explnum_bulletin;
             }
             $words_to_find = "";
             if ($expl->explnum_mimetype == 'application/pdf' || $expl->explnum_mimetype == 'URL' && strpos($expl->explnum_nom, '.pdf') !== false) {
                 $words_to_find = "#search=\"" . $this->termes_recherche . "\"";
             }
             $expl_liste_obj = "<div class='explnum-titre' style=\"margin-top:20px;margin-bottom:10px;text-align:center;font-weight:bold;\" ><a href='{$lien}'>{$titre}</a></div>";
             $expl_liste_obj .= "<div style=\"text-align:center; word-wrap: break-word\">";
             if ($allowed_mimetype && in_array($expl->explnum_mimetype, $allowed_mimetype)) {
                 $link = "\n\t\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\t\tif(typeof(sendToVisionneuse) == 'undefined'){\n\t\t\t\t\t\t\t\tvar sendToVisionneuse = function (explnum_id){\n\t\t\t\t\t\t\t\t\tdocument.getElementById('visionneuseIframe').src = 'visionneuse.php?'+(typeof(explnum_id) != 'undefined' ? 'explnum_id='+explnum_id+\"\" : '\\'');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</script>\n\t\t\t\t\t\t<a href='#' onclick=\"open_visionneuse(sendToVisionneuse," . $expl->explnum_id . ");return false;\" alt='{$alt}' title='{$alt}'>" . $obj . "</a><br />";
                 $expl_liste_obj .= $link;
             } else {
                 $expl_liste_obj .= "<a href='" . $opac_url_base . $url_docnum . $expl->explnum_id . $words_to_find . "' alt='{$alt}' title='{$alt}' target='_blank'>" . $obj . "</a><br />";
             }
             if ($_mimetypes_byext_[$expl->explnum_extfichier]["label"]) {
                 $explmime_nom = $_mimetypes_byext_[$expl->explnum_extfichier]["label"];
             } elseif ($_mimetypes_bymimetype_[$expl->explnum_mimetype]["label"]) {
                 $explmime_nom = $_mimetypes_bymimetype_[$expl->explnum_mimetype]["label"];
             } else {
                 $explmime_nom = $expl->explnum_mimetype;
             }
             $expl_liste_obj .= htmlentities($expl->explnum_nom, ENT_QUOTES, $charset) . "<div class='explnum_type'>" . htmlentities($explmime_nom, ENT_QUOTES, $charset) . "</div>";
             $expl_liste_obj .= "</div>";
             $ligne = str_replace("!!{$i}!!", $expl_liste_obj, $ligne);
             $i++;
             if ($i == 4) {
                 $ligne_finale .= $ligne;
                 $i = 1;
             }
         }
         if (!$ligne_finale) {
             $ligne_finale = $ligne;
         } elseif ($i != 1) {
             $ligne_finale .= $ligne;
         }
         $ligne_finale = str_replace('!!2!!', "&nbsp;", $ligne_finale);
         $ligne_finale = str_replace('!!3!!', "&nbsp;", $ligne_finale);
         $this->display = $ligne_finale;
     }
 }
예제 #2
0
 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 \n\t\t\t\t\tfrom notices join bannette_contenu on num_notice=notice_id \n\t\t\t\t\t\t\tjoin notice_statut on statut=id_notice_statut \n\t\t\t\t\twhere 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 \n\t\t\t\t\tfrom notices join caddie_content on object_id=notice_id \n\t\t\t\t\t\t\tjoin notice_statut on statut=id_notice_statut \n\t\t\t\t\twhere notice_visible_opac=1 and notice_visible_opac_abon=0 and caddie_id in (" . implode(",", $this->num_paniers) . ") ";
     }
     $rqtfinale = implode(' union ', $rqt);
     pmb_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 = pmb_mysql_query($query_not, $dbh);
     while ($tmp = pmb_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 .= "<item>\n\t\t\t\t\t\t\t\t<title>" . htmlspecialchars($notice->notice_header_without_html, ENT_QUOTES, $charset) . "</title>\n\t\t\t\t\t\t\t\t<pubDate>" . htmlspecialchars($tmp->pubdate, ENT_QUOTES, $charset) . "</pubDate>\n\t\t\t\t\t\t\t\t<link>" . htmlspecialchars(str_replace("!!id!!", $tmp->notice_id, $liens_opac['lien_rech_notice']), ENT_QUOTES, $charset) . "</link>";
         $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 . '<br />';
                     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, $notice->notice->tit1);
             $desc = str_replace("<br />", "<br/>", $desc);
             $retour_aff .= "\t<description>" . htmlspecialchars(strip_tags($image . $desc, "<table><tr><td><br/><img>"), ENT_QUOTES, $charset) . "</description>";
             $retour_aff .= $desc_explnum;
         } else {
             $retour_aff .= "\t<description>" . htmlspecialchars($desc, ENT_QUOTES, $charset) . "</description>";
         }
         $retour_aff .= "</item>";
     }
     $this->notices = $retour_aff;
 }
예제 #3
0
function doc_num_get_list($id_notices)
{
    global $msg, $dbh, $gestion_acces_active, $gestion_acces_empr_notice;
    $cpt_doc_num = 0;
    foreach ($id_notices as $notice_id) {
        $query = "SELECT explnum_id from explnum where explnum_statut=0 and explnum_notice={$notice_id} and explnum_mimetype IN ('application/pdf','application/x-pdf') ";
        $query .= " union ";
        $query .= " select explnum_id from explnum ,bulletins where explnum_statut=0 and explnum_bulletin=bulletin_id and num_notice={$notice_id} and explnum_mimetype IN ('application/pdf','application/x-pdf')";
        $result = pmb_mysql_query($query, $dbh);
        $nb_result = pmb_mysql_num_rows($result);
        if (!$nb_result) {
            continue;
        }
        // pour tout les pdf de la notice
        while ($row = pmb_mysql_fetch_object($result)) {
            $explnum_id = $row->explnum_id;
            $res = pmb_mysql_query("SELECT explnum_id, explnum_notice, explnum_bulletin, explnum_nom, explnum_mimetype, explnum_url, explnum_data, length(explnum_data) as taille,explnum_path, concat(repertoire_path,explnum_path,explnum_nomfichier) as path, repertoire_id FROM explnum left join upload_repertoire on repertoire_id=explnum_repertoire WHERE explnum_id = '{$explnum_id}' ", $dbh);
            $ligne = pmb_mysql_fetch_object($res);
            $id_for_rigths = $ligne->explnum_notice;
            if ($ligne->explnum_bulletin != 0) {
                //si bulletin, les droits sont rattachés à la notice du bulletin, à défaut du pério...
                $req = "select bulletin_notice,num_notice from bulletins where bulletin_id =" . $ligne->explnum_bulletin;
                $res = pmb_mysql_query($req, $dbh);
                if (pmb_mysql_num_rows($res)) {
                    $r = pmb_mysql_fetch_object($res);
                    $id_for_rigths = $r->num_notice;
                    if (!$id_for_rigths) {
                        $id_for_rigths = $r->bulletin_notice;
                    }
                }
            }
            //droits d'acces emprunteur/notice
            if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
                $ac = new acces();
                $dom_2 = $ac->setDomain(2);
                $rights = $dom_2->getRights($_SESSION['id_empr_session'], $id_for_rigths);
            }
            //Accessibilité des documents numériques aux abonnés en opac
            $req_restriction_abo = "SELECT explnum_visible_opac, explnum_visible_opac_abon ,notice_id FROM notice_statut, explnum, notices WHERE explnum_notice=notice_id AND statut=id_notice_statut  AND explnum_id='{$explnum_id}' ";
            $res_restriction_abo = pmb_mysql_query($req_restriction_abo, $dbh);
            if (!pmb_mysql_num_rows($res_restriction_abo)) {
                // bulletin
                $req_restriction_abo = "SELECT explnum_visible_opac, explnum_visible_opac_abon,notice_id\n\t\t\t\t\tFROM notice_statut, explnum, bulletins, notices\n\t\t\t\t\tWHERE explnum_bulletin = bulletin_id\n\t\t\t\t\tAND num_notice = notice_id\n\t\t\t\t\tAND statut = id_notice_statut\n\t\t\t\t\tAND explnum_id='{$explnum_id}' ";
                $res_restriction_abo = pmb_mysql_query($req_restriction_abo, $dbh);
            }
            $expl_num = pmb_mysql_fetch_array($res_restriction_abo);
            if ($rights & 16 || is_null($dom_2) && $expl_num["explnum_visible_opac"] && (!$expl_num["explnum_visible_opac_abon"] || $expl_num["explnum_visible_opac_abon"] && $_SESSION["user_code"])) {
                if ($ligne->explnum_data || $ligne->explnum_path) {
                    $notice = new notice_affichage($expl_num["notice_id"], $liens_opac);
                    $notice->do_header_without_html();
                    $tpl .= "<input id='doc_num_list_" . $explnum_id . "' type='checkbox' name='doc_num_list[]' value='" . $explnum_id . "'> " . $notice->notice_header_without_html . " : " . $ligne->explnum_nom . "<br />";
                    $cpt_doc_num++;
                }
            }
        }
    }
    if ($cpt_doc_num) {
        $tpl = " \t\t\n\t\t<br /><b>" . $msg["print_output_docnum_list"] . "</b>\n\t\t<input type='button' id='list_lecture_cart_checked_all' class='bouton' value=\"" . $msg["list_docnum_checked_all"] . "\" title=\"" . $msg["list_docnum_checked_all"] . "\" onClick=\"setCheckboxes('print_options', 'doc_num_list', true); return false;\" />\t\t\n\t\t<input type='button' id='list_lecture_cart_checked_all' class='bouton' value=\"" . $msg["list_docnum_unchecked_all"] . "\" title=\"" . $msg["list_docnum_unchecked_all"] . "\" onClick=\"setCheckboxes('print_options', 'doc_num_list', false); return false;\" />\n\t\t<br />" . $tpl;
    } else {
        $tpl = "<b>" . $msg["print_output_docnum_list_no_file"] . "<br /></b>";
    }
    return $tpl;
}
 private function aff_notices_list($notices_list)
 {
     global $dbh, $charset, $opac_url_base;
     global $opac_notice_affichage_class;
     $retour_aff = "";
     foreach ($notices_list as $notice_id) {
         $req = "select notice_id, notice_date_is_new 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);
             } else {
                 $notice = new notice_affichage($r->notice_id, "", "", 1);
             }
             $notice->visu_expl = 0;
             $notice->visu_explnum = 0;
             $notice->do_header_without_html();
             $retour_aff .= "<item>\r\n\t\t\t\t\t<title>" . htmlspecialchars($notice->notice_header_without_html, ENT_QUOTES, $charset) . "</title>\r\n\t\t\t\t\t<pubDate>" . htmlspecialchars($r->notice_date_is_new, ENT_QUOTES, $charset) . "</pubDate>\r\n\t\t\t\t\t<link>" . htmlspecialchars($opac_url_base . "index.php?lvl=notice_display&id=" . $r->notice_id, ENT_QUOTES, $charset) . "</link>";
             $notice->do_isbd(1, 0);
             $desc = $notice->notice_isbd;
             $retour_aff .= "\t<description>" . htmlspecialchars($desc, ENT_QUOTES, $charset) . "</description>";
             $retour_aff .= "</item>";
         }
     }
     return $retour_aff;
 }