protected function _get_filter_query()
 {
     global $gestion_acces_active;
     global $gestion_acces_user_notice;
     if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) {
         $ac = new acces();
         $dom_2 = $ac->setDomain(1);
         $query = $dom_2->getFilterQuery($this->user, 4, 'id_notice', $this->notice_ids);
     }
     return $query;
 }
 protected function _filter_results()
 {
     global $dbh;
     //TODO Filtrage par statut de document numerique
     $this->_get_notices_ids();
     if ($this->notices_ids != '') {
         $query = 'select notice_id from notices where 1 ';
         //filtrage par type de document
         global $typdoc;
         if ($typdoc) {
             $query .= "and typdoc = ('" . $typdoc . "')";
         }
         //filtrage par visibilite
         global $gestion_acces_active, $gestion_acces_empr_notice;
         if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
             $ac = new acces();
             $dom_2 = $ac->setDomain(2);
             $q = $dom_2->getFilterQuery($_SESSION['id_empr_session'], 16, 'id_notice', $this->notices_ids);
             $query .= 'and notice_id in (' . $q . ') ';
         } else {
             $query .= 'and statut in (select id_notice_statut from notice_statut where ((explnum_visible_opac=1 and explnum_visible_opac_abon=0)' . ($_SESSION["user_code"] ? ' or (explnum_visible_opac_abon=1 and explnum_visible_opac=1)' : '') . ')) ';
             $query .= 'and notice_id in (' . $this->notices_ids . ') ';
         }
         //filtrage par vue
         global $opac_opac_view_activate;
         if ($opac_opac_view_activate && $_SESSION["opac_view"] && $_SESSION["opac_view_query"]) {
             $query .= ' and notice_id in (select opac_view_num_notice from opac_view_notices_' . $_SESSION["opac_view"] . ') ';
         }
         //filtrage par recherche perso
         global $include_path, $opac_search_other_function;
         $custom_query = '';
         if ($opac_search_other_function) {
             require_once $include_path . '/' . $opac_search_other_function;
             $custom_query = search_other_function_clause();
             if ($custom_query) {
                 $query .= ' and notice_id in (' . $custom_query . ')';
             }
         }
         if ($query) {
             $notices_ids = array();
             $r = pmb_mysql_query($query, $dbh);
             if (pmb_mysql_num_rows($r)) {
                 while ($o = pmb_mysql_fetch_object($r)) {
                     $notices_ids[] = $o->notice_id;
                 }
             }
             $this->explnums_notices = array_intersect($this->explnums_notices, $notices_ids);
             $this->objects_ids = implode(',', array_keys($this->explnums_notices));
         }
     }
 }
Esempio n. 3
0
 protected function _get_filter_query()
 {
     global $gestion_acces_active;
     global $gestion_acces_empr_notice;
     if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
         $ac = new acces();
         $dom_2 = $ac->setDomain(2);
         $query = $dom_2->getFilterQuery($_SESSION['id_empr_session'], 4, 'id_notice', $this->notice_ids);
     }
     if (!$query) {
         $where = "notice_id in (" . $this->notice_ids . ") and";
         $query = "select distinct notice_id as id_notice from notices join notice_statut on notices.statut= id_notice_statut where {$where} ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
     }
     return $query;
 }
function notices_bannette($id_bannette, &$notices, $date_diff = '')
{
    global $dbh;
    global $opac_bannette_notices_order;
    global $gestion_acces_active, $gestion_acces_empr_notice;
    if (!$opac_bannette_notices_order) {
        $opac_bannette_notices_order = " index_serie, tnvol, index_sew ";
    } else {
        $opac_bannette_notices_order = " {$opac_bannette_notices_order} ";
    }
    $acces_j = '';
    if ($gestion_acces_active && $gestion_acces_empr_notice) {
        $ac = new acces();
        $dom_2 = $ac->setDomain(2);
        $acces_j = $dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id');
    }
    if (!$date_diff) {
        // on constitue un tableau avec les notices de la bannette
        $query_notice = "select distinct notice_id, niveau_biblio from bannette_contenu, notices {$acces_j} where num_bannette='" . $id_bannette . "' and num_notice=notice_id order by {$opac_bannette_notices_order} ";
        $result_notice = pmb_mysql_query($query_notice, $dbh);
        if (pmb_mysql_num_rows($result_notice)) {
            while ($notice = pmb_mysql_fetch_object($result_notice)) {
                $notices[$notice->notice_id] = $notice->niveau_biblio;
            }
        }
    } else {
        // on constitue un tableau avec les notices des archives de diffusion
        $query_notice = "select distinct num_notice_arc as notice_id, niveau_biblio from dsi_archive, notices {$acces_j} where num_banette_arc='" . $id_bannette . "' and num_notice_arc=notice_id\n\t\t and date_diff_arc = '{$date_diff}' order by {$opac_bannette_notices_order} ";
        $result_notice = pmb_mysql_query($query_notice, $dbh);
        if (pmb_mysql_num_rows($result_notice)) {
            while ($notice = pmb_mysql_fetch_object($result_notice)) {
                $notices[$notice->notice_id] = $notice->niveau_biblio;
            }
        }
    }
}
Esempio n. 5
0
    }
    $type = "";
}
//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 FROM notices,notice_statut WHERE notice_id='" . $id_for_rigths . "' AND statut=id_notice_statut ";
$result = pmb_mysql_query($req_restriction_abo, $dbh);
$expl_num = pmb_mysql_fetch_array($result, MYSQL_ASSOC);
//droits d'acces emprunteur/document numérique
if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
    $ac = new acces();
    $dom_3 = $ac->setDomain(3);
    $docnum_rights = $dom_3->getRights($_SESSION['id_empr_session'], $explnum_id);
}
//Accessibilité (Consultation/Téléchargement) sur le document numérique aux abonnés en opac
$req_restriction_docnum_abo = "SELECT explnum_download_opac, explnum_download_opac_abon FROM explnum,explnum_statut WHERE explnum_id='" . $explnum_id . "' AND explnum_docnum_statut=id_explnum_statut ";
$result_docnum = pmb_mysql_query($req_restriction_docnum_abo, $dbh);
$docnum_expl_num = pmb_mysql_fetch_array($result_docnum, MYSQL_ASSOC);
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"])) && ($docnum_rights & 8 || is_null($dom_3) && $docnum_expl_num["explnum_download_opac"] && (!$docnum_expl_num["explnum_download_opac_abon"] || $docnum_expl_num["explnum_download_opac_abon"] && $_SESSION["user_code"]))) {
    if ($ligne->explnum_data || $ligne->explnum_path) {
        if ($pmb_logs_activate) {
            //Récupération des informations du document numérique
            recup_explnum_infos($explnum_id);
            //Enregistrement du log
            global $log, $infos_explnum;
            $rqt = " select empr_prof,empr_cp, empr_ville as ville, empr_year, empr_sexe, empr_login,  empr_date_adhesion, empr_date_expiration, count(pret_idexpl) as nbprets, count(resa.id_resa) as nbresa, code.libelle as codestat, es.statut_libelle as statut, categ.libelle as categ, gr.libelle_groupe as groupe,dl.location_libelle as location\n\t\t\t\t\tfrom empr e\n\t\t\t\t\tleft join empr_codestat code on code.idcode=e.empr_codestat\n\t\t\t\t\tleft join empr_statut es on e.empr_statut=es.idstatut\n\t\t\t\t\tleft join empr_categ categ on categ.id_categ_empr=e.empr_categ\n\t\t\t\t\tleft join empr_groupe eg on eg.empr_id=e.id_empr\n\t\t\t\t\tleft join groupe gr on eg.groupe_id=gr.id_groupe\n\t\t\t\t\tleft join docs_location dl on e.empr_location=dl.idlocation\n\t\t\t\t\tleft join resa on e.id_empr=resa_idempr\n\t\t\t\t\tleft join pret on e.id_empr=pret_idempr\n\t\t\t\t\twhere e.empr_login='******'user_code']) . "'\n\t\t\t\t\tgroup by resa_idempr, pret_idempr";
Esempio n. 6
0
function explnum_test_rights_per_id($id_explnum)
{
    global $gestion_acces_active, $gestion_acces_empr_docnum;
    //droits d'acces emprunteur/document numérique
    if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
        $ac = new acces();
        $dom_3 = $ac->setDomain(3);
        $rights = $dom_3->getRights($_SESSION['id_empr_session'], $id_explnum);
    }
    //Accessibilité du document numérique aux abonnés en opac
    $req_restriction_abo = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM explnum,explnum_statut WHERE explnum_id='" . $id_explnum . "' AND explnum_docnum_statut=id_explnum_statut ";
    $result = pmb_mysql_query($req_restriction_abo);
    if ($result && pmb_mysql_num_rows($result)) {
        $expl_num = pmb_mysql_fetch_array($result, MYSQL_ASSOC);
        if ($rights & 16 || is_null($dom_3) && $expl_num["explnum_visible_opac"] && (!$expl_num["explnum_visible_opac_abon"] || $expl_num["explnum_visible_opac_abon"] && $_SESSION["user_code"])) {
            return true;
        }
    }
    return false;
}
Esempio n. 7
0
 function get_perio($id)
 {
     //on simplifie les appels..
     if (strpos($id, "es") !== false) {
         return $this->get_perio_ex($id);
     }
     global $msg, $charset, $dbh;
     global $f_bull_deb_id, $opac_bull_results_per_page, $page, $opac_fonction_affichage_liste_bull, $bull_date_start, $bull_date_end;
     global $bull_num_deb;
     global $flag_no_get_bulletin;
     global $recherche_ajax_mode;
     //on surcharge pour l'affichage des périos en affichage django
     global $lvl;
     global $opac_notices_format;
     if ($opac_notices_format == AFF_ETA_NOTICES_TEMPLATE_DJANGO) {
         $lvl = 'notice_display';
     }
     $flag_no_get_bulletin = 1;
     $opac_notices_depliable = 0;
     $resultat_aff .= aff_notice($id, 0, 1, 0, "", 0, 0, 1, $recherche_ajax_mode);
     /*
     $notice = new notice_affichage($id) ;
     $notice->do_header();
     $notice->do_public();
     //$notice->do_isbd();
     $notice->genere_simple(0, 'PUBLIC') ;					
     $resultat_aff .= $notice->result;	
     */
     $requete = "SELECT notice_id, niveau_biblio,typdoc,opac_visible_bulletinage FROM notices WHERE notice_id='{$id}'  and (opac_visible_bulletinage&0x1) LIMIT 1";
     $res = @pmb_mysql_query($requete, $dbh);
     if ($obj = pmb_mysql_fetch_object($res)) {
         //Recherche dans les numéros
         $start_num = $bull_num_deb;
         if ($f_bull_deb_id) {
             $restrict_num = $this->compare_date($f_bull_deb_id);
             $restrict_date = "";
         } else {
             if ($start_num) {
                 $restrict_num = " and bulletin_numero like '%" . $start_num . "%' ";
                 $restrict_date = "";
             }
         }
         // Recherche dans les dates et libellés de période
         if (!$restrict_num) {
             $restrict_date = $this->compare_date($bull_date_start, $bull_date_end);
         }
         // nombre de références par pages (12 par défaut)
         if (!isset($opac_bull_results_per_page)) {
             $opac_bull_results_per_page = 12;
         }
         if (!$page) {
             $page = 1;
         }
         $debut = ($page - 1) * $opac_bull_results_per_page;
         $limiter = " LIMIT {$debut},{$opac_bull_results_per_page}";
         //Recherche par numéro
         $num_field_start = "\n\t\t\t<input type='hidden' name='f_bull_deb_id' id='f_bull_deb_id' />\n\t\t\t<input id='bull_num_deb' name='bull_num_deb' type='text' size='10' value='" . $start_num . "' onkeypress='if (event.keyCode==13){ show_perio({$id});}' />";
         //Recherche par date
         $deb_value = str_replace("-", "", $bull_date_start);
         $fin_value = str_replace("-", "", $bull_date_end);
         $date_deb_value = $deb_value ? formatdate($deb_value) : '...';
         $date_fin_value = $fin_value ? formatdate($fin_value) : '...';
         $date_debut = "\n\t\t\t<input type='hidden' id='bull_date_start' name='bull_date_start' value='{$bull_date_start}'/>\n\t\t\t<input type='button' class='bouton' id='date_deb_btn' name='date_deb_btn'  value='" . $date_deb_value . "' onClick=\"window.open('./select.php?what=calendrier&caller=form_values&date_caller=&param1=bull_date_start&param2=date_deb_btn&auto_submit=NO&date_anterieure=YES', 'date_fin', 'width=250,height=300,toolbar=no,dependent=yes,resizable=yes')\"/>\n\t\t\t<input type='button' class='bouton' name='del' value='X' onclick='this.form.date_deb_btn.value=\"...\";this.form.bull_date_start.value=\"\";' />\n\t\t";
         $date_fin = "\n\t\t\t<input type='hidden' id='bull_date_end' name='bull_date_end' value='{$bull_date_end}' />\n\t\t\t<input type='button' class='bouton' id='date_fin_btn' name='date_fin_btn' value='" . $date_fin_value . "' onClick=\"window.open('./select.php?what=calendrier&caller=form_values&date_caller=&param1=bull_date_end&param2=date_fin_btn&auto_submit=NO&date_anterieure=YES', 'date_fin', 'width=250,height=300,toolbar=no,dependent=yes,resizable=yes')\"/>\n\t\t\t<input type='button' class='bouton' name='del' value='X' onclick='this.form.date_fin_btn.value=\"...\";this.form.bull_date_end.value=\"\";' />\n\t\t";
         $bulletin_retard = $this->get_bulletin_retard($id);
         $tableau = "\t\t\n\t\t<a name='tab_bulletin'></a>\n\t\t<h3><span id='titre_exemplaires'>" . $msg["a2z_perio_list_bulletins"] . "</span></h3>\n\t\t<div id='form_search_bull'>\n\t\t\t\n\t\t\t\t<script src='./includes/javascript/ajax.js'></script>\n\t\t\t\t<form name=\"form_values\" action=\"./index.php?lvl=notice_display&id={$id}\" >\n\n\t\t\t\t\t<input type=\"hidden\" name=\"premier\" value=\"\">\n\n\t\t\t\t\t<input type=\"hidden\" id='page' name=\"page\" value=\"{$page}\">\n\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td ><strong>" . $msg["search_per_bull_num"] . " : " . $msg["search_bull_exact"] . "</strong></td>\n\t\t\t\t\t\t\t<td >{$num_field_start}</td>\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td >&nbsp;</td>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<td align='left' rowspan=2><input type='button' class='boutonrechercher' value='" . $msg["142"] . "' onclick='show_perio({$id});' /></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td ><strong>" . $msg["search_per_bull_date"] . " : " . $msg["search_bull_start"] . "</strong></td>\n\t\t\t\t\t\t\t<td>{$date_debut}</td>\n\t\t\t\t\t\t\t<td><strong>" . $msg["search_bull_end"] . "</strong> {$date_fin}</td>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</form>\n\t\t\t<div class='row'></div><br />\n\t\t</div>\n";
         $resultat_aff .= $tableau;
         //		$resultat_aff.= "<script type='text/javascript'>ajax_parse_dom();</script>";
         $resultat_aff .= $bulletin_retard;
         // A EXTERNALISER ENSUITE DANS un bulletin_list.inc.php
         //AVANT
         $requete = "SELECT bulletins.*,count(explnum_id) as nbexplnum FROM bulletins LEFT JOIN explnum ON explnum_bulletin = bulletin_id where bulletin_id in(\n\t\tSELECT bulletin_id FROM bulletins WHERE bulletin_notice='{$id}' {$restrict_num} {$restrict_date} and num_notice=0\n\t\t) or bulletin_id in(\n\t\tSELECT bulletin_id FROM bulletins,notice_statut, notices WHERE bulletin_notice='{$id}' {$restrict_num} {$restrict_date} \n\t\tand notice_id=num_notice\n\t\tand statut=id_notice_statut \n\t\tand((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")) \n\t\tGROUP BY bulletins.bulletin_id ";
         //MAINTENANT
         global $gestion_acces_active, $gestion_acces_empr_notice, $gestion_acces_empr_docnum, $opac_show_links_invisible_docnums;
         $join_docnum_noti = $join_docnum_bull = "";
         if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
             $ac = new acces();
             $dom_2 = $ac->setDomain(2);
             $join_noti = $dom_2->getJoin($_SESSION["id_empr_session"], 4, "bulletins.num_notice");
             $join_bull = $dom_2->getJoin($_SESSION["id_empr_session"], 4, "bulletins.bulletin_notice");
             if (!$opac_show_links_invisible_docnums) {
                 $join_docnum_noti = $dom_2->getJoin($_SESSION["id_empr_session"], 16, "bulletins.num_notice");
                 $join_docnum_bull = $dom_2->getJoin($_SESSION["id_empr_session"], 16, "bulletins.bulletin_notice");
             }
         } else {
             $join_noti = "join notices on bulletins.num_notice = notices.notice_id join notice_statut on notices.statut = notice_statut.id_notice_statut AND ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
             $join_bull = "join notices on bulletins.bulletin_notice = notices.notice_id join notice_statut on notices.statut = notice_statut.id_notice_statut AND ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
             if (!$opac_show_links_invisible_docnums) {
                 $join_docnum_noti = "join notices on bulletins.num_notice = notices.notice_id join notice_statut on notices.statut = notice_statut.id_notice_statut AND ((explnum_visible_opac=1 and explnum_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (explnum_visible_opac_abon=1 and explnum_visible_opac=1)" : "") . ")";
                 $join_docnum_bull = "join notices on bulletins.bulletin_notice = notices.notice_id join notice_statut on notices.statut = notice_statut.id_notice_statut AND ((explnum_visible_opac=1 and explnum_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (explnum_visible_opac_abon=1 and explnum_visible_opac=1)" : "") . ")";
             }
         }
         $join_docnum_explnum = "";
         if (!$opac_show_links_invisible_docnums) {
             if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
                 $ac = new acces();
                 $dom_3 = $ac->setDomain(3);
                 $join_docnum_explnum = $dom_3->getJoin($_SESSION["id_empr_session"], 16, "explnum_id");
             } else {
                 $join_docnum_explnum = "join explnum_statut on explnum_docnum_statut=id_explnum_statut and ((explnum_visible_opac=1 and explnum_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (explnum_visible_opac_abon=1 and explnum_visible_opac=1)" : "") . ")";
             }
         }
         $requete_docnum_noti = "select bulletin_id, count(explnum_id) as nbexplnum from explnum join bulletins on explnum_bulletin = bulletin_id and explnum_notice = 0 " . $join_docnum_explnum . " where bulletin_notice = " . $id . " and explnum_bulletin in (select bulletin_id from bulletins " . $join_docnum_noti . " where bulletin_notice = " . $id . ") group by bulletin_id";
         $requete_docnum_bull = "select bulletin_id, count(explnum_id) as nbexplnum from explnum join bulletins on explnum_bulletin = bulletin_id and explnum_notice = 0 " . $join_docnum_explnum . " where bulletin_notice = " . $id . " and explnum_bulletin in (select bulletin_id from bulletins " . $join_docnum_bull . " where bulletin_notice = " . $id . ") group by bulletin_id";
         $requete_noti = "select bulletins.*,ifnull(nbexplnum,0) as nbexplnum from bulletins " . $join_noti . " left join ({$requete_docnum_noti}) as docnum_noti on bulletins.bulletin_id = docnum_noti.bulletin_id where bulletins.num_notice != 0 and bulletin_notice = " . $id . " {$restrict_num} {$restrict_date} GROUP BY bulletins.bulletin_id";
         $requete_bull = "select bulletins.*,ifnull(nbexplnum,0) as nbexplnum from bulletins " . $join_bull . " left join ({$requete_docnum_bull}) as docnum_bull on bulletins.bulletin_id = docnum_bull.bulletin_id where bulletins.num_notice = 0 and bulletin_notice = " . $id . " {$restrict_num} {$restrict_date} GROUP BY bulletins.bulletin_id";
         $requete = "select * from (" . $requete_noti . " union " . $requete_bull . ") as uni where 1 " . $restrict_num . " " . $restrict_date;
         $rescount1 = pmb_mysql_query($requete);
         $count1 = pmb_mysql_num_rows($rescount1);
         //si on recherche par date ou par numéro, le résultat sera trié par ordre croissant
         if ($restrict_num || $restrict_date) {
             $requete .= " ORDER BY date_date, bulletin_numero*1 ";
         } else {
             $requete .= " ORDER BY date_date DESC, bulletin_numero*1 DESC";
         }
         $requete .= $limiter;
         $res = @pmb_mysql_query($requete, $dbh);
         $count = pmb_mysql_num_rows($res);
         if ($count) {
             ob_start();
             if ($opac_fonction_affichage_liste_bull) {
                 eval("\$opac_fonction_affichage_liste_bull (\$res);");
             } else {
                 affichage_liste_bulletins_normale($res);
             }
             $resultat_aff .= ob_get_contents();
             ob_end_clean();
         } else {
             $resultat_aff .= "<strong>" . $msg["bull_no_found"] . "</strong>";
         }
         //$resultat_aff.= "<br />";
         // constitution des liens
         if (!$count1) {
             $count1 = $count;
         }
         $nbepages = ceil($count1 / $opac_bull_results_per_page);
         $url_page = "";
         //javascript:if (document.getElementById(\"onglet_isbd$id\")) if (document.getElementById(\"onglet_isbd$id\").className==\"isbd_public_active\") document.form_values.premier.value=\"ISBD\"; else document.form_values.premier.value=\"PUBLIC\"; document.form_values.page.value=!!page!!; document.form_values.submit()";
         $action = "show_perio({$id});return false;";
         if ($nbepages > 1) {
             $form = "<div class='row'></div>\n<div id='navbar_perio'><center>" . printnavbar_onclick($page, $nbepages, $url_page, $action) . "</center></div>";
         }
     }
     return $resultat_aff . $form;
 }
Esempio n. 8
0
 function get_rights_form()
 {
     global $dbh, $msg, $charset;
     global $gestion_acces_active, $gestion_acces_empr_notice;
     global $gestion_acces_empr_notice_def;
     if ($gestion_acces_active != 1) {
         return '';
     }
     $ac = new acces();
     $form = '';
     $c_form = "<label class='etiquette'><!-- domain_name --></label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t    \t<div class='colonne3'>" . htmlentities($msg['dom_cur_prf'], ENT_QUOTES, $charset) . "</div>\n\t\t\t\t    \t<div class='colonne_suite'><!-- prf_rad --></div>\n\t\t\t\t    \t</div>\n\t\t\t\t    \t<div class='row'>\n\t\t\t\t    \t<div class='colonne3'>" . htmlentities($msg['dom_cur_rights'], ENT_QUOTES, $charset) . "</div>\n\t\t\t\t\t    <div class='colonne_suite'><!-- r_rad --></div>\n\t\t\t\t\t    <div class='row'><!-- rights_tab --></div>\n\t\t\t\t\t    </div>";
     if ($gestion_acces_empr_notice == 1) {
         $r_form = $c_form;
         $dom_2 = $ac->setDomain(2);
         $r_form = str_replace('<!-- domain_name -->', htmlentities($dom_2->getComment('long_name'), ENT_QUOTES, $charset), $r_form);
         if ($this->analysis_id) {
             //profil ressource
             $def_prf = $dom_2->getComment('res_prf_def_lib');
             $res_prf = $dom_2->getResourceProfile($this->analysis_id);
             $q = $dom_2->loadUsedResourceProfiles();
             //Recuperation droits generiques utilisateur
             $user_rights = $dom_2->getDomainRights(0, $res_prf);
             if ($user_rights & 2) {
                 $p_sel = gen_liste($q, 'prf_id', 'prf_name', 'res_prf[2]', '', $res_prf, '0', $def_prf, '0', $def_prf);
                 $p_rad = "<input type='radio' name='prf_rad[2]' value='R' ";
                 if ($gestion_acces_empr_notice_def != '1') {
                     $p_rad .= "checked='checked' ";
                 }
                 $p_rad .= ">" . htmlentities($msg['dom_rad_calc'], ENT_QUOTES, $charset) . "</input><input type='radio' name='prf_rad[2]' value='C' ";
                 if ($gestion_acces_empr_notice_def == '1') {
                     $p_rad .= "checked='checked' ";
                 }
                 $p_rad .= ">" . htmlentities($msg['dom_rad_def'], ENT_QUOTES, $charset) . " {$p_sel}</input>";
                 $r_form = str_replace('<!-- prf_rad -->', $p_rad, $r_form);
             } else {
                 $r_form = str_replace('<!-- prf_rad -->', htmlentities($dom_2->getResourceProfileName($res_prf), ENT_QUOTES, $charset), $r_form);
             }
             //droits/profils utilisateurs
             if ($user_rights & 1) {
                 $r_rad = "<input type='radio' name='r_rad[2]' value='R' ";
                 if ($gestion_acces_empr_notice_def != '1') {
                     $r_rad .= "checked='checked' ";
                 }
                 $r_rad .= ">" . htmlentities($msg['dom_rad_calc'], ENT_QUOTES, $charset) . "</input><input type='radio' name='r_rad[2]' value='C' ";
                 if ($gestion_acces_empr_notice_def == '1') {
                     $r_rad .= "checked='checked' ";
                 }
                 $r_rad .= ">" . htmlentities($msg['dom_rad_def'], ENT_QUOTES, $charset) . "</input>";
                 $r_form = str_replace('<!-- r_rad -->', $r_rad, $r_form);
             }
             //recuperation profils utilisateurs
             $t_u = array();
             $t_u[0] = $dom_2->getComment('user_prf_def_lib');
             //niveau par defaut
             $qu = $dom_2->loadUsedUserProfiles();
             $ru = pmb_mysql_query($qu, $dbh);
             if (pmb_mysql_num_rows($ru)) {
                 while ($row = pmb_mysql_fetch_object($ru)) {
                     $t_u[$row->prf_id] = $row->prf_name;
                 }
             }
             //recuperation des controles dependants de l'utilisateur
             $t_ctl = $dom_2->getControls(0);
             //recuperation des droits
             $t_rights = $dom_2->getResourceRights($this->analysis_id);
             if (count($t_u)) {
                 $h_tab = "<div class='dom_div'><table class='dom_tab'><tr>";
                 foreach ($t_u as $k => $v) {
                     $h_tab .= "<th class='dom_col'>" . htmlentities($v, ENT_QUOTES, $charset) . "</th>";
                 }
                 $h_tab .= "</tr><!-- rights_tab --></table></div>";
                 $c_tab = '<tr>';
                 foreach ($t_u as $k => $v) {
                     $c_tab .= "<td><table style='border:1px solid;'><!-- rows --></table></td>";
                     $t_rows = "";
                     foreach ($t_ctl as $k2 => $v2) {
                         $t_rows .= "\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td style='width:25px;' ><input type='checkbox' name='chk_rights[2][" . $k . "][" . $k2 . "]' value='1' ";
                         if ($t_rights[$k][$res_prf] & pow(2, $k2 - 1)) {
                             $t_rows .= "checked='checked' ";
                         }
                         if (($user_rights & 1) == 0) {
                             $t_rows .= "disabled='disabled' ";
                         }
                         $t_rows .= "/></td>\n\t\t\t\t\t\t\t\t\t\t<td>" . htmlentities($v2, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t\t\t\t\t</tr>";
                     }
                     $c_tab = str_replace('<!-- rows -->', $t_rows, $c_tab);
                 }
                 $c_tab .= "</tr>";
             }
             $h_tab = str_replace('<!-- rights_tab -->', $c_tab, $h_tab);
             $r_form = str_replace('<!-- rights_tab -->', $h_tab, $r_form);
         } else {
             $r_form = str_replace('<!-- prf_rad -->', htmlentities($msg['dom_prf_unknown'], ENT_QUOTES, $charset), $r_form);
             $r_form = str_replace('<!-- r_rad -->', htmlentities($msg['dom_rights_unknown'], ENT_QUOTES, $charset), $r_form);
         }
         $form .= $r_form;
     }
     return $form;
 }
Esempio n. 9
0
 function filter_searchtable_from_accessrights($table, $PMBUserId)
 {
     global $dbh;
     global $gestion_acces_active, $gestion_acces_user_notice;
     if ($gestion_acces_active && $gestion_acces_user_notice) {
         //droits d'acces lecture notice
         $ac = new acces();
         $dom_1 = $ac->setDomain(1);
         $usr_prf = $dom_1->getUserProfile($PMBUserId);
         $requete = "delete from {$table} using {$table}, acces_res_1 ";
         $requete .= "where ";
         $requete .= "{$table}.notice_id = res_num and usr_prf_num=" . $usr_prf . " ";
         $requete .= "and (((res_rights ^ res_mask) & 4)=0) ";
         pmb_mysql_query($requete, $dbh);
     }
 }
Esempio n. 10
0
 function insert_in_database($addslashes = false)
 {
     global $dbh;
     global $class_path;
     global $gestion_acces_active, $gestion_acces_user_notice, $gestion_acces_empr_notice;
     global $res_prf, $chk_rights;
     global $pmb_synchro_rdf;
     global $opac_url_base, $pmb_notice_img_folder_id;
     if ($this->bibliographic_level == "s" && $this->hierarchic_level == "2") {
         $this->bibliographic_level = "b";
     }
     $new_notice = 0;
     $notice_retour = 0;
     $long_maxi = pmb_mysql_field_len(pmb_mysql_query("SELECT code FROM notices limit 1"), 0);
     $isbn = rtrim(substr($this->isbn, 0, $long_maxi));
     if ($isbn != "") {
         if (isISBN($isbn)) {
             if (strlen($isbn) == 13) {
                 $isbn1 = formatISBN($isbn, 13);
             } else {
                 $isbn1 = formatISBN($isbn, 10);
             }
         }
         $sql_rech = "select notice_id from notices where code = '" . $isbn . "' ";
         if ($isbn1) {
             $sql_rech .= " or code='" . $isbn1 . "' ";
         }
         $sql_result_rech = pmb_mysql_query($sql_rech) or die("Couldn't select notice ! = " . $sql_rech);
         if (pmb_mysql_num_rows($sql_result_rech) == 0) {
             $new_notice = 1;
         } else {
             $new_notice = 0;
             $lu = pmb_mysql_fetch_array($sql_result_rech);
             $notice_retour = $lu['notice_id'];
         }
     } else {
         $new_notice = 1;
     }
     if ($new_notice == 0) {
         $retour = array($new_notice, $notice_retour);
         return $retour;
     }
     for ($i = 0; $i < 2; $i++) {
         if ($this->editors[$i]['id']) {
             $editor_ids[$i] = $this->editors[$i]['id'];
         } else {
             $editor_ids[$i] = editeur::import($this->editors[$i]);
         }
     }
     $this->collection['parent'] = $editor_ids[0];
     if ($this->collection["id"]) {
         $collection_id = $this->collection["id"];
     } else {
         $collection_id = collection::import($this->collection);
     }
     $this->subcollection['coll_parent'] = $collection_id;
     if ($this->subcollection["id"]) {
         $subcollection_id = $this->subcollection["id"];
     } else {
         $subcollection_id = subcollection::import($this->subcollection);
     }
     $serie_id = serie::import(stripslashes($this->serie));
     /* traitement de Dewey */
     if (!$this->internal_index) {
         if (!$this->dewey["new_comment"]) {
             $this->dewey["new_comment"] = "";
         }
         if (!$this->dewey["new_pclass"]) {
             $this->dewey["new_pclass"] = "";
         }
         $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"]));
     }
     $date_parution_z3950 = notice::get_date_parution($this->year);
     /* Origine de la notice */
     $this->orinot_id = origine_notice::import($this->origine_notice);
     if ($this->orinot_id == 0) {
         $this->orinot_id = 1;
     }
     if ($addslashes) {
         $this->document_type = addslashes($this->document_type);
         $this->isbn = addslashes($this->isbn);
         $this->titles[0] = addslashes($this->titles[0]);
         $this->titles[1] = addslashes($this->titles[1]);
         $this->titles[2] = addslashes($this->titles[2]);
         $this->titles[3] = addslashes($this->titles[3]);
         $this->nbr_in_serie = addslashes($this->nbr_in_serie);
         $this->year = addslashes($this->year);
         $this->page_nbr = addslashes($this->page_nbr);
         $this->illustration = addslashes($this->illustration);
         $this->size = addslashes($this->size);
         $this->accompagnement = addslashes($this->accompagnement);
         $this->nbr_in_collection = addslashes($this->nbr_in_collection);
         $this->mention_edition = addslashes($this->mention_edition);
         $this->general_note = addslashes($this->general_note);
         $this->content_note = addslashes($this->content_note);
         $this->abstract_note = addslashes($this->abstract_note);
         $this->commentaire_gestion = addslashes($this->commentaire_gestion);
         $this->indexation_lang = addslashes($this->indexation_lang);
         $this->thumbnail_url = addslashes($this->thumbnail_url);
         $this->free_index = addslashes($this->free_index);
         $this->link_url = addslashes($this->link_url);
         $this->link_format = addslashes($this->link_format);
         $this->prix = addslashes($this->prix);
         //les oubliés du premier tour
         $serie_id = addslashes($serie_id);
         $this->bibliographic_level = addslashes($this->bibliographic_level);
         $this->hierarchic_level = addslashes($this->hierarchic_level);
         $date_parution_z3950 = addslashes($date_parution_z3950);
     }
     $sql_ins = "insert into notices (\n\t\t\ttypdoc          ,\n\t\t\tcode        \t,\n\t\t\ttit1            ,\n\t\t\ttit2            ,\n\t\t\ttit3            ,\n\t\t\ttit4            ,\n\t\t\ttparent_id      ,\n\t\t\ttnvol           ,\n\t\t\ted1_id          ,\n\t\t\ted2_id          ,\n\t\t\tyear            ,\n\t\t\tnpages          ,\n\t\t\till             ,\n\t\t\tsize            ,\n\t\t\taccomp          ,\n\t\t\tcoll_id         ,\n\t\t\tsubcoll_id      ,\n\t\t\tnocoll          ,\n\t\t\tmention_edition ,\n\t\t\tn_gen           ,\n\t\t\tn_contenu       ,\n\t\t\tn_resume        ,\n\t\t\tindexint,\n\t\t\tstatut,\n\t\t\tcommentaire_gestion,\n\t\t\tsignature,\n\t\t\tthumbnail_url,\n\t\t\tindex_l,\n\t\t\tniveau_biblio,\n\t\t\tniveau_hierar,\n\t\t\tlien,\n\t\t\teformat,\n\t\t\torigine_catalogage,\n\t\t\tprix,\n\t\t\tcreate_date,\n\t\t\tdate_parution,\n\t\t\tindexation_lang\n\t\t\t) values (\n\t\t\t'" . $this->document_type . "',\t\n\t\t\t'" . $this->isbn . "',\t\n\t\t\t'" . $this->titles[0] . "',\n\t\t\t'" . $this->titles[1] . "',\n\t\t\t'" . $this->titles[2] . "',\n\t\t\t'" . $this->titles[3] . "',\n\t\t\t'" . $serie_id . "',\n\t\t\t'" . $this->nbr_in_serie . "',\n\t\t\t" . $editor_ids[0] . " ,\n\t\t\t" . $editor_ids[1] . " ,\n\t\t\t'" . $this->year . "',\n\t\t\t'" . $this->page_nbr . "',\n\t\t\t'" . $this->illustration . "',\n\t\t\t'" . $this->size . "',\n\t\t\t'" . $this->accompagnement . "',\n\t\t\t" . $collection_id . " ,\n\t\t\t" . $subcollection_id . " ,\n\t\t\t'" . $this->nbr_in_collection . "',\n\t\t\t'" . $this->mention_edition . "',\n\t\t\t'" . $this->general_note . "',\n\t\t\t'" . $this->content_note . "',\n\t\t\t'" . $this->abstract_note . "',\n\t\t\t'" . $this->internal_index . "',\n\t\t\t'" . $this->statut . "',\n\t\t\t'" . $this->commentaire_gestion . "',\n\t\t\t'" . $this->signature . "',\n\t\t\t'" . $this->thumbnail_url . "',\n\t\t\t'" . clean_tags($this->free_index) . "',\n\t\t\t'" . $this->bibliographic_level . "',\n\t\t\t'" . $this->hierarchic_level . "',\n\t\t\t'" . $this->link_url . "',\n\t\t\t'" . $this->link_format . "',\n\t\t\t'" . $this->orinot_id . "',\n\t\t\t'" . $this->prix . "',\n\t\t\tsysdate(),\n\t\t\t'" . $date_parution_z3950 . "',\n\t\t\t'" . $this->indexation_lang . "'\n\t\t )";
     $sql_result_ins = pmb_mysql_query($sql_ins) or die("Couldn't insert into table notices : " . $sql_ins);
     $notice_retour = pmb_mysql_insert_id();
     audit::insert_creation(AUDIT_NOTICE, $notice_retour);
     if ($gestion_acces_active == 1) {
         $ac = new acces();
         //traitement des droits acces user_notice
         if ($gestion_acces_user_notice == 1) {
             $dom_1 = $ac->setDomain(1);
             $dom_1->storeUserRights(0, $notice_retour);
         }
         //traitement des droits acces empr_notice
         if ($gestion_acces_empr_notice == 1) {
             $dom_2 = $ac->setDomain(2);
             $dom_2->storeUserRights(0, $notice_retour);
         }
     }
     // purge de la base des responsabilités de la notice intégrée...
     if ($notice_retour) {
         $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'";
         $sql_result_del = pmb_mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del);
     }
     $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre ) VALUES ";
     for ($i = 0; $i < sizeof($this->aut_array); $i++) {
         $aut['id'] = clean_string($this->aut_array[$i]['id']);
         $aut['name'] = clean_string($this->aut_array[$i]['entree']);
         $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']);
         $aut['date'] = clean_string($this->aut_array[$i]['date']);
         $aut['type'] = $this->aut_array[$i]['type_auteur'];
         $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']);
         $aut['numero'] = clean_string($this->aut_array[$i]['numero']);
         $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']);
         $aut['ville'] = clean_string($this->aut_array[$i]['ville']);
         $aut['pays'] = clean_string($this->aut_array[$i]['pays']);
         $aut['web'] = clean_string($this->aut_array[$i]['web']);
         $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']);
         $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']);
         /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */
         $id_origine_auth = 0;
         $id_origine_auth = origin_authorities::import($this->origine_notice);
         if ($id_origine_auth == 0) {
             $id_origine_auth = 1;
         }
         // import de l'autorité auteur si elle existe et conservation des infos sur l'origine de l'autorité
         if ($aut['authority_number'] != '' && $id_origine_auth) {
             $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut);
         }
         if (!$this->aut_array[$i]["id"]) {
             $this->aut_array[$i]["id"] = auteur::import($aut);
         }
         if ($this->aut_array[$i]["id"]) {
             $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") ";
             $res_ins = pmb_mysql_query($rqt, $dbh);
         }
     }
     // traitement des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if (count($this->titres_uniformes)) {
             $ntu = new tu_notice($notice_retour);
             $ntu->update($this->titres_uniformes);
         }
     }
     // traitement des langues
     // langues de la publication
     $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' ";
     $res_del = pmb_mysql_query($rqt_del, $dbh);
     if (is_array($this->language_code) && count($this->language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     // langues originales
     if (is_array($this->original_language_code) && count($this->original_language_code)) {
         $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES ";
         foreach ($this->original_language_code as $ordre_lang => $code_lang) {
             if ($code_lang) {
                 $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) ";
                 $res_ins = @pmb_mysql_query($rqt, $dbh);
             }
         }
     }
     // traitement des categories
     if ($this->categorisation_type == "categorisation_auto") {
         traite_categories_enreg($notice_retour, $this->categories);
     } else {
         $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' ";
         $res_del = @pmb_mysql_query($rqt_del, $dbh);
         $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ";
         $rqt_ins_values = array();
         foreach ($this->categories as $i => $category) {
             $id_categ = $category['categ_id'];
             if ($id_categ) {
                 $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) ";
             }
         }
         $rqt_ins .= implode(",", $rqt_ins_values);
         $res_ins = @pmb_mysql_query($rqt_ins, $dbh);
     }
     //Traitement des champs personnalisés (du formulaire !!!)
     $p_perso = new parametres_perso("notices");
     $nberrors = $p_perso->check_submited_fields();
     $p_perso->rec_fields_perso($notice_retour);
     //Traitement import perso
     global $notice_id, $notice_org, $notice_type_org;
     if (function_exists('z_recup_noticeunimarc_suite') && function_exists('z_import_new_notice_suite')) {
         $notice_id = $notice_retour;
         if (!$notice_org) {
             $notice_tmp = $this->notice;
         }
         z_recup_noticeunimarc_suite($notice_tmp ? $notice_tmp : $notice_org);
         z_import_new_notice_suite();
         $notice_tmp = "";
     }
     //Recherche du titre uniforme automatique
     //global $opac_enrichment_bnf_sparql;
     //$opac_enrichment_bnf_sparql=1;
     $titre_uniforme = notice::getAutomaticTu($notice_retour);
     //Traitement upload vignette
     if (trim($this->flag_upload_vignette)) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
         }
         //le fichier
         if (file_exists($rep->repertoire_path . $this->flag_upload_vignette)) {
             rename($rep->repertoire_path . $this->flag_upload_vignette, $rep->repertoire_path . "img_" . $notice_retour);
         }
         //le champ
         $rqt_upd = "UPDATE notices SET thumbnail_url='" . addslashes($opac_url_base . "getimage.php?noticecode=&vigurl=&notice_id=" . $notice_retour) . "' WHERE notice_id=" . $notice_retour;
         $res_ins = @pmb_mysql_query($rqt_upd, $dbh);
     }
     // Mise à jour des index de la notice
     notice::majNotices($notice_retour);
     // Mise à jour de la table notices_global_index
     notice::majNoticesGlobalIndex($notice_retour);
     // Mise à jour de la table notices_mots_global_index
     notice::majNoticesMotsGlobalIndex($notice_retour);
     //Calcul de la signature
     $sign = new notice_doublon();
     $val = $sign->gen_signature($notice_retour);
     pmb_mysql_query("update notices set signature='{$val}' where notice_id=" . $notice_retour, $dbh);
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
     }
     //Si on catalogue un article on recrée l'arborescence
     global $biblio_notice;
     //TODO AR
     //gérer le cas du bulletin (revient à intégrer le pério uniquement)
     if ($biblio_notice == 'art') {
         //Perios
         if (!$this->perio_id) {
             $new_perio = new serial();
             $values = array();
             $values['tit1'] = $this->perio_titre;
             $values['code'] = $this->perio_issn;
             $values['niveau_biblio'] = "s";
             $values['niveau_hierar'] = "1";
             $this->perio_id = $new_perio->update($values);
             //synchro_rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf->addRdf($this->perio_id, 0);
             }
         }
         //Bulletin
         if ($this->bull_id) {
             $req_art = "insert into analysis set analysis_bulletin='" . $this->bull_id . "',\n\t\t\t\t\tanalysis_notice='" . $notice_retour . "'";
             pmb_mysql_query($req_art, $dbh);
             $req = "update bulletins set bulletin_notice='" . $this->perio_id . "' where bulletin_id='" . $this->bull_id . "'";
             pmb_mysql_query($req, $dbh);
         } else {
             $new_bull = new bulletinage(0, $this->perio_id);
             $values = array();
             $values['bul_no'] = $this->bull_num;
             $values['bul_date'] = $this->bull_mention;
             $values['date_date'] = $this->bull_date;
             $values['bul_titre'] = $this->bull_titre;
             $new_bull->update($values);
             $this->bull_id = $new_bull->bulletin_id;
             $req_art = "insert into analysis set analysis_bulletin='" . $this->bull_id . "',\n\t\t\t\t\tanalysis_notice='" . $notice_retour . "'";
             pmb_mysql_query($req_art, $dbh);
             //synchro_rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf->addRdf(0, $this->bull_id);
             }
         }
     } else {
         if ($biblio_notice == "bull") {
             //Perios
             if (!$this->perio_id) {
                 $new_perio = new serial();
                 $values = array();
                 $values['tit1'] = $this->perio_titre;
                 $values['code'] = $this->perio_issn;
                 $values['niveau_biblio'] = "s";
                 $values['niveau_hierar'] = "1";
                 $this->perio_id = $new_perio->update($values);
                 //synchro_rdf
                 if ($pmb_synchro_rdf) {
                     $synchro_rdf->addRdf($this->perio_id, 0);
                 }
             }
             if (!$this->bull_id) {
                 $new_bull = new bulletinage(0, $this->perio_id);
                 $values = array();
                 $values['bul_no'] = $this->bull_num;
                 $values['bul_date'] = $this->bull_mention;
                 $values['date_date'] = $this->bull_date;
                 $values['bul_titre'] = $this->bull_titre;
                 $new_bull->update($values);
                 $this->bull_id = $new_bull->bulletin_id;
                 //synchro_rdf
                 if ($pmb_synchro_rdf) {
                     $synchro_rdf->addRdf(0, $this->bull_id);
                 }
                 // 				$req = "update bulletins set bulletin_notice='".$this->perio_id."',num_notice='".$notice_retour."'  where bulletin_id='".$this->bull_id."'";
                 // 				pmb_mysql_query($req,$dbh);				//Faire un update en mettant l'id de la notice crée
                 //file_put_contents('php://stderr', print_r($this->bull_id, true));
             }
             if ($this->bull_notice) {
                 $notice_bulletin = new notice();
                 $notice_bulletin->del_notice($notice_retour);
                 $notice_retour = $this->bull_notice;
             }
             //Mise à jour de la table bulletins, ajout de la relation entre le bulletins et sa notice
             $req = "update bulletins set bulletin_notice='" . $this->perio_id . "',num_notice='" . $notice_retour . "'  where bulletin_id='" . $this->bull_id . "'";
             pmb_mysql_query($req, $dbh);
             //Insertion dans la table notices_relation, ajout de la relatioin entre la notice de bulletin et la notice de perio
             $req = "insert into notices_relations (num_notice, linked_notice, relation_type,rank) values('" . $notice_retour . "', '" . $this->perio_id . "', 'b','1')";
             pmb_mysql_query($req, $dbh);
         }
     }
     //file_put_contents('php://stderr', print_r($notice_retour."\n", true));
     //Exemplaires
     if (count($this->exemplaires)) {
         //			global $section_995, $typdoc_995, $codstatdoc_995;
         // 			, $nb_expl_ignores;
         $section_995_ = new marc_list("section_995");
         $section_995 = $section_995_->table;
         $typdoc_995_ = new marc_list("typdoc_995");
         $typdoc_995 = $typdoc_995_->table;
         $codstatdoc_995_ = new marc_list("codstatdoc_995");
         $codstatdoc_995 = $codstatdoc_995_->table;
         // 			$nb_expl_ignores=0;
         global $deflt_docs_statut, $deflt_docs_location, $deflt_lenders;
         foreach ($this->exemplaires as $info_expl) {
             /* RAZ expl */
             $expl = array();
             if ($notice_retour) {
                 /* préparation du tableau à passer à la méthode */
                 $expl['cb'] = $info_expl['f'];
                 //TODO AR
                 // les raccrocher au bulletin et non sa notice
                 // dans un second temps
                 if ($this->bibliographic_level == "s" && $this->hierarchic_level == "2") {
                     if ($this->bull_id) {
                         $expl['notice'] = 0;
                         $expl['bulletin'] = $this->bull_id;
                     } else {
                         if (!$this->bull_id && $notice_retour) {
                             $expl['notice'] = $notice_retour;
                             $expl['bulletin'] = 0;
                         }
                     }
                 } else {
                     $expl['notice'] = $notice_retour;
                     $expl['bulletin'] = 0;
                 }
                 //$expl['bulletin']	= 0;
                 // $expl['typdoc']     = $info_995['r']; à chercher dans docs_typdoc
                 $data_doc = array();
                 //$data_doc['tdoc_libelle'] = $info_995['r']." -Type doc importé (".$book_lender_id.")";
                 $data_doc['tdoc_libelle'] = $typdoc_995[$info_expl['r']];
                 if (!$data_doc['tdoc_libelle']) {
                     $data_doc['tdoc_libelle'] = "\$r non conforme -" . $info_expl['r'] . "-";
                 }
                 $data_doc['duree_pret'] = 0;
                 /* valeur par défaut */
                 $data_doc['tdoc_codage_import'] = $info_expl['r'];
                 if ($tdoc_codage) {
                     $data_doc['tdoc_owner'] = $deflt_lenders;
                 } else {
                     $data_doc['tdoc_owner'] = 0;
                 }
                 $expl['typdoc'] = docs_type::import($data_doc);
                 $expl['cote'] = $info_expl['k'];
                 // $expl['section']    = $info_995['q']; à chercher dans docs_section
                 $data_doc = array();
                 $info_expl['q'] = trim($info_expl['q']);
                 if (!$info_expl['q']) {
                     $info_expl['q'] = "u";
                 }
                 $data_doc['section_libelle'] = $section_995[$info_expl['q']];
                 $data_doc['sdoc_codage_import'] = $info_expl['q'];
                 if ($sdoc_codage) {
                     $data_doc['sdoc_owner'] = $deflt_lenders;
                 } else {
                     $data_doc['sdoc_owner'] = 0;
                 }
                 $expl['section'] = docs_section::import($data_doc);
                 $expl['statut'] = $deflt_docs_statut;
                 if ($info_expl['a']) {
                     $expl['location'] = $info_expl['a'];
                 } else {
                     $expl['location'] = $deflt_docs_location;
                 }
                 // $expl['codestat']   = $info_995['q']; 'q' utilisé, éventuellement à fixer par combo_box
                 $data_doc = array();
                 //$data_doc['codestat_libelle'] = $info_995['q']." -Pub visé importé (".$book_lender_id.")";
                 $data_doc['codestat_libelle'] = $codstatdoc_995[$info_expl['q']];
                 $data_doc['statisdoc_codage_import'] = $info_expl['q'];
                 if ($statisdoc_codage) {
                     $data_doc['statisdoc_owner'] = $deflt_lenders;
                 } else {
                     $data_doc['statisdoc_owner'] = 0;
                 }
                 $expl['codestat'] = docs_codestat::import($data_doc);
                 $expl['note'] = $info_expl['u'];
                 $expl['expl_owner'] = $deflt_lenders;
                 if ($info_expl['m']) {
                     $expl['date_depot'] = substr($info_expl['m'], 0, 4) . "-" . substr($info_expl['m'], 4, 2) . "-" . substr($info_expl['m'], 6, 2);
                 }
                 if ($info_expl['n']) {
                     $expl['date_retour'] = substr($info_expl['n'], 0, 4) . "-" . substr($info_expl['n'], 4, 2) . "-" . substr($info_expl['n'], 6, 2);
                 }
                 exemplaire::import($expl);
             }
         }
     }
     //Documents numériques
     global $deflt_explnum_statut;
     foreach ($this->doc_nums as $doc_num) {
         if (!$doc_num['a']) {
             continue;
         }
         if (!$doc_num['s']) {
             $doc_num['s'] = $deflt_explnum_statut;
         }
         if ($doc_num['__nodownload__']) {
             if ($this->bibliographic_level == "b" && $this->hierarchic_level == "2") {
                 explnum_add_url($notice_retour, $this->bull_id, $doc_num['b'], $doc_num['a'], $doc_num['s']);
             } else {
                 explnum_add_url($notice_retour, 0, $doc_num['b'], $doc_num['a'], $doc_num['s']);
             }
         } else {
             if ($this->bibliographic_level == "b" && $this->hierarchic_level == "2") {
                 explnum_add_from_url($notice_retour, $this->bull_id, $doc_num['b'], $doc_num['a'], true, $this->source_id, $doc_num['f'], $doc_num['p'], $doc_num['s']);
             } else {
                 explnum_add_from_url($notice_retour, 0, $doc_num['b'], $doc_num['a'], true, $this->source_id, $doc_num['f'], $doc_num['p'], $doc_num['s']);
             }
         }
     }
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf->addRdf($notice_retour, 0);
     }
     $retour = array($new_notice, $notice_retour);
     return $retour;
 }
 function update()
 {
     global $dbh, $gestion_acces_active, $gestion_acces_empr_notice;
     //Si la recherche est encore bonne, on la garde.
     if (!$this->outdated) {
         return;
     }
     $table = $this->search->make_search();
     if ($table) {
         //Mise en cache de la recherche brute
         $sql = "REPLACE INTO es_searchcache (es_searchcache_searchid, es_searchcache_date, es_searchcache_serializedsearch) VALUES ('" . addslashes($this->search_realm) . "_" . $this->search_unique_id . "', NOW(), '" . addslashes($this->serialized_search) . "')";
         pmb_mysql_query($sql, $dbh);
         //Et on vide le cache!
         $this->cache->delete_objectref_list(CACHE_TYPE_NOTICE, $this->search_realm . "_" . $this->search_unique_id, 'pmbesSearch');
         //Et on remplit le cache!
         //Vérifions si le champs de pertinence existe bien
         $has_pert = false;
         $result_fields = pmb_mysql_query("SHOW COLUMNS FROM " . $table);
         while ($row_field = pmb_mysql_fetch_assoc($result_fields)) {
             if ($row_field["Field"] == "pert") {
                 $has_pert = true;
             }
         }
         //Adaptons la requete en fonction de la présence de la pertinence
         if ($has_pert) {
             if ($this->external_search) {
                 $requete = "select {$table}.notice_id, {$table}.pert from {$table} ";
             } else {
                 $requete = "select {$table}.notice_id, {$table}.pert from {$table}, notices where {$table}.notice_id=notices.notice_id ";
             }
         } else {
             if ($this->external_search) {
                 $requete = "select {$table}.notice_id, '' from {$table} ";
             } else {
                 $requete = "select {$table}.notice_id, '' from {$table}, notices where {$table}.notice_id=notices.notice_id ";
             }
         }
         $this->cache->encache_objectref_list_from_select_with_content(CACHE_TYPE_NOTICE, $this->search_realm . "_" . $this->search_unique_id, 'pmbesSearch', $requete);
         //Si on a un utilisateur, on doit filtrer les résultats pour gérer les histoires de droits, ce qui créer une nouvelle recherche.
         if ($this->PMBUserId != -1) {
             $this->search->filter_searchtable_from_accessrights($table, $this->PMBUserId);
             //Et rebelote pour les trois requetes
             $this->search_unique_id .= "_" . $this->PMBUserId;
             //Mise en cache de la recherche brute
             $sql = "REPLACE INTO es_searchcache (es_searchcache_searchid, es_searchcache_date, es_searchcache_serializedsearch) VALUES ('" . addslashes($this->search_realm) . "_" . $this->search_unique_id . "', NOW(), '" . addslashes($this->serialized_search) . "')";
             pmb_mysql_query($sql, $dbh);
             //Et on vide le cache!
             $this->cache->delete_objectref_list(CACHE_TYPE_NOTICE, $this->search_realm . "_" . $this->search_unique_id, 'pmbesSearch');
             //Et on remplit le cache!
             //Vérifions si le champs de pertinence existe bien
             $has_pert = false;
             $result_fields = pmb_mysql_query("SHOW COLUMNS FROM " . $table);
             while ($row_field = pmb_mysql_fetch_assoc($result_fields)) {
                 if ($row_field["Field"] == "pert") {
                     $has_pert = true;
                 }
             }
             //Adaptons la requete en fonction de la présence de la pertinence
             if ($has_pert) {
                 $requete = "select {$table}.notice_id, {$table}.pert from {$table}, notices where {$table}.notice_id=notices.notice_id ";
             } else {
                 $requete = "select {$table}.notice_id, '' from {$table}, notices where {$table}.notice_id=notices.notice_id ";
             }
             $this->cache->encache_objectref_list_from_select_with_content(CACHE_TYPE_NOTICE, $this->search_realm . "_" . $this->search_unique_id, 'pmbesSearch', $requete);
         }
         //Si on a un emprunteur on doit filtrer aussi les résultats et donc créer encore une nouvelle recherche
         if ($this->OPACEmprId != -1) {
             //Partie copiée depuis les fichiers de recherche de l'opac:
             $acces_j = '';
             if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
                 $ac = new acces();
                 $dom_2 = $ac->setDomain(2);
                 $acces_j = $dom_2->getJoin($this->OPACEmprId, 4, 'notice_id');
             }
             if ($acces_j) {
                 $statut_j = '';
                 $statut_r = '';
             } else {
                 $user_code = pmb_mysql_result(pmb_mysql_query("SELECT empr_login FROM empr WHERE id_empr = " . $this->OPACEmprId), 0, 0);
                 $statut_j = ',notice_statut';
                 $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($user_code ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
             }
             //Et rebelote pour les trois requetes
             $this->search_unique_id .= "_E" . $this->OPACEmprId;
             //Mise en cache de la recherche brute
             $sql = "REPLACE INTO es_searchcache (es_searchcache_searchid, es_searchcache_date, es_searchcache_serializedsearch) VALUES ('" . addslashes($this->search_realm) . "_" . $this->search_unique_id . "', NOW(), '" . addslashes($this->serialized_search) . "')";
             pmb_mysql_query($sql, $dbh);
             //Et on vide le cache!
             $this->cache->delete_objectref_list(CACHE_TYPE_NOTICE, $this->search_realm . "_" . $this->search_unique_id, 'pmbesSearch');
             //Et on remplit le cache!
             //Vérifions si le champs de pertinence existe bien
             $has_pert = false;
             $result_fields = pmb_mysql_query("SHOW COLUMNS FROM " . $table);
             while ($row_field = pmb_mysql_fetch_assoc($result_fields)) {
                 if ($row_field["Field"] == "pert") {
                     $has_pert = true;
                 }
             }
             //Adaptons la requete en fonction de la présence de la pertinence
             if ($has_pert) {
                 $requete = "select {$table}.notice_id, {$table}.pert from {$table}, notices {$acces_j} {$statut_j} where {$table}.notice_id=notices.notice_id {$statut_r} ";
             } else {
                 $requete = "select {$table}.notice_id, '' from {$table}, notices {$acces_j} {$statut_j} where {$table}.notice_id=notices.notice_id {$statut_r} ";
             }
             $this->cache->encache_objectref_list_from_select_with_content(CACHE_TYPE_NOTICE, $this->search_realm . "_" . $this->search_unique_id, 'pmbesSearch', $requete);
         }
     }
     pmb_mysql_query("drop table if exists {$table}", $dbh);
     $this->outdated = false;
 }
Esempio n. 12
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;
}
Esempio n. 13
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: acces.inc.php,v 1.2 2009-07-28 17:01:08 dbellamy Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
//droits d'acces actives
if ($gestion_acces_active == 1) {
    require_once "{$class_path}/acces.class.php";
    $ac = new acces();
}
//droits d'acces utilisateur/notice
if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1 && $dom_id == 1) {
    $dom = $ac->setDomain(1);
}
//droits d'acces emprunteur/notice
if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1 && $dom_id == 2) {
    $dom = $ac->setDomain(2);
}
if (is_object($dom)) {
    switch ($fname) {
        case 'getNbResourcesToUpdate':
            $nb = $dom->getNbResourcesToUpdate();
            ajax_http_send_response($nb);
            break;
        case 'updateRessources':
            if (!$nb_done) {
                $nb_done = 0;
Esempio n. 14
0
 function filterExplnums($query)
 {
     global $gestion_acces_active, $gestion_acces_empr_docnum;
     global $webdav_current_user_id;
     switch ($this->config['authentication']) {
         case "gestion":
             //pas de controle particulier de ce coté là...
             break;
         case "opac":
             $acces_j = '';
             //droit d'accès ou statut
             if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
                 $ac = new \acces();
                 $dom_3 = $ac->setDomain(3);
                 $acces_j = $dom_3->getJoin($webdav_current_user_id, 16, 'explnum_id');
                 $query = "select distinct explnum_id from (" . $query . ") as uni " . $acces_j;
             } else {
                 $query = "select distinct uni.explnum_id from (" . $query . ") as uni join explnum on uni.explnum_id = explnum.explnum_id join explnum_statut on explnum.explnum_docnum_statut = id_explnum_statut where explnum_visible_opac=1";
             }
             break;
         case "anonymous":
             $acces_j = '';
             //droit d'accès ou statut
             if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
                 $ac = new \acces();
                 $dom_3 = $ac->setDomain(3);
                 $acces_j = $dom_3->getJoin(0, 16, 'explnum_id');
                 $query = "select distinct explnum_id from (" . $query . ") as uni " . $acces_j;
             } else {
                 $query = "select distinct uni.explnum_id from (" . $query . ") as uni join explnum on uni.explnum_id = explnum.explnum_id join explnum_statut on explnum.explnum_docnum_statut = id_explnum_statut where explnum_visible_opac=1 and explnum_visible_opac_abon=0";
             }
             break;
     }
     return $query;
 }
 function also_borrowed($notice_id = 0, $bulletin_id = 0)
 {
     global $dbh, $msg;
     global $opac_autres_lectures_tri;
     global $opac_autres_lectures_nb_mini_emprunts;
     global $opac_autres_lectures_nb_maxi;
     global $opac_autres_lectures_nb_jours_maxi;
     global $opac_autres_lectures;
     global $gestion_acces_active, $gestion_acces_empr_notice;
     $results = array();
     if (!$opac_autres_lectures || !$notice_id && !$bulletin_id) {
         return $results;
     }
     if (!$opac_autres_lectures_nb_maxi) {
         $opac_autres_lectures_nb_maxi = 999999;
     }
     if ($opac_autres_lectures_nb_jours_maxi) {
         $restrict_date = " date_add(oal.arc_fin, INTERVAL {$opac_autres_lectures_nb_jours_maxi} day)>=sysdate() AND ";
     }
     if ($notice_id) {
         $pas_notice = " oal.arc_expl_notice!={$notice_id} AND ";
     }
     if ($bulletin_id) {
         $pas_bulletin = " oal.arc_expl_bulletin!={$bulletin_id} AND ";
     }
     // Ajout ici de la liste des notices lues par les lecteurs de cette notice
     $rqt_autres_lectures = "SELECT oal.arc_expl_notice, oal.arc_expl_bulletin, count(*) AS total_prets,\n\t\t\t\t\ttrim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if(mention_date, concat(' (',mention_date,')') ,if (date_date, concat(' (',date_format(date_date, '%d/%m/%Y'),')') ,'')))) as tit, if(notices_m.notice_id, notices_m.notice_id, notices_s.notice_id) as not_id \n\t\t\t\tFROM ((((pret_archive AS oal JOIN\n\t\t\t\t\t(SELECT distinct arc_id_empr FROM pret_archive nbec where (nbec.arc_expl_notice='" . $notice_id . "' AND nbec.arc_expl_bulletin='" . $bulletin_id . "') AND nbec.arc_id_empr !=0) as nbec\n\t\t\t\t\tON (oal.arc_id_empr=nbec.arc_id_empr and oal.arc_id_empr!=0 and nbec.arc_id_empr!=0))\n\t\t\t\t\tLEFT JOIN notices AS notices_m ON arc_expl_notice = notices_m.notice_id )\n\t\t\t\t\tLEFT JOIN bulletins ON arc_expl_bulletin = bulletins.bulletin_id) \n\t\t\t\t\tLEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id)\n\t\t\t\tWHERE {$restrict_date} {$pas_notice} {$pas_bulletin} oal.arc_id_empr !=0\n\t\t\t\tGROUP BY oal.arc_expl_notice, oal.arc_expl_bulletin\n\t\t\t\tHAVING total_prets>={$opac_autres_lectures_nb_mini_emprunts} \n\t\t\t\tORDER BY {$opac_autres_lectures_tri} \n\t\t\t\t";
     $res_autres_lectures = pmb_mysql_query($rqt_autres_lectures);
     if (!$res_autres_lectures) {
         return $results;
     }
     if (pmb_mysql_num_rows($res_autres_lectures)) {
         $odd_even = 1;
         $inotvisible = 0;
         $aresult = array();
         //droits d'acces emprunteur/notice
         $acces_j = '';
         if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
             $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 = '';
             $statut_r = '';
         } else {
             $statut_j = ',notice_statut';
             $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
         }
         while ($data = pmb_mysql_fetch_array($res_autres_lectures)) {
             // $inotvisible<=$opac_autres_lectures_nb_maxi
             $requete = "SELECT  1  ";
             $requete .= " FROM notices {$acces_j} {$statut_j}  WHERE notice_id='" . $data[not_id] . "' {$statut_r} ";
             $myQuery = pmb_mysql_query($requete, $dbh);
             if (pmb_mysql_num_rows($myQuery) && $inotvisible <= $opac_autres_lectures_nb_maxi) {
                 // pmb_mysql_num_rows($myQuery)
                 $inotvisible++;
                 $titre = $data['tit'];
                 // **********
                 $responsab = array("responsabilites" => array(), "auteurs" => array());
                 // les auteurs
                 $responsab = get_notice_authors($data['not_id']);
                 $as = array_search("0", $responsab["responsabilites"]);
                 if ($as !== FALSE && $as !== NULL) {
                     $auteur_0 = $responsab["auteurs"][$as];
                     $auteur = new auteur($auteur_0["id"]);
                     $mention_resp = $auteur->isbd_entry;
                 } else {
                     $as = array_keys($responsab["responsabilites"], "1");
                     for ($i = 0; $i < count($as); $i++) {
                         $indice = $as[$i];
                         $auteur_1 = $responsab["auteurs"][$indice];
                         $auteur = new auteur($auteur_1["id"]);
                         $aut1_libelle[] = $auteur->isbd_entry;
                     }
                     $mention_resp = implode(", ", $aut1_libelle);
                 }
                 $mention_resp ? $auteur = $mention_resp : ($auteur = "");
                 // on affiche les résultats
                 if ($odd_even == 0) {
                     $pair_impair = "odd";
                     $odd_even = 1;
                 } else {
                     if ($odd_even == 1) {
                         $pair_impair = "even";
                         $odd_even = 0;
                     }
                 }
                 $aresult["notice_id"] = $data['not_id'];
                 $aresult["notice_title"] = $titre;
                 $aresult["notice_author"] = $auteur;
                 $results[] = $aresult;
             }
         }
     }
     return $results;
 }
Esempio n. 16
0
     }
 }
 if ($acreer) {
     $requete = "INSERT INTO notices SET code='" . addslashes($pe_isbn) . "', tit1='{$pe_titre}', statut='{$pmb_pret_express_statut}', niveau_biblio='m', niveau_hierar='0', create_date=sysdate() ";
     $result = pmb_mysql_query($requete, $dbh);
     if (!$result) {
         die('ERROR PE: insert into notice');
     }
     $id_notice = pmb_mysql_insert_id();
     audit::insert_creation(AUDIT_NOTICE, $id_notice);
     notice::majNotices($id_notice);
     notice::majNoticesGlobalIndex($id_notice, 1);
     notice::majNoticesMotsGlobalIndex($id_notice);
     if ($gestion_acces_active == 1) {
         require_once "{$class_path}/acces.class.php";
         $ac = new acces();
         //traitement des droits acces user_notice
         if ($gestion_acces_user_notice == 1) {
             $dom_1 = $ac->setDomain(1);
             $dom_1->storeUserRights(0, $id_notice);
         }
         //traitement des droits acces empr_notice
         if ($gestion_acces_empr_notice == 1) {
             $dom_2 = $ac->setDomain(2);
             $dom_2->storeUserRights(0, $id_notice);
         }
     }
 }
 if (!$id_notice) {
     die('ERROR PE: aucun id_notice pour exemplaire...');
 }
Esempio n. 17
0
 function save()
 {
     global $dbh, $sujet, $idetat, $titre, $id_theme, $id_type;
     global $date_debut, $date_fin, $date_prevue, $idempr;
     global $iduser, $progression, $demandes_statut_notice, $pmb_type_audit;
     global $gestion_acces_active, $gestion_acces_user_notice, $gestion_acces_empr_notice;
     if ($this->id_demande) {
         //MODIFICATION
         $req = "update demandes set sujet_demande='" . $sujet . "',  \n\t\t\t\tnum_demandeur='" . $idempr . "', \n\t\t\t\tdate_demande='" . $date_debut . "', \n\t\t\t\tdeadline_demande='" . $date_fin . "',\n\t\t\t\tdate_prevue='" . $date_prevue . "', \n\t\t\t\tprogression='" . $progression . "',\n\t\t\t\ttitre_demande='" . $titre . "',\n\t\t\t\ttype_demande='" . $id_type . "',\n\t\t\t\ttheme_demande='" . $id_theme . "'";
         if ($idetat == 4 || $idetat == 5) {
             $req .= " ,num_user_cloture='" . SESSuserid . "'";
         }
         $req .= " where id_demande='" . $this->id_demande . "'";
         mysql_query($req, $dbh);
         $this->titre_demande = stripslashes($titre);
         $this->sujet_demande = stripslashes($sujet);
         $this->date_demande = $date_debut;
         $this->date_prevue = $date_prevue;
         $this->deadline_demande = $date_fin;
         $this->num_user = $iduser;
         $this->progression = $progression;
         $this->num_demandeur = $idempr;
         $this->type_demande = $id_type;
         $this->theme_demande = $id_theme;
     } else {
         //CREATION de la notice associée
         $req = "insert into notices set \n\t\t\t\ttit1='" . $titre . "',\n\t\t\t\tn_contenu='" . $sujet . "',\n\t\t\t\tstatut ='" . $demandes_statut_notice . "'\n\t\t\t\t";
         mysql_query($req, $dbh);
         $id_notice = mysql_insert_id();
         notice::majNotices($id_notice);
         if ($pmb_type_audit) {
             audit::insert_creation(AUDIT_NOTICE, $id_notice);
         }
         //droits d'acces
         if ($gestion_acces_active == 1) {
             $ac = new acces();
             //traitement des droits acces user_notice
             if ($gestion_acces_user_notice == 1) {
                 $dom_1 = $ac->setDomain(1);
                 $dom_1->storeUserRights(0, $id_notice);
             }
             //traitement des droits acces empr_notice
             if ($gestion_acces_empr_notice == 1) {
                 $dom_2 = $ac->setDomain(2);
                 $dom_2->storeUserRights(0, $id_notice);
             }
         }
         //CREATION de la demande
         $req = "insert into demandes set sujet_demande='" . $sujet . "', \n\t\t\t\tetat_demande='" . $idetat . "', \n\t\t\t\tnum_demandeur='" . $idempr . "', \n\t\t\t\tdate_demande='" . $date_debut . "', \n\t\t\t\tdate_prevue='" . $date_prevue . "', \n\t\t\t\tdeadline_demande='" . $date_fin . "', \n\t\t\t\tprogression='" . $progression . "',\n\t\t\t\ttitre_demande='" . $titre . "',\n\t\t\t\ttype_demande='" . $id_type . "',\n\t\t\t\ttheme_demande='" . $id_theme . "',\n\t\t\t\tnum_notice='" . $id_notice . "'";
         mysql_query($req, $dbh);
     }
     //Affectation du libellé du thème et du type
     $this->id_demande ? $id = $this->id_demande : ($id = mysql_insert_id());
     $req = "select libelle_theme, libelle_type from demandes d, demandes_type dy , demandes_theme dt where dt.id_theme=d.theme_demande and dy.id_type=d.type_demande and id_demande='" . $id . "'";
     $res = mysql_query($req, $dbh);
     $row = mysql_fetch_object($res);
     $this->type_libelle = $row->libelle_type;
     $this->theme_libelle = $row->libelle_theme;
     //Enregistrement dans demandes_users
     $date_creation = date("Y-m-d", time());
     if ($this->id_demande && $iduser) {
         $req = "update demandes_users set users_statut=0 where num_user not in (" . implode(',', $iduser) . ") and num_demande='" . $this->id_demande . "'";
         mysql_query($req, $dbh);
         $req = "update demandes_users set users_statut=1 where num_user in (" . implode(',', $iduser) . ") and num_demande='" . $this->id_demande . "'";
         mysql_query($req, $dbh);
         for ($i = 0; $i < sizeof($iduser); $i++) {
             $req = "insert into demandes_users set num_user='******', num_demande='" . $this->id_demande . "', date_creation='" . $date_creation . "', users_statut=1";
             mysql_query($req, $dbh);
         }
     } else {
         if ($iduser) {
             for ($i = 0; $i < sizeof($iduser); $i++) {
                 $req = "insert into demandes_users set num_user='******', num_demande='" . $id . "', date_creation='" . $date_creation . "', users_statut=1";
                 mysql_query($req, $dbh);
             }
         }
     }
     $req = "select num_user, concat(prenom,' ',nom) as nom, username from demandes_users, users where num_user=userid and num_demande='" . $id . "' and users_statut=1";
     $res = mysql_query($req, $dbh);
     $i = 0;
     if (mysql_num_rows($res)) {
         $this->users = array();
         while ($user = mysql_fetch_object($res)) {
             $this->users[$i]['nom'] = trim($user->nom) ? $user->nom : $user->username;
             $this->users[$i]['id'] = $user->num_user;
             $i++;
         }
     }
 }
Esempio n. 18
0
 static function save_notice(&$demande)
 {
     global $dbh;
     global $demandes_notice_auto, $gestion_acces_active, $gestion_acces_user_notice, $gestion_acces_empr_notice;
     //CREATION de la notice associée
     if ($demandes_notice_auto === "1") {
         $query = "INSERT INTO notices SET\n\t\t\ttit1='" . $demande->notice->tit1 . "',\n\t\t\tn_contenu='" . $demande->notice->n_contenu . "',\n\t\t\tstatut ='" . $demande->notice->statut . "'";
         pmb_mysql_query($query, $dbh);
         $demande->num_notice = $demande->notice->num_notice = pmb_mysql_insert_id($dbh);
         notice::majNotices($demande->num_notice);
         if ($pmb_type_audit) {
             audit::insert_creation(AUDIT_NOTICE, $demande->num_notice);
         }
     }
     //droits d'acces
     if ($gestion_acces_active == 1) {
         $ac = new acces();
         //traitement des droits acces user_notice
         if ($gestion_acces_user_notice == 1) {
             $dom_1 = $ac->setDomain(1);
             $dom_1->storeUserRights(0, $id_notice);
         }
         //traitement des droits acces empr_notice
         if ($gestion_acces_empr_notice == 1) {
             $dom_2 = $ac->setDomain(2);
             $dom_2->storeUserRights(0, $id_notice);
         }
     }
 }
Esempio n. 19
0
 function has_notices($id = 0)
 {
     global $dbh;
     global $gestion_acces_active, $gestion_acces_empr_notice;
     global $class_path;
     if (is_object($this) && !$id) {
         $id = $this->id;
     }
     //droits d'acces emprunteur/notice
     $acces_j = '';
     if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
         $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 = '';
         $statut_r = '';
     } else {
         $statut_j = ',notice_statut';
         $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
     }
     $query = "select count(1) from notices_categories,notices {$acces_j} {$statut_j} ";
     $query .= "where (notices_categories.num_noeud='" . $id . "' and notices_categories.notcateg_notice=notice_id) {$statut_r} ";
     $result = mysql_query($query, $dbh);
     return mysql_result($result, 0, 0);
 }
Esempio n. 20
0
 function fetch_visibilite()
 {
     global $dbh;
     global $hide_explnum;
     global $gestion_acces_active, $gestion_acces_empr_notice;
     if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
         $ac = new acces();
         $this->dom_2 = $ac->setDomain(2);
         if ($hide_explnum) {
             $this->rights = $this->dom_2->getRights($_SESSION['id_empr_session'], $this->id, 4);
         } else {
             $this->rights = $this->dom_2->getRights($_SESSION['id_empr_session'], $this->id);
         }
     } else {
         $requete = "SELECT opac_libelle, notice_visible_opac, expl_visible_opac, notice_visible_opac_abon, expl_visible_opac_abon, explnum_visible_opac, explnum_visible_opac_abon FROM notice_statut WHERE id_notice_statut='" . $this->statut . "' ";
         $myQuery = pmb_mysql_query($requete, $dbh);
         if (pmb_mysql_num_rows($myQuery)) {
             $statut_temp = pmb_mysql_fetch_object($myQuery);
             $this->statut_notice = $statut_temp->opac_libelle;
             $this->visu_notice = $statut_temp->notice_visible_opac;
             $this->visu_notice_abon = $statut_temp->notice_visible_opac_abon;
             $this->visu_expl = $statut_temp->expl_visible_opac;
             $this->visu_expl_abon = $statut_temp->expl_visible_opac_abon;
             $this->visu_explnum = $statut_temp->explnum_visible_opac;
             $this->visu_explnum_abon = $statut_temp->explnum_visible_opac_abon;
             if ($hide_explnum) {
                 $this->visu_explnum = 0;
                 $this->visu_explnum_abon = 0;
             }
         }
     }
 }
Esempio n. 21
0
function explnum_allow_opac($no_notice, $no_bulletin)
{
    // params :
    global $dbh;
    global $gestion_acces_active, $gestion_acces_empr_notice;
    if (!$no_notice && !$no_bulletin) {
        return false;
    }
    $docnum_visible = true;
    $id_for_right = $no_notice;
    if ($no_bulletin) {
        $query = "select num_notice,bulletin_notice from bulletins where bulletin_id = " . $no_bulletin;
        $result = pmb_mysql_query($query);
        if (pmb_mysql_num_rows($result)) {
            $infos = pmb_mysql_fetch_object($result);
            if ($infos->num_notice) {
                $id_for_right = $infos->num_notice;
            } else {
                $id_for_right = $infos->bulletin_notice;
            }
        }
    }
    if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
        $ac = new acces();
        $dom_2 = $ac->setDomain(2);
        $docnum_visible = $dom_2->getRights(0, $id_for_right, 16);
    } else {
        $requete = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='" . $id_for_right . "' and id_notice_statut=statut ";
        $myQuery = pmb_mysql_query($requete, $dbh);
        if (pmb_mysql_num_rows($myQuery)) {
            $statut_temp = pmb_mysql_fetch_object($myQuery);
            if (!$statut_temp->explnum_visible_opac) {
                $docnum_visible = false;
            }
            if ($statut_temp->explnum_visible_opac_abon) {
                $docnum_visible = false;
            }
        } else {
            $docnum_visible = false;
        }
    }
    return $docnum_visible;
}
Esempio n. 22
0
function print_results($sc, $table, $url, $url_to_search_form, $hidden_form = true, $search_target = "")
{
    global $dbh;
    global $begin_result_liste;
    global $nb_per_page_search;
    global $page;
    global $charset;
    global $search;
    global $msg;
    global $pmb_nb_max_tri;
    global $affich_tris_result_liste;
    global $pmb_allow_external_search;
    global $show_results_data;
    global $option_show_expl, $option_show_notice_fille;
    global $gestion_acces_active, $gestion_acces_user_notice;
    global $PMBuserid;
    global $explr_invisible, $pmb_droits_explr_localises;
    //droits d'acces lecture notice
    if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) {
        $ac = new acces();
        $dom_1 = $ac->setDomain(1);
        $usr_prf = $dom_1->getUserProfile($PMBuserid);
        $requete = "delete from {$table} using {$table}, exemplaires, acces_res_1 ";
        $requete .= "where ";
        $requete .= "{$table}.expl_id=exemplaires.expl_id ";
        $requete .= "and expl_bulletin=0 ";
        $requete .= "and expl_notice = res_num ";
        $requete .= "and usr_prf_num=" . $usr_prf . " and (((res_rights ^ res_mask) & 4)=0) ";
        pmb_mysql_query($requete, $dbh);
        $requete = "delete from {$table} using {$table}, exemplaires, bulletins, acces_res_1 ";
        $requete .= "where ";
        $requete .= "{$table}.expl_id=exemplaires.expl_id ";
        $requete .= "and expl_notice=0 ";
        $requete .= "and expl_bulletin=bulletin_id ";
        $requete .= "and bulletin_notice=res_num ";
        $requete .= "and usr_prf_num=" . $usr_prf . " and (((res_rights ^ res_mask) & 4)=0) ";
        pmb_mysql_query($requete, $dbh);
    }
    //visibilité des exemplaires
    if ($pmb_droits_explr_localises && $explr_invisible) {
        $requete = "delete from {$table} using {$table}, exemplaires ";
        $requete .= "where ";
        $requete .= "{$table}.expl_id=exemplaires.expl_id ";
        $requete .= "and expl_location in ({$explr_invisible})";
        pmb_mysql_query($requete, $dbh);
    }
    $start_page = $nb_per_page_search * $page;
    $requete = "select count(1) from {$table}";
    $res = pmb_mysql_query($requete);
    if ($res) {
        $nb_results = pmb_mysql_result(pmb_mysql_query($requete), 0, 0);
    } else {
        $nb_results = 0;
    }
    $requete = "select {$table}.* from " . $table . ", exemplaires where exemplaires.expl_id={$table}.expl_id";
    if ($nb_results > $sc->nb_per_page) {
        $requete .= " limit " . $start_page . ", " . $nb_per_page_search;
    }
    //Y-a-t-il une erreur lors de la recherche ?
    if ($sc->error_message) {
        error_message_history("", $sc->error_message, 1);
        exit;
    }
    if ($hidden_form) {
        print $sc->make_hidden_search_form($url);
    }
    $resultat = pmb_mysql_query($requete, $dbh);
    $human_requete = $sc->make_human_query();
    print "<strong>" . $msg["search_search_exemplaire"] . "</strong> : " . $human_requete;
    if ($nb_results) {
        print " => " . $nb_results . " " . $msg["search_expl_nb_result"] . "<br />\n";
        print $begin_result_liste;
        if ($sc->rec_history) {
            //Affichage des liens paniers et impression
            $current = $_SESSION["CURRENT"];
            if ($current !== false) {
                print "&nbsp;<a href='#' onClick=\"openPopUp('./print_cart.php?current_print={$current}&action=print_prepare','print',600,700,-2,-2,'scrollbars=yes,menubar=0,resizable=yes'); return false;\"><img src='./images/basket_small_20x20.gif' border='0' align='center' alt=\"" . $msg["histo_add_to_cart"] . "\" title=\"" . $msg["histo_add_to_cart"] . "\"></a>&nbsp;";
                //				if ($nb_results<=$pmb_nb_max_tri) print $affich_tris_result_liste;
            }
        }
    } else {
        print "<br />" . $msg["1915"] . " ";
    }
    print "<input type='button' class='bouton' onClick=\"document.search_form.action='{$url_to_search_form}'; document.search_form.target='{$search_target}'; document.search_form.submit(); return false;\" value=\"" . $msg["search_back"] . "\"/>";
    // transformation de la recherche en multicritères: on reposte tout avec mode=6
    print "&nbsp;<input  type='button' class='bouton' onClick='document.search_transform.submit(); return false;' value=\"" . $msg["search_expl_to_notice_transformation"] . "\"/>";
    print "<form name='search_transform' action='./catalog.php?categ=search&mode=6&sub=launch'  method='post' style='display:none;'>";
    foreach ($_POST as $key => $val) {
        if ($val) {
            if (is_array($val)) {
                foreach ($val as $cle => $val_array) {
                    if (is_array($val_array)) {
                        foreach ($val_array as $valeur) {
                            print "<input type='hidden' name=\"" . $key . "[" . $cle . "][]\" value='" . htmlentities($valeur, ENT_QUOTES, $charset) . "'/>";
                        }
                    } else {
                        print "<input type='hidden' name='" . $key . "[]' value='" . htmlentities($val_array, ENT_QUOTES, $charset) . "'/>";
                    }
                }
            } else {
                print "<input type='hidden' name='{$key}' value='{$val}'/>";
            }
        }
    }
    print "</form>";
    $recherche_ajax_mode = 0;
    $nb = 0;
    if ($resultat) {
        while ($r = pmb_mysql_fetch_object($resultat)) {
            $requete2 = "SELECT expl_bulletin FROM exemplaires WHERE expl_id='" . $r->expl_id . "'";
            $res = pmb_mysql_query($requete2);
            if ($res && pmb_mysql_num_rows($res) && pmb_mysql_result($res, 0, 0)) {
                $nt = new mono_display_expl('', $r->expl_id, 6, $sc->link_bulletin, $option_show_expl, $sc->link_expl_bull, '', $sc->link_explnum, 1, 0, 1, !$option_show_notice_fille, "", 1);
            } else {
                $nt = new mono_display_expl('', $r->expl_id, 6, $sc->link, $option_show_expl, $sc->link_expl, '', $sc->link_explnum, 1, 0, 1, !$option_show_notice_fille, "", 1);
            }
            echo "<div class='row'>" . $nt->result . $aff . "</div>";
        }
    }
    //Gestion de la pagination
    if ($nb_results) {
        $n_max_page = ceil($nb_results / $nb_per_page_search);
        if (!$page) {
            $page_en_cours = 0;
        } else {
            $page_en_cours = $page;
        }
        // affichage du lien précédant si nécessaire
        if ($page > 0) {
            $nav_bar .= "<a href='#' onClick='document.search_form.page.value-=1; ";
            if (!$hidden_form) {
                $nav_bar .= "document.search_form.launch_search.value=1; ";
            }
            $nav_bar .= "document.search_form.submit(); return false;'>";
            $nav_bar .= "<img src='./images/left.gif' border='0'  title='" . $msg[48] . "' alt='[" . $msg[48] . "]' hspace='3' align='middle'/>";
            $nav_bar .= "</a>";
        }
        $deb = $page_en_cours - 10;
        if ($deb < 0) {
            $deb = 0;
        }
        for ($i = $deb; $i < $n_max_page && $i < $page_en_cours + 10; $i++) {
            if ($i == $page_en_cours) {
                $nav_bar .= "<strong>" . ($i + 1) . "</strong>";
            } else {
                $nav_bar .= "<a href='#' onClick=\"if ((isNaN(document.search_form.page.value))||(document.search_form.page.value=='')) document.search_form.page.value=1; else document.search_form.page.value=" . $i . "; ";
                if (!$hidden_form) {
                    $nav_bar .= "document.search_form.launch_search.value=1; ";
                }
                $nav_bar .= "document.search_form.submit(); return false;\">";
                $nav_bar .= $i + 1;
                $nav_bar .= "</a>";
            }
            if ($i < $n_max_page) {
                $nav_bar .= " ";
            }
        }
        if ($page + 1 < $n_max_page) {
            $nav_bar .= "<a href='#' onClick=\"if ((isNaN(document.search_form.page.value))||(document.search_form.page.value=='')) document.search_form.page.value=1; else document.search_form.page.value=parseInt(document.search_form.page.value)+parseInt(1); ";
            if (!$hidden_form) {
                $nav_bar .= "document.search_form.launch_search.value=1; ";
            }
            $nav_bar .= "document.search_form.submit(); return false;\">";
            $nav_bar .= "<img src='./images/right.gif' border='0' title='" . $msg[49] . "' alt='[" . $msg[49] . "]' hspace='3' align='middle'>";
            $nav_bar .= "</a>";
        } else {
            $nav_bar .= "";
        }
        $nav_bar = "<div align='center'>{$nav_bar}</div>";
        echo $nav_bar;
    }
}
Esempio n. 23
0
 print pmb_bidi($aut_link->get_display());
 print "</div><!-- fermeture #aut_see -->\n";
 // affichage des notices associées
 print "<div id='aut_details_liste'>\n";
 if ($ourAuteur->type == 72) {
     //Congrès
     print pmb_bidi("<h3>{$msg['documents_disponibles_meme_congres']}");
 } else {
     print pmb_bidi("<h3>{$msg['documents_disponibles_meme_auteur']}");
 }
 print "</h3>\n";
 //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 = '';
     $statut_r = '';
 } else {
     $statut_j = ',notice_statut';
     $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
 }
 if ($_SESSION["opac_view"] && $_SESSION["opac_view_query"]) {
     $opac_view_restrict = " notice_id in (select opac_view_num_notice from  opac_view_notices_" . $_SESSION["opac_view"] . ") ";
     $statut_r .= " and " . $opac_view_restrict;
 }
 // comptage des notices associées
Esempio n. 24
0
 function is_downloadable($explnum_id)
 {
     $docnum_downloadable = true;
     global $gestion_acces_active, $gestion_acces_empr_notice, $gestion_acces_empr_docnum;
     $query = "select explnum_notice,explnum_bulletin from explnum where explnum_id = " . $explnum_id;
     $result = pmb_mysql_query($query);
     if (pmb_mysql_num_rows($result)) {
         $infos = pmb_mysql_fetch_object($result);
         if ($infos->explnum_notice != 0) {
             $id_for_right = $infos->explnum_notice;
         } else {
             $query = "select num_notice,bulletin_notice from bulletins where bulletin_id = " . $infos->explnum_bulletin;
             $result = pmb_mysql_query($query);
             if (pmb_mysql_num_rows($result)) {
                 $infos = pmb_mysql_fetch_object($result);
                 if ($infos->num_notice) {
                     $id_for_right = $infos->num_notice;
                 } else {
                     $id_for_right = $infos->bulletin_notice;
                 }
             }
         }
     }
     if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
         $ac = new acces();
         $dom_2 = $ac->setDomain(2);
         $docnum_downloadable = $dom_2->getRights($_SESSION['id_empr_session'], $id_for_right, 16);
     } else {
         $requete = "SELECT explnum_visible_opac, explnum_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='" . $id_for_right . "' and id_notice_statut=statut ";
         $myQuery = pmb_mysql_query($requete);
         if (pmb_mysql_num_rows($myQuery)) {
             $statut_temp = pmb_mysql_fetch_object($myQuery);
             if (!$statut_temp->explnum_visible_opac) {
                 $docnum_downloadable = false;
             }
             if ($statut_temp->explnum_visible_opac_abon && !$_SESSION['id_empr_session']) {
                 $docnum_downloadable = false;
             }
         } else {
             $docnum_downloadable = false;
         }
     }
     //la notice autorise l'accès au document, on vérifie que le document lui-même est accessible
     if ($docnum_downloadable) {
         if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
             $ac = new acces();
             $dom_3 = $ac->setDomain(3);
             $docnum_downloadable = $dom_3->getRights($_SESSION['id_empr_session'], $explnum_id, 8);
         } else {
             $query = "select explnum_id from explnum join explnum_statut on id_explnum_statut = explnum_docnum_statut where explnum_id = " . $explnum_id . " and explnum_download_opac=1 " . (!$_SESSION['id_empr_session'] ? " and explnum_download_opac_abon = 0" : "");
             $result = pmb_mysql_query($query);
             if (!pmb_mysql_num_rows($result)) {
                 $docnum_downloadable = false;
             }
         }
     }
     return $docnum_downloadable;
 }
Esempio n. 25
0
function contenu_etagere($idetagere, $aff_notices_nb = 0, $mode_aff_notice = AFF_ETA_NOTICES_BOTH, $depliable = AFF_ETA_NOTICES_DEPLIABLES_OUI, $link_to_etagere = "", $link)
{
    global $charset, $msg;
    global $gestion_acces_active, $gestion_acces_empr_notice;
    global $class_path;
    //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 = '';
        $statut_r = '';
    } else {
        $statut_j = ',notice_statut';
        $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
    }
    if (!$idetagere) {
        return "";
    }
    $notices = array();
    //petit check rapide pour récupérer le tri imposé sur l'étagère...
    $idetagere += 0;
    $rqt = "select id_tri from etagere where idetagere=" . $idetagere;
    $res = mysql_query($rqt);
    if (mysql_num_rows($res)) {
        $id_tri = mysql_result($res, 0, 0);
    } else {
        $id_tri = 0;
    }
    //On récupère les notices associées à l'étagère
    notices_caddie($idetagere, $notices, $acces_j, $statut_j, $statut_r, $aff_notices_nb, $id_tri);
    if ($aff_notices_nb > 0) {
        $limite_notices = min($aff_notices_nb, count($notices));
    } elseif ($aff_notices_nb < 0) {
        $limite_notices = min($aff_notices_nb, count($notices));
    } else {
        $limite_notices = count($notices);
    }
    reset($notices);
    $limit = 0;
    while ((list($idnotice, $niveau_biblio) = each($notices)) && $limit < $limite_notices) {
        $limit++;
        $retour_aff .= aff_notice($idnotice, 0, 1, 0, $mode_aff_notice, $depliable);
    }
    if (count($notices) > $limite_notices && $link_to_etagere) {
        $retour_aff .= "<a href=\"" . str_replace("!!id!!", $idetagere, $link) . "\">";
        $retour_aff .= "<span class='etagere-suite'>" . $msg['etagere_suite'] . "</span>";
        $retour_aff .= "</a>";
    }
    return $retour_aff;
}
Esempio n. 26
0
function do_carroussel($bull)
{
    global $gestion_acces_active, $gestion_acces_empr_notice;
    global $msg;
    if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
        $ac = new acces();
        $dom_2 = $ac->setDomain(2);
        $join_noti = $dom_2->getJoin($_SESSION["id_empr_session"], 4, "bulletins.num_notice");
        $join_bull = $dom_2->getJoin($_SESSION["id_empr_session"], 4, "bulletins.bulletin_notice");
    } else {
        $join_noti = "join notices on bulletins.num_notice = notices.notice_id join notice_statut on notices.statut = notice_statut.id_notice_statut AND ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
        $join_bull = "join notices on bulletins.bulletin_notice = notices.notice_id join notice_statut on notices.statut = notice_statut.id_notice_statut AND ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
    }
    $requete_noti = "select bulletin_id, bulletin_numero, bulletin_notice, mention_date, date_date, bulletin_titre, bulletin_cb, date_format(date_date, '" . $msg["format_date_sql"] . "') as aff_date_date,num_notice from bulletins " . $join_noti . " where bulletins.num_notice != 0 and bulletin_notice = " . $bull['bulletin_notice'] . "";
    $requete_bull = "select bulletin_id, bulletin_numero, bulletin_notice, mention_date, date_date, bulletin_titre, bulletin_cb, date_format(date_date, '" . $msg["format_date_sql"] . "') as aff_date_date,num_notice from bulletins " . $join_bull . " where bulletins.num_notice  = 0 and bulletin_notice = " . $bull['bulletin_notice'] . "";
    $requete = "select * from (" . $requete_noti . " union " . $requete_bull . ") as uni";
    $requete = "(" . $requete . " where date_date < '" . $bull['date_date'] . "' order by date_date desc limit 0,3) union (" . $requete . " where date_date >= '" . $bull['date_date'] . "' order by date_date asc limit 0,4)";
    $res_caroussel = mysql_query($requete);
    if (mysql_num_rows($res_caroussel)) {
        $prev = true;
        $current = $previous = $next = array();
        while ($bullForNav = mysql_fetch_array($res_caroussel)) {
            if ($bullForNav['bulletin_id'] == $bull['bulletin_id']) {
                $prev = false;
                $current = $bullForNav;
            } else {
                if ($prev == true) {
                    $previous[] = $bullForNav;
                } else {
                    $next[] = $bullForNav;
                }
            }
        }
        $carroussel = "\n\t\t\t<table class='carroussel_bulletin' style=''>\n\t\t\t\t<tr>";
        $taille = 100;
        //on a des bulletins précédent
        if (sizeof($previous) > 0) {
            $taille = $taille - 4;
        }
        //on a des bulletins suivant
        if (sizeof($next) > 0) {
            $taille = $taille - 4;
        }
        //ceux d'avant
        //on égalise  : 3 de chaque coté
        if (sizeof($previous) > 0) {
            $carroussel .= "<td style='width:4%;'><a href='index.php?lvl=bulletin_display&id=" . $previous[0]['bulletin_id'] . "'><img align='middle' src='images/previous1.png'/></a></td>";
        }
        for ($i = 0; $i < 3 - sizeof($previous); $i++) {
            if ($i < 3 - sizeof($previous) - 1) {
                $carroussel .= "<td style='width:" . $taille / (3 * 2 + 1) . "%;'>&nbsp;</td>";
            } else {
                if (!($link_perio = get_perio_link($bull['bulletin_notice'], 'before'))) {
                    $carroussel .= "<td style='width:" . $taille / (3 * 2 + 1) . "%;'>&nbsp;</td>";
                } else {
                    $carroussel .= "<td class='active' style='width:" . $taille / (3 * 2 + 1) . "%;'>{$link_perio}</td>";
                }
            }
        }
        if (sizeof($previous) > 0) {
            for ($i = sizeof($previous) - 1; $i >= 0; $i--) {
                $carroussel .= "<td class='active' style='width:" . $taille / (3 * 2 + 1) . "%;'><a href='index.php?lvl=bulletin_display&id=" . $previous[$i]['bulletin_id'] . "'>" . $previous[$i]['bulletin_numero'] . ($previous[$i]['bulletin_titre'] ? " - " . $previous[$i]['bulletin_titre'] : "") . "<br />" . ($previous[$i]['mention_date'] ? $previous[$i]['mention_date'] : $previous[$i]['aff_date_date']) . "</a></td>";
            }
        }
        //le bull courant en évidence
        $carroussel .= "<td class='current_bull_carroussel' style='width:" . $taille / (3 * 2 + 1) . "%;'><a href='index.php?lvl=bulletin_display&id=" . $current['bulletin_id'] . "'>" . $current['bulletin_numero'] . ($current['bulletin_titre'] ? " - " . $current['bulletin_titre'] : "") . "<br />" . ($current['mention_date'] ? $current['mention_date'] : $current['aff_date_date']) . "</a></td>";
        //la suite
        if (sizeof($next) > 0) {
            for ($i = 0; $i < sizeof($next); $i++) {
                $carroussel .= "<td class='active' style='width:" . $taille / (3 * 2 + 1) . "%;'><a href='index.php?lvl=bulletin_display&id=" . $next[$i]['bulletin_id'] . "'>" . $next[$i]['bulletin_numero'] . ($next[$i]['bulletin_titre'] ? " - " . $next[$i]['bulletin_titre'] : "") . "<br />" . ($next[$i]['mention_date'] ? $next[$i]['mention_date'] : $next[$i]['aff_date_date']) . "</a></td>";
            }
        }
        //on égalise  : 3 de chaque coté
        for ($i = 0; $i < 3 - sizeof($next); $i++) {
            if ($i) {
                $carroussel .= "<td style='width:" . $taille / (3 * 2 + 1) . "%;'>&nbsp;</td>";
            } else {
                if (!($link_perio = get_perio_link($bull['bulletin_notice'], 'after'))) {
                    $carroussel .= "<td style='width:" . $taille / (3 * 2 + 1) . "%;'>&nbsp;</td>";
                } else {
                    $carroussel .= "<td class='active' style='width:" . $taille / (3 * 2 + 1) . "%;'>{$link_perio}</td>";
                }
            }
        }
        if (sizeof($next) > 0) {
            $carroussel .= "<td style='width:4%;'><a href='index.php?lvl=bulletin_display&id=" . $next[0]['bulletin_id'] . "'><img align='middle' src='images/next1.png'/></a></td>";
        }
        //on ferme le tout
        $carroussel .= "\n\t\t\t\t</tr>\n\t\t\t</table>";
    }
    return $carroussel;
}
Esempio n. 27
0
                if ($pmb_book_pics_show == '1' && ($pmb_book_pics_url && $stuff->code || $stuff->thumbnail_url)) {
                    print "<script type='text/javascript'>\n\t\t\t\t\t\t<!--\n\t\t\t\t\t\tvar img = document.getElementById('PMBimagecover" . $expl_lu->expl_notice . "');\n\t\t\t\t\t\tisbn=img.getAttribute('isbn');\n\t\t\t\t\t\turl_image=img.getAttribute('url_image');\n\t\t\t\t\t\tif (isbn) {\n\t\t\t\t\t\t\tif (img.src.substring(img.src.length-8,img.src.length)=='vide.png') {\n\t\t\t\t\t\t\t\timg.src=url_image.replace(/!!noticecode!!/,isbn);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\t\n\t\t\t\t\t\t//-->\n\t\t\t\t\t\t</script>\n\t\t\t\t\t\t";
                }
            } else {
                // exemplaire inconnu
                $alert_sound_list[] = "critique";
                print "<strong>{$form_cb_expl}&nbsp;: {$msg[367]}</strong>";
            }
        }
    }
} else {
    //droits d'acces lecture notice
    $acces_j = '';
    if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) {
        require_once "{$class_path}/acces.class.php";
        $ac = new acces();
        $dom_1 = $ac->setDomain(1);
        $acces_j = $dom_1->getJoin($PMBuserid, 4, 'notice_id');
    }
    // on commence par voir ce que la saisie utilisateur est ($ex_query)
    $ex_query = clean_string($ex_query);
    $EAN = '';
    $isbn = '';
    $code = '';
    if (isEAN($ex_query)) {
        // la saisie est un EAN -> on tente de le formater en ISBN
        $EAN = $ex_query;
        $isbn = EANtoISBN($ex_query);
        // si échec, on prend l'EAN comme il vient
        if (!$isbn) {
            $code = str_replace("*", "%", $ex_query);
Esempio n. 28
0
 function make_search()
 {
     global $gestion_acces_active, $gestion_acces_empr_notice, $class_path;
     //    	var_dump($_SESSION);
     $id = $_SESSION['last_module_search']['search_id'];
     $location = $_SESSION['last_module_search']['search_location'];
     $plettreaut = $_SESSION["last_module_search"]["search_plettreaut"];
     $dcote = $_SESSION["last_module_search"]["search_dcote"];
     $lcote = $_SESSION["last_module_search"]["search_lcote"];
     $nc = $_SESSION["last_module_search"]["search_nc"];
     $ssub = $_SESSION["last_module_search"]["search_ssub"];
     /*
      * récupérer les infos de session
      */
     $requete = "SELECT num_pclass FROM docsloc_section WHERE num_location='" . $location . "' AND num_section='" . $id . "' ";
     $res = pmb_mysql_query($requete);
     $type_aff_navigopac = 0;
     if (pmb_mysql_num_rows($res)) {
         $type_aff_navigopac = pmb_mysql_result($res, 0, 0);
     }
     //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 = '';
         $statut_r = '';
     } else {
         $statut_j = ',notice_statut';
         $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")";
     }
     if ($_SESSION["opac_view"] && $_SESSION["opac_view_query"]) {
         $opac_view_restrict = " notice_id in (select opac_view_num_notice from  opac_view_notices_" . $_SESSION["opac_view"] . ") ";
         $statut_r .= " and " . $opac_view_restrict;
     }
     if ($type_aff_navigopac == 0) {
         //Pas de navigation
         //on ne peut pas arriver ici...
     } elseif ($type_aff_navigopac == -1) {
         //Navigation par auteurs
         $requete = "create temporary table temp_n_id ENGINE=MyISAM ( SELECT notice_id FROM notices " . $acces_j . " JOIN exemplaires ON expl_section='" . $id . "' and expl_location='" . $location . "' and expl_notice=notice_id " . $statut_j . " WHERE 1 " . $statut_r . " GROUP BY notice_id)";
         pmb_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 notice_id FROM exemplaires JOIN bulletins ON expl_section='" . $id . "' and expl_location='" . $location . "' and expl_bulletin=bulletin_id JOIN notices ON notice_id=bulletin_notice " . $acces_j . " " . $statut_j . " WHERE 1 " . $statut_r . " GROUP BY notice_id)";
         pmb_mysql_query($requete);
         @pmb_mysql_query("alter table temp_n_id add index(notice_id)");
         //On sait par quoi doit commencer le nom de l'auteur
         if ($plettreaut == "num") {
             $requeteSource = "SELECT notices.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]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id";
         } elseif ($plettreaut == "vide") {
             $requeteSource = "SELECT notices.notice_id FROM temp_n_id LEFT JOIN responsability ON responsability_notice=temp_n_id.notice_id LEFT JOIN notices ON notices.notice_id=temp_n_id.notice_id WHERE responsability_author IS NULL GROUP BY notices.notice_id";
         } elseif ($plettreaut) {
             $requeteSource = "SELECT notices.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 . "]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id";
         } else {
             $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id";
         }
     } else {
         //Navigation par un plan de classement
         if ($ssub) {
             $t_expl_cote_cond = array();
             for ($i = 0; $i < count($t_dcote); $i++) {
                 $t_expl_cote_cond[] = "expl_cote regexp '(^" . $t_dcote[$i] . " )|(^" . $t_dcote[$i] . "[0-9])|(^" . $t_dcote[$i] . "\$)|(^" . $t_dcote[$i] . ".)'";
             }
             $expl_cote_cond = "(" . implode(" or ", $t_expl_cote_cond) . ")";
         }
         if (!$ssub) {
             $requete = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires {$statut_j} ";
             $requete .= "where expl_location={$location} and expl_section={$id} and notice_id=expl_notice ";
             if (strlen($dcote)) {
                 $requete .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' ";
             }
             $requete .= $statut_r;
             $res = pmb_mysql_query($requete, $dbh);
             $nbr_lignes = @pmb_mysql_result($res, 0, 0);
             $requete2 = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} ";
             $requete2 .= "where  expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id ";
             if (strlen($dcote)) {
                 $requete2 .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' ";
             }
             $requete2 .= $statut_r;
             $res = pmb_mysql_query($requete2, $dbh);
             $nbr_lignes += @pmb_mysql_result($res, 0, 0);
         } else {
             $requete = "select COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires {$statut_j} ";
             $requete .= "where expl_location={$location} and expl_section={$id} and notice_id=expl_notice ";
             if (strlen($dcote)) {
                 $requete .= " and {$expl_cote_cond} ";
             }
             $requete .= $statut_r;
             $res = pmb_mysql_query($requete, $dbh);
             $nbr_lignes = @pmb_mysql_result($res, 0, 0);
             $requete2 = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} ";
             $requete2 .= "where  expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id ";
             if (strlen($dcote)) {
                 $requete2 .= "and {$expl_cote_cond} ";
             }
             $requete2 .= $statut_r;
             $res = pmb_mysql_query($requete2, $dbh);
             $nbr_lignes += @pmb_mysql_result($res, 0, 0);
         }
         if ($nbr_lignes) {
             //Table temporaire de tous les id
             $requete = "create temporary table temp_n_id ENGINE=MyISAM (select notice_id FROM notices {$acces_j} ,exemplaires {$statut_j} ";
             $requete .= "WHERE expl_location={$location} and expl_section={$id} and notice_id=expl_notice ";
             if (strlen($dcote)) {
                 if (!$ssub) {
                     $requete .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' ";
                     $level_ref = strlen($dcote) + 1;
                 } else {
                     $requete .= "and {$expl_cote_cond} ";
                 }
             }
             $requete .= "{$statut_r} ";
             $requete .= "group by notice_id) ";
             pmb_mysql_query($requete);
             $requete2 = "insert into temp_n_id (SELECT notice_id FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} ";
             $requete2 .= "where  expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id ";
             if (strlen($dcote)) {
                 if (!$ssub) {
                     $requete2 .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' ";
                 } else {
                     $requete2 .= "and {$expl_cote_cond} ";
                 }
             }
             $requete2 .= "{$statut_r} ";
             $requete2 .= "group by notice_id) ";
             @pmb_mysql_query($requete2);
             @pmb_mysql_query("alter table temp_n_id add index(notice_id)");
             //Calcul du classement
             if (!$ssub) {
                 $rq1_index = "create temporary table union1 ENGINE=MyISAM (select distinct expl_cote from exemplaires, temp_n_id where expl_location={$location} and expl_section={$id} and expl_notice=temp_n_id.notice_id) ";
                 $res1_index = pmb_mysql_query($rq1_index);
                 $rq2_index = "create temporary table union2 ENGINE=MyISAM (select distinct expl_cote from exemplaires, temp_n_id, bulletins where expl_location={$location} and expl_section={$id} and bulletin_notice=temp_n_id.notice_id and expl_bulletin=bulletin_id) ";
                 $res2_index = pmb_mysql_query($rq2_index);
                 $req_index = "select distinct expl_cote from union1 union select distinct expl_cote from union2";
                 $res_index = pmb_mysql_query($req_index);
                 if ($level_ref == 0) {
                     $level_ref = 1;
                 }
                 // Prepare indexint pre selection - Zend
                 $zendIndexInt = array();
                 //$zendIndexIntCache = array();
                 $zendQ1 = "SELECT indexint_name, indexint_comment FROM indexint WHERE indexint_name NOT REGEXP '^[0-9][0-9][0-9]' AND indexint_comment != '' AND num_pclass='" . $type_aff_navigopac . "'";
                 $zendRes = pmb_mysql_query($zendQ1);
                 while ($zendRow = pmb_mysql_fetch_assoc($zendRes)) {
                     $zendIndexInt[$zendRow['indexint_name']] = $zendRow['indexint_comment'];
                 }
                 // Zend
                 while ($ct = pmb_mysql_fetch_object($res_index)) {
                     //Je regarde si le début existe dans indexint
                     $lf = 5;
                     $t = array();
                     while ($lf > 0) {
                         $zendKey = substr($ct->expl_cote, 0, $lf);
                         if ($zendIndexInt[$zendKey]) {
                             if (!$nc) {
                                 $t["comment"] = $zendIndexInt[$zendKey];
                                 $t["dcote"] = $zendKey;
                                 $t["ssub"] = 1;
                                 $index[$t["dcote"]] = $t;
                                 break;
                             } else {
                                 $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 = pmb_mysql_query($rq_del);
                                 while (list($n_id) = pmb_mysql_fetch_row($res_del)) {
                                     pmb_mysql_query("delete from temp_n_id where notice_id=" . $n_id);
                                 }
                             }
                         }
                         $lf--;
                     }
                     if ($lf == 0) {
                         if (preg_match("/[0-9][0-9][0-9]/", $ct->expl_cote, $c)) {
                             $found = false;
                             $lcote = 3;
                             $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 indexint_comment!='' and num_pclass='" . $type_aff_navigopac . "' order by indexint_name limit 1 ";
                                 $res_index_1 = pmb_mysql_query($rq_index);
                                 if (pmb_mysql_num_rows($res_index_1)) {
                                     $name = pmb_mysql_result($res_index_1, 0, 0);
                                     if (!$nc) {
                                         if (substr($name, 0, $level - 1) == $dcote) {
                                             $t["comment"] = pmb_mysql_result($res_index_1, 0, 1);
                                             if ($level > 1) {
                                                 $cote_n_1 = substr($c[0], 0, $level - 1);
                                                 $compl_n_1 = str_repeat("0", $lcote - $level + 1);
                                                 if ($cote . $compl == $cote_n_1 . $compl_n_1) {
                                                     $t["comment"] = "Généralités";
                                                 }
                                             }
                                             $t["lcote"] = $lcote;
                                             $t["dcote"] = $cote;
                                             $index[$name] = $t;
                                             $found = true;
                                         } else {
                                             $level++;
                                         }
                                     } else {
                                         if (substr($name, 0, $level - 1) == $dcote) {
                                             $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 = pmb_mysql_query($rq_del);
                                             while (list($n_id) = pmb_mysql_fetch_row($res_del)) {
                                                 pmb_mysql_query("delete from temp_n_id where notice_id=" . $n_id);
                                             }
                                             $found = true;
                                         } else {
                                             $level++;
                                         }
                                     }
                                 } else {
                                     $level++;
                                 }
                             }
                             if ($level > $lcote && $lf == 0) {
                                 $t["comment"] = $msg["l_unclassified"];
                                 $t["lcote"] = $lcote;
                                 $t["dcote"] = $dcote;
                                 $index["NC"] = $t;
                             }
                         } else {
                             $t["comment"] = $msg["l_unclassified"];
                             $t["lcote"] = $lcote;
                             $t["dcote"] = $dcote;
                             $index["NC"] = $t;
                         }
                     }
                 }
             }
             if ($nc) {
                 $nbr_lignes = pmb_mysql_result(pmb_mysql_query("select count(1) from temp_n_id"), 0, 0);
             }
             if ($nbr_lignes) {
                 $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id ";
             }
         }
     }
     pmb_mysql_query("create temporary table t_s_navigation_section (notice_id integer unsigned not null)");
     $requete = "insert into t_s_navigation_section " . $requeteSource;
     pmb_mysql_query($requete);
     pmb_mysql_query("alter table t_s_navigation_section add primary key(notice_id)");
     return "t_s_navigation_section";
 }
 protected function filter_explnums($datas = array())
 {
     global $dbh;
     global $class_path;
     global $gestion_acces_active;
     global $gestion_acces_empr_docnum;
     $filtered_datas = array();
     if (count($datas)) {
         $acces = '';
         $restrict = '';
         if ($gestion_acces_active == 1 && $gestion_acces_empr_docnum == 1) {
             require_once "{$class_path}/acces.class.php";
             $ac = new acces();
             $dom_3 = $ac->setDomain(3);
             $acces = $dom_3->getJoin($_SESSION['id_empr_session'], 16, 'explnum_id');
         } else {
             $restrict = "and explnum_docnum_statut in (select id_explnum_statut from explnum_statut where (explnum_visible_opac=1 and explnum_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (explnum_visible_opac_abon=1 and explnum_visible_opac=1)" : "") . ")";
         }
         $explnum = 'select explnum_id from explnum ' . $acces . ' where explnum_id in(' . implode(',', $datas) . ') ' . $restrict . '  ';
         $result = pmb_mysql_query($explnum, $dbh);
         while ($row = pmb_mysql_fetch_object($result)) {
             $filtered_datas[] = $row->explnum_id;
         }
     }
     return $filtered_datas;
 }
Esempio n. 30
0
 function purger()
 {
     global $dbh;
     global $msg;
     global $gestion_acces_active, $gestion_acces_empr_notice;
     if (!$this->id_bannette) {
         return $msg['dsi_ban_no_access'];
     }
     // impossible d'accéder à cette bannette
     //purge pour les bannettes privees des notices ne devant pas etre diffusees
     if ($this->proprio_bannette && $gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
         $ac = new acces();
         $dom_2 = $ac->setDomain(2);
         $acces_j = $dom_2->getJoin($this->proprio_bannette, '4=0', 'num_notice');
         $q = "delete from bannette_contenu using bannette_contenu {$acces_j} WHERE num_bannette='{$this->id_bannette}' ";
         pmb_mysql_query($q, $dbh);
     }
     switch ($this->limite_type) {
         case "D":
             $requete = "select num_notice from bannette_contenu WHERE num_bannette='{$this->id_bannette}' and ";
             $requete .= " date_add(date_ajout, INTERVAL " . $this->limite_nombre . " DAY)<sysdate() ";
             $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
             $tab = array();
             while ($obj = pmb_mysql_fetch_object($res)) {
                 $tab[] = $obj->num_notice;
             }
             $notice_suppr = implode(",", $tab);
             if ($notice_suppr) {
                 if ($this->num_panier) {
                     $requete = "delete from caddie_content WHERE caddie_id='{$this->num_panier}' and object_id in (" . $notice_suppr . ") ";
                     $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
                 }
                 $requete = "delete from bannette_contenu WHERE num_bannette='{$this->id_bannette}' and num_notice in (" . $notice_suppr . ") ";
                 $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
             }
             break;
         case "I":
             $tab = array();
             // selection des ## dernières notices, celles qu'il faut absolument garder
             $requete = "select num_notice from bannette_contenu, notices WHERE num_bannette='{$this->id_bannette}' and notice_id=num_notice order by date_ajout DESC, update_date DESC ";
             $requete .= " limit {$this->limite_nombre} ";
             $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
             while ($obj = pmb_mysql_fetch_object($res)) {
                 $tab[] = $obj->num_notice;
             }
             // selection des notices ajoutées depuis moins d'un jour
             $requete = "select num_notice from bannette_contenu WHERE num_bannette='{$this->id_bannette}' and ";
             $requete .= " date_add(date_ajout, INTERVAL 1 DAY)>=sysdate() ";
             $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
             while ($obj = pmb_mysql_fetch_object($res)) {
                 $tab[] = $obj->num_notice;
             }
             // suppression de tout ce qui dépasse
             $notice_suppr = implode(",", $tab);
             if ($notice_suppr) {
                 if ($this->num_panier) {
                     $requete = "delete from caddie_content WHERE caddie_id='{$this->num_panier}' and object_id not in (" . $notice_suppr . ") ";
                     $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
                 }
                 $requete = "delete from bannette_contenu WHERE num_bannette='{$this->id_bannette}' and num_notice not in (" . $notice_suppr . ") ";
                 $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
             }
             break;
         default:
         case "":
             break;
     }
     $this->compte_elements();
 }