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; }
function cree_export_notices($liste = array(), $typeexport = 'pmbxml2marciso', $expl = 1, $param_export) { global $base_path; global $keep_expl, $dbh; $keep_expl = $expl; // Récupération des notices $n_notices = count($liste); if ($n_notices == 0) { return ""; } else { // Export ! $z = 0; $e_notice = ""; $nb_notices = 0; $_SESSION["param_export"]["notice_exporte"] = array(); $_SESSION["param_export"]["bulletin_exporte"] = array(); while ($z < count($liste)) { $id = $liste[$z]; // Exclure de l'export (opac, panier) les fiches interdites de diffusion dans administration, Notices > Origines des notices NG72 $sql = "select orinot_diffusion from origine_notice,notices where notice_id = '{$id}' and origine_catalogage = orinot_id"; $res = pmb_mysql_query($sql, $dbh); if (pmb_mysql_num_rows($res)) { $diffusable = pmb_mysql_result($res, 0, 0); if ($diffusable) { $export = new start_export($id, $typeexport, $param_export); $e_notice .= $export->output_notice; $nb_notices++; } } $z++; } } if ($nb_notices > 0) { $e_notice = $export->get_header() . $e_notice . $export->get_footer(); } return $e_notice; }
// bannette créée, on supprime le bouton des rech multicritères $_SESSION['abon_cree_bannette_priv'] = 0; print "<br />"; print pmb_bidi(str_replace("!!nom_bannette!!", stripslashes($nom_bannette), $msg['dsi_bannette_creer_resultat'])); print "<br /><br />"; // pour construction correcte du mail de diffusion $liens_opac = array(); $bannette = new bannette($id_bannette); $bannette->vider(); print pmb_bidi($bannette->remplir()); $bannette->diffuser($equ_human); } else { $s = new search(); $equ_human = $s->make_serialized_human_query($equation); if ($opac_allow_bannette_export) { $exp = start_export::get_exports(); $liste_exports = "<tr>\n\t\t\t\t\t\t<td align=right>" . $msg['dsi_ban_typeexport'] . "</td>\n\t\t\t\t\t\t<td><select name='typeexport'>"; $liste_exports .= "<option value='' selected>" . $msg[dsi_ban_noexport] . "</option>"; for ($i = 0; $i < count($exp); $i++) { $liste_exports .= "<option value='" . $exp[$i]["PATH"] . "' >" . $exp[$i]["NAME"] . "</option>"; } $liste_exports .= "</select></td>\n\t\t\t\t\t\t</tr>"; } else { $liste_exports = ""; } print pmb_bidi($equ_human . "<br /><br />"); print "<form name='creer_dsi' method='post'>\n\t\t\t\t<input type='hidden' name='equation' value=\"" . htmlentities($equation, ENT_QUOTES, $charset) . "\" />\n\t\t\t\t<input type='hidden' name='enregistrer' value='1' />\n\t\t\t\t<input type='hidden' name='lvl' value='bannette_creer' />\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align=right>" . $msg['dsi_priv_form_nom'] . "</td>\n\t\t\t\t\t\t<td><input type='text' name='nom_bannette' value='' /></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align=right>" . $msg['dsi_priv_form_periodicite'] . "</td>\n\t\t\t\t\t\t<td><input type='text' name='periodicite' value='" . $opac_bannette_priv_periodicite . "' /></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t{$liste_exports}\n\t\t\t\t\t</table>\n\t\t\t\t<input type='submit' class='bouton' value=\"" . $msg[dsi_bannette_creer_sauver] . "\"/>\n\t\t\t\t</form>\n\t\t\t\t"; } } else { // y'a un binz, pas d'équation... }
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; }
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; }
$is_externe = false; if (substr($cart_[$z], 0, 2) != "es") { // Exclure de l'export (opac, panier) les fiches interdites de diffusion dans administration, Notices > Origines des notices NG72 $sql = "select 1 from origine_notice,notices where notice_id = '{$cart_[$z]}' and origine_catalogage = orinot_id and orinot_diffusion='1'"; } else { $id_externe = substr($cart_[$z], 2); $is_externe = true; $requete = "SELECT source_id FROM external_count WHERE rid=" . $id_externe; $myQuery = pmb_mysql_query($requete, $dbh); $source_id = pmb_mysql_result($myQuery, 0, 0); $sql = "select 1 from entrepot_source_{$source_id} where recid='" . $id_externe . "' group by ufield,usubfield,field_order,subfield_order,value"; } $res = pmb_mysql_query($sql, $dbh); if ($ligne = pmb_mysql_fetch_array($res)) { $nb_fiche++; $export = new start_export($id_externe ? $id_externe : $cart_[$z], $typeexport, $is_externe); $exportation .= $export->output_notice; } } if ($nb_fiche > 0) { $exportation = $export->get_header() . $exportation . $export->get_footer(); header("Content-type: " . $export->get_mime_type()); header('Content-Disposition: attachment; filename="export.' . $export->get_suffix() . '"'); print $exportation; global $pmb_logs_activate; if ($pmb_logs_activate) { global $log, $infos_notice, $infos_expl; $rqt = " select empr_prof,empr_cp, empr_ville as ville, empr_year, empr_sexe, 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\t\tfrom empr e\n\t\t\t\t\t\tleft join empr_codestat code on code.idcode=e.empr_codestat\n\t\t\t\t\t\tleft join empr_statut es on e.empr_statut=es.idstatut\n\t\t\t\t\t\tleft join empr_categ categ on categ.id_categ_empr=e.empr_categ\n\t\t\t\t\t\tleft join empr_groupe eg on eg.empr_id=e.id_empr\n\t\t\t\t\t\tleft join groupe gr on eg.groupe_id=gr.id_groupe\n\t\t\t\t\t\tleft join docs_location dl on e.empr_location=dl.idlocation\n\t\t\t\t\t\tleft join resa on e.id_empr=resa_idempr\n\t\t\t\t\t\tleft join pret on e.id_empr=pret_idempr\n\t\t\t\t\t\twhere e.empr_login='******'\n\t\t\t\t\t\tgroup by resa_idempr, pret_idempr"; $res = pmb_mysql_query($rqt); if ($res) { $empr_carac = pmb_mysql_fetch_array($res);
static function get_id_by_path($path) { global $export_list; if (!count($export_list)) { start_export::get_exports(); } for ($i = 0; $i < count($export_list); $i++) { if ($export_list[$i]["PATH"] == $path) { return $export_list[$i]["IDALL"]; } } }