Exemple #1
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;
 }
 $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) {
     if ($opac_fonction_affichage_liste_bull) {
         eval("\$opac_fonction_affichage_liste_bull (\$res);");
     } else {
         affichage_liste_bulletins_normale($res);
     }
 } else {
     print "<br /><strong>" . $msg["bull_no_found"] . "</strong>";
 }
 print "<br /><br /><div class='row'></div>";
 // 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 = "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=document.form.page.value; document.form_values.submit()";
 if ($count) {
     $form = "<div class='row'></div><div id='navbar'><br />\n<center>" . printnavbar($page, $nbepages, $url_page, $action) . "</center></div>";
 }