/** * Retourne les informations de réservation * @return array $this->resas_datas = array('nb_resas', 'href', 'onclick', 'flag_max_resa', 'flag_resa_visible') */ public function get_resas_datas() { if (!isset($this->resas_datas)) { global $dbh, $msg; global $opac_resa; global $opac_max_resa; global $opac_show_exemplaires; global $popup_resa; global $opac_resa_popup; // la résa se fait-elle par popup ? global $opac_resa_planning; // la résa est elle planifiée global $allow_book; global $opac_show_exemplaires_analysis; $this->resas_datas = array('nb_resas' => 0, 'href' => "#", 'onclick' => "", 'flag_max_resa' => false, 'flag_resa_visible' => true, 'flag_resa_possible' => true); $bul_info = $this->get_bul_info(); $bulletin_id = $bul_info['bulletin_id']; if ($bulletin_id) { $requete_resa = "SELECT count(1) FROM resa WHERE resa_idbulletin='{$bulletin_id}' "; } else { $requete_resa = "SELECT count(1) FROM resa WHERE resa_idnotice='{$this->id}' "; } $this->resas_datas['nb_resas'] = pmb_mysql_result(pmb_mysql_query($requete_resa, $dbh), 0, 0); if (is_null($this->dom_2) && $opac_show_exemplaires && $this->is_visu_expl() && (!$this->is_visu_expl_abon() || $this->is_visu_expl_abon() && $_SESSION["user_code"]) || $this->get_rights() & 8) { if (!$opac_resa_planning) { if ($bulletin_id) { $resa_check = check_statut(0, $bulletin_id); } else { $resa_check = check_statut($this->id, 0); } // vérification si exemplaire réservable if ($resa_check) { if (($this->get_niveau_biblio() == "m" || $this->get_niveau_biblio() == "b" || $this->get_niveau_biblio() == "a" && $opac_show_exemplaires_analysis) && ($_SESSION["user_code"] && $allow_book) && $opac_resa && !$popup_resa) { if ($opac_max_resa == 0 || $opac_max_resa > $this->resas_datas['nb_resas']) { if ($opac_resa_popup) { $this->resas_datas['onclick'] = "if(confirm('" . $msg["confirm_resa"] . "')){w=window.open('./do_resa.php?lvl=resa&id_notice=" . $this->id . "&id_bulletin=" . $bulletin_id . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;}else return false;"; } else { $this->resas_datas['href'] = "./do_resa.php?lvl=resa&id_notice=" . $this->id . "&id_bulletin=" . $bulletin_id . "&oresa=popup"; $this->resas_datas['onclick'] = "return confirm('" . $msg["confirm_resa"] . "')"; } } else { $this->resas_datas['flag_max_resa'] = true; } } elseif (($this->get_niveau_biblio() == "m" || $this->get_niveau_biblio() == "b" || $this->get_niveau_biblio() == "a" && $opac_show_exemplaires_analysis) && !$_SESSION["user_code"] && $opac_resa && !$popup_resa) { // utilisateur pas connecté // préparation lien réservation sans être connecté if ($opac_resa_popup) { $this->resas_datas['onclick'] = "if(confirm('" . $msg["confirm_resa"] . "')){w=window.open('./do_resa.php?lvl=resa&id_notice=" . $this->id . "&id_bulletin=" . $bulletin_id . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;}else return false;"; } else { $this->resas_datas['href'] = "./do_resa.php?lvl=resa&id_notice=" . $this->id . "&id_bulletin=" . $bulletin_id . "&oresa=popup"; $this->resas_datas['onclick'] = "return confirm('" . $msg["confirm_resa"] . "')"; } } } else { $this->resas_datas['flag_resa_possible'] = false; } // fin if resa_check } else { // planning de réservations $this->resas_datas['nb_resas'] = resa_planning::count_resa($this->id); if ($this->get_niveau_biblio() == "m" && ($_SESSION["user_code"] && $allow_book) && $opac_resa && !$popup_resa) { if ($opac_max_resa == 0 || $opac_max_resa > $this->resas_datas['nb_resas']) { if ($opac_resa_popup) { $this->resas_datas['onclick'] = "w=window.open('./do_resa.php?lvl=resa_planning&id_notice=" . $this->id . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;"; } else { $this->resas_datas['href'] = "./do_resa.php?lvl=resa_planning&id_notice=" . $this->id . "&oresa=popup"; } } else { $this->resas_datas['flag_max_resa'] = true; } } elseif ($this->get_niveau_biblio() == "m" && !$_SESSION["user_code"] && $opac_resa && !$popup_resa) { // utilisateur pas connecté // préparation lien réservation sans être connecté if ($opac_resa_popup) { $this->resas_datas['onclick'] = "w=window.open('./do_resa.php?lvl=resa_planning&id_notice=" . $this->id . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;"; } else { $this->resas_datas['href'] = "./do_resa.php?lvl=resa_planning&id_notice=" . $this->id . "&oresa=popup"; } } } } else { $this->resas_datas['flag_resa_visible'] = false; } } return $this->resas_datas; }
function aff_resa_expl() { global $opac_resa; global $opac_max_resa; global $opac_show_exemplaires; global $msg; global $dbh; global $popup_resa; global $opac_resa_popup; // la résa se fait-elle par popup ? global $opac_resa_planning; // la résa est elle planifiée global $allow_book; global $opac_show_exemplaires_analysis; // afin d'éviter de recalculer un truc déjà calculé... if ($this->affichage_resa_expl_flag) { return $this->affichage_resa_expl; } $ret = ''; if ($this->notice->niveau_biblio != 's') { if (is_null($this->dom_2) && $opac_show_exemplaires && $this->visu_expl && (!$this->visu_expl_abon || $this->visu_expl_abon && $_SESSION["user_code"]) || $this->rights & 8) { //Si la resa porte sur une monographie, c'est l'id de notice qui est pris en compte, sinon c'est l'id de bulletin $resa_id_notice = 0; $resa_id_bulletin = 0; if ($this->notice->niveau_biblio == "m") { $resa_id_notice = $this->notice_id; } else { $resa_id_bulletin = $this->bulletin_id; } //Des exemplaires réservables ? if ($resa_id_bulletin) { $resa_check = check_statut(0, $resa_id_bulletin); } else { $resa_check = check_statut($resa_id_notice, 0); } if ($resa_check) { if (!$opac_resa_planning) { //des réservations en cours? if ($resa_id_bulletin) { $requete_resa = "SELECT count(1) FROM resa WHERE resa_idbulletin='{$resa_id_bulletin}' "; } else { $requete_resa = "SELECT count(1) FROM resa WHERE resa_idnotice='{$resa_id_notice}' "; } $nb_resa_encours = pmb_mysql_result(pmb_mysql_query($requete_resa, $dbh), 0, 0); if ($nb_resa_encours) { $message_nbresa = str_replace("!!nbresa!!", $nb_resa_encours, $msg["resa_nb_deja_resa"]); } if (($this->notice->niveau_biblio == "m" || $this->notice->niveau_biblio == "b" || $this->notice->niveau_biblio == "a" && $opac_show_exemplaires_analysis) && $opac_resa && !$popup_resa) { if ($_SESSION["user_code"] && $allow_book) { $ret .= "<h3>" . $msg["bulletin_display_resa"] . "</h3>"; if ($opac_max_resa == 0 || $opac_max_resa > $nb_resa_encours) { if ($opac_resa_popup) { $ret .= "<a href='#' onClick=\"if(confirm('" . $msg["confirm_resa"] . "')){w=window.open('./do_resa.php?lvl=resa&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;}else return false;\" id=\"bt_resa\">" . $msg["bulletin_display_place_resa"] . "</a>"; } else { $ret .= "<a href='./do_resa.php?lvl=resa&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup' onClick=\"return confirm('" . $msg["confirm_resa"] . "')\" id=\"bt_resa\">" . $msg["bulletin_display_place_resa"] . "</a>"; } $ret .= $message_nbresa; } else { $ret .= str_replace("!!nb_max_resa!!", $opac_max_resa, $msg["resa_nb_max_resa"]); } $ret .= "<br />"; } elseif (!$_SESSION["user_code"]) { // utilisateur pas connecté // préparation lien réservation sans être connecté $ret .= "<h3>" . $msg["bulletin_display_resa"] . "</h3>"; if ($opac_resa_popup) { $ret .= "<a href='#' onClick=\"if(confirm('" . $msg["confirm_resa"] . "')){w=window.open('./do_resa.php?lvl=resa&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;}else return false;\" id=\"bt_resa\">" . $msg["bulletin_display_place_resa"] . "</a>"; } else { $ret .= "<a href='./do_resa.php?lvl=resa&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup' onClick=\"return confirm('" . $msg["confirm_resa"] . "')\" id=\"bt_resa\">" . $msg["bulletin_display_place_resa"] . "</a>"; } $ret .= $message_nbresa; $ret .= "<br />"; } } } else { //des prévisions en cours? if ($resa_id_bulletin) { $nb_resa_encours = resa_planning::count_resa(0, $resa_id_bulletin); } else { $nb_resa_encours = resa_planning::count_resa($resa_id_notice, 0); } if ($nb_resa_encours) { $message_nbresa = str_replace("!!nbresa!!", $nb_resa_encours, $msg["resa_nb_deja_resa"]); } if (($this->notice->niveau_biblio == "m" || $this->notice->niveau_biblio == "b" || $this->notice->niveau_biblio == "a" && $opac_show_exemplaires_analysis) && $opac_resa && !$popup_resa) { if ($_SESSION["user_code"] && $allow_book) { $ret .= "<h3>" . $msg["bulletin_display_resa"] . "</h3>"; if ($opac_max_resa == 0 || $opac_max_resa > $nb_resa_encours) { if ($opac_resa_popup) { $ret .= "<a href='#' onClick=\"w=window.open('./do_resa.php?lvl=resa_planning&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;\" id=\"bt_resa\">" . $msg["bulletin_display_place_resa"] . "</a>"; } else { $ret .= "<a href='./do_resa.php?lvl=resa_planning&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup' id='bt_resa'>" . $msg["bulletin_display_place_resa"] . "</a>"; } $ret .= $message_nbresa; } else { $ret .= str_replace("!!nb_max_resa!!", $opac_max_resa, $msg["resa_nb_max_resa"]); } $ret .= "<br />"; } elseif (!$_SESSION["user_code"]) { // utilisateur pas connecté // préparation lien réservation sans être connecté $ret .= "<h3>" . $msg["bulletin_display_resa"] . "</h3>"; if ($opac_resa_popup) { $ret .= "<a href='#' onClick=\"w=window.open('./do_resa.php?lvl=resa_planning&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup','doresa','scrollbars=yes,width=500,height=600,menubar=0,resizable=yes'); w.focus(); return false;\" id=\"bt_resa\">" . $msg["bulletin_display_place_resa"] . "</a>"; } else { $ret .= "<a href='./do_resa.php?lvl=resa_planning&id_notice=" . $resa_id_notice . "&id_bulletin=" . $resa_id_bulletin . "&oresa=popup' id='bt_resa'>" . $msg["bulletin_display_place_resa"] . "</a>"; } $ret .= $message_nbresa; $ret .= "<br />"; } } } } $temp = $this->expl_list($this->notice->niveau_biblio, $this->notice_id, $this->bulletin_id); $ret .= $temp; $this->affichage_expl = $temp; } } //affichage exemplaires numeriques if ($this->docnum_allowed) { $ret .= $this->aff_explnum(); } if ($autres_lectures = $this->autres_lectures($this->notice_id, $this->bulletin_id)) { $ret .= $autres_lectures; } $this->affichage_resa_expl = $ret; $this->affichage_resa_expl_flag = 1; return $ret; }