示例#1
0
 function getNotice()
 {
     global $charset;
     //on récupère l'identifiant du l'export associé au format
     $this->typeExport = start_export::get_id_by_path($this->formats[$this->format]['TRANSFORM']);
     //on a ce qu'il faut, on récupère la notice dans le bon format
     $this->notice = cree_export_notices(array($this->id), $this->typeExport, 1);
     //on envoi le bon mimetype
     if ($this->formats[$this->format]['TYPE']) {
         header("Content-type: " . $this->formats[$this->format]['TYPE'] . "; charset=" . $charset, true);
     }
     //on affiche la notice
     print $this->notice;
 }
示例#2
0
 function construit_contenu_HTML($use_limit = 1)
 {
     global $dbh;
     global $msg;
     global $opac_url_base, $use_opac_url_base;
     global $deflt2docs_location;
     global $suite;
     global $url_base_opac;
     $url_base_opac = $opac_url_base . "index.php?database=" . DATA_BASE . "&lvl=notice_display&id=";
     $use_opac_url_base = true;
     // pour URL image vue de l'extérieur
     global $prefix_url_image;
     global $depliable;
     $depliable = 0;
     $prefix_url_image = $opac_url_base;
     global $dsi_bannette_notices_order;
     $this->data_document = array();
     if (!$dsi_bannette_notices_order) {
         $dsi_bannette_notices_order = "index_serie, tnvol, index_sew";
     }
     if ($this->nb_notices_diff && $use_limit) {
         $limitation = " LIMIT {$this->nb_notices_diff} ";
     }
     // purge des archives au dela de $this->archive_number ou si a 0
     $this->clean_archive();
     $requete = "select num_notice from bannette_contenu, notices where num_bannette='" . $this->id_bannette . "' and notice_id=num_notice order by {$dsi_bannette_notices_order} {$limitation} ";
     $resultat = pmb_mysql_query($requete, $dbh) or die($requete . " " . pmb_mysql_error());
     // paramétrage :
     $environement["short"] = 6;
     $environement["ex"] = 0;
     $environement["exnum"] = 1;
     if ($this->nb_notices_diff >= $this->nb_notices || !$this->nb_notices_diff) {
         $nb_envoyees = $this->nb_notices;
     } else {
         $nb_envoyees = $this->nb_notices_diff;
     }
     $resultat_aff .= "<span class=\"dsi_hide_for_emails\"><hr />";
     $resultat_aff .= sprintf($msg["dsi_diff_n_notices"], $nb_envoyees, $this->nb_notices);
     $resultat_aff .= "<hr /></span>";
     if ($this->notice_tpl) {
         $noti_tpl = new notice_tpl_gen($this->notice_tpl);
     }
     $liste = array();
     $liste_group = array();
     $notice_group = array();
     if (pmb_mysql_num_rows($resultat)) {
         while ($temp = pmb_mysql_fetch_object($resultat)) {
             // Si un champ perso est donné comme critère de regroupement
             if ($this->group_pperso && $this->group_type != 1) {
                 $this->p_perso->get_values($temp->num_notice);
                 $values = $this->p_perso->values;
                 $trouve = false;
                 foreach ($values as $field_id => $vals) {
                     if ($this->group_pperso == $field_id) {
                         foreach ($vals as $cpVal) {
                             $notice_group[$temp->num_notice][] = $this->p_perso->get_formatted_output(array($cpVal), $field_id);
                             if (!$cpVal) {
                                 $cpVal = "_no_value_";
                             }
                             $liste_group[$cpVal][] = $temp;
                             $trouve = true;
                         }
                         $this->field_type = $this->p_perso->t_fields[$field_id]["TYPE"];
                         $this->field_id = $field_id;
                     }
                 }
                 if (!$trouve) {
                     $liste_group["_no_value_"][] = $temp;
                     $notice_group[$temp->num_notice][] = $this->p_perso->get_formatted_output(array(), $field_id);
                 }
             } else {
                 $liste[] = $temp;
             }
             // archivage
             if ($this->archive_number) {
                 $req = "insert into dsi_archive set num_banette_arc='" . $this->id_bannette . "', num_notice_arc='" . $temp->num_notice . "', date_diff_arc=CURDATE()    ";
                 pmb_mysql_query($req, $dbh);
             }
         }
     }
     // groupement par facettes
     if (count($liste) && $this->group_type == 1) {
         $notice_ids = array();
         foreach ($liste as $r) {
             $notice_ids[] = $r->num_notice;
         }
         $facette = new bannette_facettes($this->id_bannette);
         if ($suite == "gen_document") {
             if ($this->bannette_tpl_num) {
                 $this->data_document['sommaires'] = $facette->build_document_data($notice_ids, $this->document_notice_tpl);
                 return;
             } else {
                 $this->aff_document = $facette->build_document($notice_ids, $this->document_notice_tpl, $this->document_add_summary, 1);
             }
         } else {
             if ($this->bannette_tpl_num) {
                 $this->data_document['sommaires'] = $facette->build_document_data($notice_ids, $this->document_notice_tpl);
                 return;
             } else {
                 $this->aff_document = $facette->build_document($notice_ids, $this->document_notice_tpl, $this->document_add_summary);
             }
         }
         if ($this->typeexport && !$use_limit) {
             $this->export_contenu = cree_export_notices($this->liste_id_notice, start_export::get_id_by_path($this->typeexport), 1, $this->param_export);
         }
         return $resultat_aff . $this->aff_document;
     }
     if (count($liste_group)) {
         foreach ($liste_group as $list_notice) {
             $req_list = array();
             foreach ($list_notice as $r) {
                 $req_list[] = $r->num_notice;
             }
             $requete = "select notice_id as num_notice from  notices where  notice_id in(" . implode(",", $req_list) . ") order by {$dsi_bannette_notices_order} ";
             $res_tri = pmb_mysql_query($requete, $dbh);
             while ($r = pmb_mysql_fetch_object($res_tri)) {
                 $liste[] = $r;
             }
         }
     }
     $group_printed = $tri_tpl = array();
     $memo_resultat_aff = $resultat_aff;
     $group_printed_document = $tri_tpl_document = array();
     $aff_document = "";
     if ($this->document_notice_tpl && $this->document_generate) {
         $noti_tpl_document = new notice_tpl_gen($this->document_notice_tpl);
     }
     if ($liste) {
         $already_printed = array();
         $already_printed_document = array();
         foreach ($liste as $r) {
             if ($this->document_generate) {
                 $tpl_document = "";
                 if ($this->document_notice_tpl) {
                     $tpl_document = $noti_tpl_document->build_notice($r->num_notice, $deflt2docs_location);
                 }
                 if (!$tpl_document) {
                     $n = pmb_mysql_fetch_object(@pmb_mysql_query("select * from notices where notice_id=" . $r->num_notice));
                     global $use_opac_url_base;
                     $use_opac_url_base = 1;
                     global $use_dsi_diff_mode;
                     $use_dsi_diff_mode = 1;
                     if ($this->statut_not_account) {
                         $use_dsi_diff_mode = 2;
                     }
                     //On ne tient pas compte des statuts de notice pour la diffusion
                     if ($n->niveau_biblio == 'm' || $n->niveau_biblio == 'b') {
                         $mono = new mono_display($n, $environement["short"], "", $environement["ex"], "", "", "", 0, 1, $environement["exnum"], 0, "", 0, true, false);
                         $tpl_document .= "<a href='" . $url_base_opac . $n->notice_id . "&code=!!code!!&emprlogin=!!login!!&date_conex=!!date_conex!!'><b>" . $mono->header . "</b></a><br /><br />\r\n";
                         $tpl_document .= $mono->isbd;
                     } elseif ($n->niveau_biblio == 's' || $n->niveau_biblio == 'a') {
                         $serial = new serial_display($n, 6, "", "", "", "", "", 0, 1, $environement["exnum"], 0, false);
                         $tpl_document .= "<a href='" . $url_base_opac . $n->notice_id . "&code=!!code!!&emprlogin=!!login!!&date_conex=!!date_conex!!'><b>" . $serial->header . "</b></a><br /><br />\r\n";
                         $tpl_document .= $serial->isbd;
                     }
                     $tpl_document = str_replace('<!-- !!avis_notice!! -->', "", $tpl_document);
                 }
                 if ($this->document_group) {
                     if ($notice_group[$r->num_notice]) {
                         foreach ($notice_group[$r->num_notice] as $id => $cpDisplay) {
                             if ($this->display_notice_in_every_group) {
                                 $already_printed_document = array();
                             }
                             if (!$tri_tpl_document[$notice_group[$r->num_notice][$id]] || !in_array($tpl_document, $tri_tpl_document[$notice_group[$r->num_notice][$id]])) {
                                 if (!in_array($r->num_notice, $already_printed_document)) {
                                     $tri_tpl_document[$notice_group[$r->num_notice][$id]][] = $tpl_document;
                                     $already_printed_document[] = $r->num_notice;
                                 }
                             }
                             if ($cpDisplay && !in_array($cpDisplay, $group_printed_document)) {
                                 $group_printed_document[] = $cpDisplay;
                             }
                         }
                     }
                 } else {
                     if (!in_array($r->num_notice, $already_printed_document)) {
                         if (!$this->notice_tpl) {
                             $aff_document .= $tpl_document . "<hr />\r\n";
                         } else {
                             $aff_document .= $tpl_document . "\r\n";
                         }
                         $already_printed_document[] = $r->num_notice;
                         if ($this->bannette_tpl_num) {
                             $this->data_document['sommaires'][0]['records'][]['render'] = $tpl_document;
                         }
                     }
                 }
             }
             // DSI classique par mail...
             $tpl = "";
             if ($this->notice_tpl) {
                 $tpl = $noti_tpl->build_notice($r->num_notice, $deflt2docs_location);
             }
             if (!$tpl) {
                 $n = pmb_mysql_fetch_object(@pmb_mysql_query("select * from notices where notice_id=" . $r->num_notice));
                 global $use_opac_url_base;
                 $use_opac_url_base = 1;
                 global $use_dsi_diff_mode;
                 $use_dsi_diff_mode = 1;
                 if ($this->statut_not_account) {
                     $use_dsi_diff_mode = 2;
                 }
                 //On ne tient pas compte des statuts de notice pour la diffusion
                 if ($n->niveau_biblio == 'm' || $n->niveau_biblio == 'b') {
                     //function mono_display($id, $level=1,      $action='', $expl=1,    $expl_link='', $lien_suppr_cart="", $explnum_link='', $show_resa=0, $print=0, $show_explnum=1, $show_statut=0, $anti_loop='', $draggable=0, $no_link=false, $show_opac_hidden_fields=true )
                     $mono = new mono_display($n, $environement["short"], "", $environement["ex"], "", "", "", 0, 1, $environement["exnum"], 0, "", 0, true, false);
                     $tpl .= "<a href='" . $url_base_opac . $n->notice_id . "&code=!!code!!&emprlogin=!!login!!&date_conex=!!date_conex!!'><b>" . $mono->header . "</b></a><br /><br />\r\n";
                     $tpl .= $mono->isbd;
                 } elseif ($n->niveau_biblio == 's' || $n->niveau_biblio == 'a') {
                     // level=2 pour ne pas rajouter le "in ..." sur le titre de la notice de dépouillement
                     // function serial_display ($id, $level='1', $action_serial='', $action_analysis='', $action_bulletin='', $lien_suppr_cart="", $lien_explnum="", $bouton_explnum=1,$print=0,$show_explnum=1, $show_statut=0, $show_opac_hidden_fields=true ) {
                     $serial = new serial_display($n, 6, "", "", "", "", "", 0, 1, $environement["exnum"], 0, false);
                     $tpl .= "<a href='" . $url_base_opac . $n->notice_id . "&code=!!code!!&emprlogin=!!login!!&date_conex=!!date_conex!!'><b>" . $serial->header . "</b></a><br /><br />\r\n";
                     $tpl .= $serial->isbd;
                 }
                 $tpl = str_replace('<!-- !!avis_notice!! -->', "", $tpl);
             }
             if ($this->group_pperso) {
                 foreach ($notice_group[$r->num_notice] as $id => $cpDisplay) {
                     if ($this->display_notice_in_every_group) {
                         $already_printed = array();
                     }
                     if (!$tri_tpl[$notice_group[$r->num_notice][$id]] || !in_array($tpl, $tri_tpl[$notice_group[$r->num_notice][$id]])) {
                         if (!in_array($r->num_notice, $already_printed)) {
                             $tri_tpl[$notice_group[$r->num_notice][$id]][] = $tpl;
                             $already_printed[] = $r->num_notice;
                         }
                     }
                     if ($cpDisplay && !in_array($cpDisplay, $group_printed)) {
                         $group_printed[] = $cpDisplay;
                     }
                 }
             } else {
                 $resultat_aff .= $tpl;
                 if ($this->bannette_tpl_num) {
                     $this->data_document['sommaires'][0]['records'][]['render'] = $tpl;
                 }
                 if (!$this->notice_tpl) {
                     $resultat_aff .= "<div class='hr'><hr /></div>\r\n";
                 } else {
                     $resultat_aff .= "<br />";
                 }
             }
         }
     }
     // on retrie chaque goupe de notice selon le critère de tri de la DSI
     // il faut trier les regroupements par ordre alphabétique (si document à générer et groupement)
     $this->aff_document = "";
     if ($this->document_generate) {
         if ($this->document_group) {
             $aff_document = "";
             $this->pmb_ksort($tri_tpl_document);
             $index = 0;
             $summary = "";
             global $group_separator;
             global $notice_separator;
             foreach ($tri_tpl_document as $titre => $liste) {
                 if ($group_separator) {
                     $aff_document .= $group_separator;
                 } else {
                     $aff_document .= "<div class='hr_group'><hr /></div>";
                 }
                 $index++;
                 if ($this->bannette_tpl_num) {
                     $this->data_document['sommaires'][$index]['level'] = 1;
                     $this->data_document['sommaires'][$index]['title'] = $titre;
                 }
                 $aff_document .= "<a name='[{$index}]'></a><h1>" . $index . " - " . $titre . "</h1>";
                 $summary .= "<a href='#[{$index}]' class='summary_elt'>" . $index . " - " . $titre . "</a><br />";
                 $nb = 0;
                 foreach ($liste as $val) {
                     $aff_document .= $val;
                     if ($this->bannette_tpl_num) {
                         $this->data_document['sommaires'][$index]['records'][$nb]['render'] = $val;
                     }
                     if (++$nb < count($liste)) {
                         if (!$this->notice_tpl) {
                             if ($notice_separator) {
                                 $aff_document .= $notice_separator;
                             } else {
                                 $aff_document .= "<div class='hr'><hr /></div>";
                             }
                         } else {
                             $aff_document .= "<br />";
                         }
                     }
                 }
                 $aff_document .= "\r\n";
             }
             //$summary.="</div>";
             if ($this->document_add_summary) {
                 $aff_document = "<a name='summary'></a><div class='summary'><br />" . $summary . "</div>" . $aff_document;
             }
             $this->aff_document = $aff_document;
         } else {
             $this->aff_document = $aff_document;
         }
     }
     // il faut trier les regroupements par ordre alphabétique
     if ($this->group_pperso) {
         $resultat_aff = $memo_resultat_aff;
         //ksort($tri_tpl);
         $this->pmb_ksort($tri_tpl);
         $index = 0;
         $summary = "";
         foreach ($tri_tpl as $titre => $liste) {
             global $group_separator;
             global $notice_separator;
             if ($group_separator) {
                 $resultat_aff .= $group_separator;
             } else {
                 $resultat_aff .= "<div class='hr_group'><hr /></div>";
             }
             $index++;
             if ($this->bannette_tpl_num) {
                 $this->data_document['sommaires'][$index]['level'] = 1;
                 $this->data_document['sommaires'][$index]['title'] = $titre;
             }
             $resultat_aff .= "<a name='[{$index}]'></a><h1>" . $index . " - " . $titre . "</h1>";
             $summary .= "<a href='#[{$index}]' class='summary_elt'>" . $index . " - " . $titre . "</a><br />";
             $nb = 0;
             foreach ($liste as $val) {
                 $resultat_aff .= $val;
                 if ($this->bannette_tpl_num) {
                     $this->data_document['sommaires'][$index]['records'][$nb]['render'] = $val;
                 }
                 if (++$nb < count($liste)) {
                     if (!$this->notice_tpl) {
                         if ($notice_separator) {
                             $resultat_aff .= $notice_separator;
                         } else {
                             $resultat_aff .= "<div class='hr'><hr /></div>";
                         }
                     } else {
                         $resultat_aff .= "<br />";
                     }
                 }
             }
             $resultat_aff .= "\r\n";
         }
         if ($this->document_add_summary) {
             $resultat_aff = "<a name='summary'></a><div class='summary'><br />" . $summary . "</div>" . $resultat_aff;
         }
     }
     if ($this->typeexport && !$use_limit) {
         $this->export_contenu = cree_export_notices($this->liste_id_notice, start_export::get_id_by_path($this->typeexport), 1, $this->param_export);
     }
     // DEBUG
     if (false && $this->export_contenu) {
         $fp = fopen("{$base_path}/temp/exp_bannette_" . $this->id_bannette . ".exp", "wb");
         fwrite($fp, $this->export_contenu);
         fclose($fp);
     }
     return $resultat_aff;
 }
示例#3
0
 function construit_contenu_HTML($use_limit = 1)
 {
     global $dbh;
     global $msg;
     global $opac_url_base;
     global $liens_opac;
     $url_base_opac = $opac_url_base . "index.php?database=" . DATA_BASE . "&lvl=notice_display&id=";
     if ($this->nb_notices_diff && $use_limit) {
         $limitation = " LIMIT {$this->nb_notices_diff} ";
     }
     $requete = "select num_notice from bannette_contenu, notices where num_bannette='" . $this->id_bannette . "' and notice_id=num_notice order by index_serie, tnvol, index_sew {$limitation} ";
     $resultat = pmb_mysql_query($requete, $dbh);
     // paramétrage :
     $environement["short"] = 6;
     $environement["ex"] = 0;
     $environement["exnum"] = 0;
     if ($this->nb_notices_diff >= $this->nb_notices || !$this->nb_notices_diff) {
         $nb_envoyees = $this->nb_notices;
     } else {
         $nb_envoyees = $this->nb_notices_diff;
     }
     $resultat_aff .= "<hr />";
     $resultat_aff .= sprintf($msg["dsi_diff_n_notices"], $nb_envoyees, $this->nb_notices);
     $resultat_aff .= "<hr />";
     while ($r = pmb_mysql_fetch_object($resultat)) {
         // afin de ne pas afficher les liens pour réservation de doc dans le mail :
         global $opac_resa;
         $opac_resa = 0;
         $depliable = 0;
         $notice = new notice_affichage($r->num_notice, $liens_opac);
         $notice->do_header();
         $notice->do_isbd();
         $notice->genere_simple($depliable, 'ISBD');
         $resultat_aff .= "<a href='" . $url_base_opac . $r->num_notice . "'><b>" . $notice->notice_header . "</b></a><br /><br />\r\n";
         $resultat_aff .= $notice->notice_isbd;
         $resultat_aff .= "<hr />\r\n";
     }
     if ($this->typeexport) {
         $this->export_contenu = cree_export_notices($this->liste_id_notice, start_export::get_id_by_path($this->typeexport), 1);
     }
     return $resultat_aff;
 }