示例#1
0
function aff_notice_unimarc($id, $nocart = 0, $entrepots_localisations = array())
{
    global $opac_notices_format;
    global $opac_notices_depliable;
    global $opac_cart_allow;
    global $opac_cart_only_for_subscriber;
    global $msg;
    if ($opac_cart_allow && !$opac_cart_only_for_subscriber || $opac_cart_allow && $_SESSION["user_code"]) {
        $cart = 1;
    } else {
        $cart = 0;
    }
    if ($nocart) {
        $cart = 0;
    }
    //Recherche des fonctions d'affichage
    //$f=get_aff_function();
    //if ($f) return $f($id,$cart);
    if ($id) {
        $current = new notice_affichage_unimarc($id, "", $cart, 0, $entrepots_localisations);
        $depliable = $opac_notices_depliable;
        $current->do_header();
        if ($current->notice_header == "") {
            $current->notice_header = sprintf($msg['cart_notice_expired'], $id);
            $current->notice_expired = true;
        }
        switch ($opac_notices_format) {
            case AFF_ETA_NOTICES_REDUIT:
                $retour_aff .= $current->notice_header . " ";
                break;
            case AFF_ETA_NOTICES_ISBD:
                $current->do_isbd();
                $current->genere_simple($depliable, 'ISBD');
                $retour_aff .= $current->result;
                break;
            case AFF_ETA_NOTICES_PUBLIC:
                $current->do_public();
                $current->genere_simple($depliable, 'PUBLIC');
                $retour_aff .= $current->result;
                break;
            case AFF_ETA_NOTICES_BOTH:
                $current->do_isbd();
                $current->do_public();
                $current->genere_double($depliable, 'PUBLIC');
                $retour_aff .= $current->result;
                break;
            case AFF_ETA_NOTICES_BOTH_ISBD_FIRST:
                $current->do_isbd();
                $current->do_public();
                $current->genere_double($depliable, 'ISBD');
                $retour_aff .= $current->result;
                break;
            default:
                $current->do_isbd();
                $current->do_public();
                $current->genere_double($depliable, 'autre');
                $retour_aff .= $current->result;
                break;
        }
    }
    return $retour_aff;
}
 /**
  * Formulaire de saisie des suggestions multiples
  */
 function display_form()
 {
     global $dbh, $multi_sug_form, $charset, $msg, $sug_src;
     //On charge la liste des sources
     $req = "select * from suggestions_source order by libelle_source";
     $res = pmb_mysql_query($req, $dbh);
     $option = "<option value='0' selected>" . htmlentities($msg['empr_sugg_no_src'], ENT_QUOTES, $charset) . "</option>";
     while ($src = pmb_mysql_fetch_object($res)) {
         $option .= "<option value='" . $src->id_source . "' " . ($sug_src == $src->id_source ? 'selected' : '') . ">" . htmlentities($src->libelle_source, ENT_QUOTES, $charset) . "</option>";
     }
     if (!$this->liste_sugg) {
         $nb_lignes = 1;
         $multi_sug_form = str_replace('!!max_ligne!!', $nb_lignes, $multi_sug_form);
         $ligne = "\n\t\t\t\t<tr id='sugg_0'>\n\t\t\t\t\t<td><input type='texte' name='sugg_tit_0' id='sugg_tit_0' value=''  disabled /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_aut_0' id='sugg_aut_0' value='' disabled /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_edi_0' id='sugg_edi_0' value='' disabled /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_code_0' id='sugg_code_0' value='' disabled /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_prix_0' id='sugg_prix_0' value='' disabled /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_url_0' id='sugg_url_0' value='' disabled /></td>\n\t\t\t\t\t<td><textarea name='sugg_com_0' id='sugg_com_0' disabled ></textarea></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_date_0' id='sugg_date_0' value='' disabled /></td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<select id='sugg_src_0' name='sugg_src_0' disabled >\n\t\t\t\t\t\t\t{$option}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td><input type='texte' name='sugg_qte_0' id='sugg_qte_0' value='1' disabled /></td>\n\t\t\t\t\t<td id='act_btn_0'><input type='button' name='add_line_0' id='add_line_0' value='+' onclick=\"add_line(0);\"/></td>\n\t\t\t\t</tr>";
     } else {
         $liste = $this->liste_sugg;
         $this->ori_unimarc = microtime() . "_unimulti";
         for ($i = 0; $i < count($liste); $i++) {
             $ext = false;
             $notice_id = 0;
             if (strpos($liste[$i], 'es') !== false) {
                 $id_noti = str_replace('es', '', $liste[$i]);
                 $entrepots_localisations = array();
                 $entrepots_localisations_sql = "SELECT * FROM entrepots_localisations ORDER BY loc_visible DESC";
                 $res = pmb_mysql_query($entrepots_localisations_sql);
                 while ($row = pmb_mysql_fetch_array($res)) {
                     $entrepots_localisations[$row["loc_code"]] = array("libelle" => $row["loc_libelle"], "visible" => $row["loc_visible"]);
                 }
                 //Traitement de la notice uni
                 $uni = new suggestions_unimarc();
                 $uni->entrepot_to_unimarc($id_noti);
                 $uni->sugg_uni_num_notice = $id_noti;
                 $uni->sugg_uni_origine = $this->ori_unimarc;
                 $uni->save();
                 $aff = new notice_affichage_unimarc($id_noti, '', 0, 0, $entrepots_localisations);
                 $aff->fetch_data();
                 $titre = $aff->notice->tit1;
                 $auteur = $aff->auteurs_principaux ? $aff->auteurs_principaux : $aff->auteurs_tous;
                 $editeur = $aff->publishers[0]["name"];
                 $code = $aff->code;
                 $prix = $aff->prix;
                 $date = $aff->year;
                 $url = $aff->notice->lien ? $aff->notice->lien : ($aff->notice->eformat ? $aff->notice->eformat : ($aff->notice->lien_texte ? $aff->notice->lien_texte : ''));
                 $ext = true;
             } else {
                 $requete = "SELECT tit1 as titre, ed_name as editeur, CONCAT(author_name,' ',author_rejete) as auteur, prix, code, lien, year \n\t\t\t\t\tFROM notices LEFT JOIN responsability ON responsability_notice=notice_id \n\t\t\t\t\tLEFT JOIN authors ON responsability_author=author_id LEFT JOIN publishers ON ed1_id=ed_id\n\t\t\t\t\tWHERE notice_id=" . $liste[$i];
                 $result = pmb_mysql_query($requete, $dbh);
                 $sug = pmb_mysql_fetch_object($result);
                 $titre = $sug->titre;
                 $auteur = $sug->auteur;
                 $editeur = $sug->editeur;
                 $code = $sug->code;
                 $prix = $sug->prix;
                 $date = $sug->year;
                 $url = $sug->lien;
                 $notice_id = $liste[$i];
             }
             $ligne .= "<tr id='sugg_{$i}'>\n\t\t\t\t\t<td><input type='texte' name='sugg_tit_{$i}' id='sugg_tit_{$i}' value='" . htmlentities($titre, ENT_QUOTES, $charset) . "' /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_aut_{$i}' id='sugg_aut_{$i}' value='" . htmlentities($auteur, ENT_QUOTES, $charset) . "' /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_edi_{$i}' id='sugg_edi_{$i}' value='" . htmlentities($editeur, ENT_QUOTES, $charset) . "' /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_code_{$i}' id='sugg_code_{$i}' value='" . htmlentities($code, ENT_QUOTES, $charset) . "' /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_prix_{$i}' id='sugg_prix_{$i}' value='" . $prix . "' /></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_url_{$i}' id='sugg_url_{$i}' value='" . htmlentities($url, ENT_QUOTES, $charset) . "' /></td>\n\t\t\t\t\t<td><textarea name='sugg_com_{$i}' id='sugg_com_{$i}'></textarea></td>\n\t\t\t\t\t<td><input type='texte' name='sugg_date_{$i}' id='sugg_date_{$i}' value='" . htmlentities($date, ENT_QUOTES, $charset) . "' /></td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<select id='sugg_src_{$i}' name='sugg_src_{$i}'>\n\t\t\t\t\t\t\t{$option}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td><input type='texte' name='sugg_qte_{$i}' id='sugg_qte_{$i}' value='1' /></td>";
             if ($i == count($liste) - 1) {
                 $ligne .= "<td id='act_btn_{$i}'><input type='button' name='add_line_{$i}' id='add_line_{$i}' value='+' onclick=\"add_line({$i});\"/></td>";
             } else {
                 $ligne .= "<td id='act_btn_{$i}'><input type='button' name='del_line_{$i}' id='del_line_{$i}' value='X' onclick=\"del_line({$i});\"/></td>";
             }
             if ($ext) {
                 $ligne .= "<input type='hidden' name='id_unimarc_{$i}' id='id_unimarc_{$i}' value='" . $uni->sugg_uni_id . "'/> ";
             }
             if ($notice_id) {
                 $ligne .= "<input type='hidden' name='id_notice_{$i}' id='id_notice_{$i}' value='" . $notice_id . "' /> ";
             }
             $ligne .= "</tr>";
         }
         $multi_sug_form = str_replace('!!max_ligne!!', $i, $multi_sug_form);
     }
     $multi_sug_form = str_replace('!!ligne!!', $ligne, $multi_sug_form);
     return $multi_sug_form;
 }
 public function __construct($id, $liens, $cart = 0, $to_print = 0, $entrepots_localisations = array())
 {
     parent::notice_affichage_unimarc($id, $liens, $cart, $to_print, $entrepots_localisations);
 }