authority = $authority;
}
public function proceed($entity_type,$context=array()){
global $facettes_tpl;
global $charset;
if(!isset($this->authority) || !is_object($this->authority)) {
//Autorité inconnue
return;
}
$frbr_build = new frbr_build($this->id, $entity_type);
$facettes_tpl = '';
$display_graph = false;
if($frbr_build->has_page() && $frbr_build->has_cadres()) {
//Nous avons aussi besoin de calculer les notices si les facettes sont affichées
if($frbr_build->get_page()->get_parameter_value('records_list') || $frbr_build->get_page()->get_parameter_value('facettes_list')) {
// LISTE DE NOTICES ASSOCIEES
$template_directory = "";
if ($frbr_build->get_page()->get_parameter_value('record_template_directory')) {
$template_directory = $frbr_build->get_page()->get_parameter_value('record_template_directory');
}
$this->authority->set_recordslist($this->get_recordslist($template_directory));
}
//récupération des données des jeux de données
$datanodes_data = $frbr_build->get_datanodes_data();
$this->dom = new DOMDocument();
$this->dom->encoding = $charset;
$old_errors_value = false;
if(libxml_use_internal_errors(true)){
$old_errors_value = true;
}
$html = $this->authority->render($context);
if($charset == "utf-8"){
$this->dom->loadHTML("".$html);
}else{
$this->dom->loadHTML($html);
}
if (!$this->dom->getElementById('aut_details')) {
$this->dom = $this->setAllId($this->dom);
}
foreach ($frbr_build->get_cadres() as $cadre) {
if ($cadre['place_visibility']) {
if($cadre['cadre_type']) {
switch ($cadre['cadre_type']) {
case 'isbd':
$this->dom->getElementById("aut_details")->parentNode->appendChild($this->dom->importNode($this->dom->getElementById("aut_see"),true));
break;
case 'records_list':
$this->dom->getElementById("aut_details")->parentNode->appendChild($this->dom->importNode($this->dom->getElementById("aut_details_liste"),true));
break;
case 'frbr_graph' :
$graph_node = $this->dom->createElement("div");
$graph_node->setAttribute('id', 'frbr_entity_graph');
$this->dom->getElementById("aut_details")->parentNode->appendChild($graph_node);
break;
}
} else {
$view_instance = new $cadre['cadre_object']($cadre['id']);
$html = $view_instance->show_cadre($datanodes_data);
$tmp_dom = new domDocument();
if($charset == "utf-8"){
@$tmp_dom->loadHTML("".$html);
}else{
@$tmp_dom->loadHTML($html);
}
if (!$tmp_dom->getElementById($view_instance->get_dom_id())) {
$tmp_dom = $this->setAllId($tmp_dom);
}
$this->dom->getElementById("aut_details")->parentNode->appendChild($this->dom->importNode($tmp_dom->getElementById($view_instance->get_dom_id()),true));
}
}
if ($cadre['cadre_visible_in_graph']) {
$display_graph = true;
}
}
if(!$frbr_build->get_page()->get_parameter_value('isbd')) {
$this->dom->getElementById("aut_details_container")->removeChild($this->dom->getElementById('aut_see'));
}
if(!$frbr_build->get_page()->get_parameter_value('records_list')) {
$this->dom->getElementById("aut_details_container")->removeChild($this->dom->getElementById('aut_details_liste'));
}
//frbr_graph
if ($this->dom->getElementById("frbr_entity_graph")) {
if ($display_graph) {
$this->build_graph();
} else {
$this->dom->getElementById("frbr_entity_graph")->parentNode->removeChild($this->dom->getElementById("frbr_entity_graph"));
}
}
print $this->dom->saveHTML();
libxml_use_internal_errors($old_errors_value);
if($frbr_build->get_page()->get_parameter_value('facettes_list')) {
// FACETTES
$facettes_tpl = $this->get_facetteslist();
}
} else {
// LISTE DE NOTICES ASSOCIEES
$this->authority->set_recordslist($this->get_recordslist());
print $this->authority->render($context);
// FACETTES
$facettes_tpl = $this->get_facetteslist();
}
}
protected function calculate_restrict_access_rights() {
global $gestion_acces_active, $gestion_acces_empr_notice;
$this->acces_j='';
if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) {
$ac= new acces();
$dom_2= $ac->setDomain(2);
$this->acces_j = $dom_2->getJoin($_SESSION['id_empr_session'],4,'notice_id');
}
if($this->acces_j) {
$this->statut_j='';
$this->statut_r='';
} else {
$this->statut_j=',notice_statut';
$this->statut_r="and 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(isset($_SESSION["opac_view"]) && $_SESSION["opac_view"] && isset($_SESSION["opac_view_query"]) && $_SESSION["opac_view_query"] ){
$opac_view_restrict=" notice_id in (select opac_view_num_notice from opac_view_notices_".$_SESSION["opac_view"].") ";
$this->statut_r.=" and ".$opac_view_restrict;
}
}
/**
* Retourne les notices associées
*/
public function get_recordslist($template_directory = "") {
global $msg, $base_path, $class_path, $include_path;
global $opac_visionneuse_allow, $opac_photo_filtre_mimetype, $link_to_visionneuse, $sendToVisionneuseByGet;
global $opac_allow_bannette_priv, $allow_dsi_priv;
global $opac_nb_aut_rec_per_page;
global $opac_search_allow_refinement, $opac_allow_external_search;
global $nbr_lignes, $page;
global $opac_notices_depliable;
global $begin_result_liste;
global $add_cart_link;
global $from;
global $nb_per_page_custom;
$recordslist = "
".$this->get_title_recordslist()."
\n";
//droits d'acces emprunteur/notice
$this->calculate_restrict_access_rights();
// comptage des notices associées
if(!$nbr_lignes) {
$requete = "SELECT COUNT(distinct notice_id) FROM notices ".$this->get_join_recordslist()." ".$this->acces_j." ".$this->statut_j;
$requete.= " where ".$this->get_clause_authority_id_recordslist()." $this->statut_r ";
$res = pmb_mysql_query($requete);
$nbr_lignes = pmb_mysql_result($res, 0, 0);
//Recherche des types doc
$requete = "select distinct notices.typdoc from notices ".$this->get_join_recordslist()." ".$this->acces_j." ".$this->statut_j;
$clause = " where ".$this->get_clause_authority_id_recordslist()." ".$this->statut_r." group by notices.typdoc";
if ($opac_visionneuse_allow){
$requete_noti = "select distinct notices.typdoc, count(explnum_id) as nbexplnum from notices ".$this->get_join_recordslist()." left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_notice = notice_id ".$this->acces_j." ".$this->statut_j." ";
$requete_bull = "select distinct notices.typdoc, count(explnum_id) as nbexplnum from notices ".$this->get_join_recordslist()." left join bulletins on bulletins.num_notice = notice_id and bulletins.num_notice != 0 left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_bulletin != 0 and explnum_bulletin = bulletin_id ".$this->acces_j." ".$this->statut_j." ";
$requete = "select distinct uni.typdoc, sum(nbexplnum) as nbexplnum from ($requete_noti $clause union $requete_bull $clause) as uni group by uni.typdoc";
}else{
$requete.= $clause;
}
$res = pmb_mysql_query($requete);
$t_typdoc=array();
$nbexplnum_to_photo=0;
if($res) {
while ($tpd=pmb_mysql_fetch_object($res)) {
$t_typdoc[]=$tpd->typdoc;
if ($opac_visionneuse_allow)
$nbexplnum_to_photo += $tpd->nbexplnum;
}
}
$l_typdoc=implode(",",$t_typdoc);
}else if ($opac_visionneuse_allow){
$clause = "where ".$this->get_clause_authority_id_recordslist()." ".$this->statut_r." group by notices.typdoc";
$requete_noti = "select distinct notices.typdoc, count(explnum_id) as nbexplnum from notices ".$this->get_join_recordslist()." left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_notice = notice_id ".$this->acces_j." ".$this->statut_j." ";
$requete_bull = "select distinct notices.typdoc, count(explnum_id) as nbexplnum from notices ".$this->get_join_recordslist()." left join bulletins on bulletins.num_notice = notice_id and bulletins.num_notice != 0 left join explnum on explnum_mimetype in ($opac_photo_filtre_mimetype) and explnum_bulletin != 0 and explnum_bulletin = bulletin_id ".$this->acces_j." ".$this->statut_j." ";
$requete = "select distinct uni.typdoc, sum(nbexplnum) as nbexplnum from ($requete_noti $clause union $requete_bull $clause) as uni group by uni.typdoc";
$res = pmb_mysql_query($requete);
$nbexplnum_to_photo = 0;
if($res) {
while ($tpd=pmb_mysql_fetch_object($res)) {
$nbexplnum_to_photo += $tpd->nbexplnum;
}
}
}
// pour la DSI - création d'une alerte
if ($nbr_lignes && $opac_allow_bannette_priv && $allow_dsi_priv && ((isset($_SESSION['abon_cree_bannette_priv']) && $_SESSION['abon_cree_bannette_priv']==1) || $opac_allow_bannette_priv==2)) {
$recordslist.= "";
}
// pour la DSI - Modification d'une alerte
if ($nbr_lignes && $opac_allow_bannette_priv && $allow_dsi_priv && ((isset($_SESSION['abon_edit_bannette_priv']) && $_SESSION['abon_edit_bannette_priv']==1) || $opac_allow_bannette_priv==2)) {
$recordslist.= "";
}
// Ouverture du div resultatrech_liste
$recordslist.= "
";
if(!$page) $page=1;
$debut =($page-1)*$opac_nb_aut_rec_per_page;
if($nbr_lignes) {
// on lance la requête de sélection des notices
$requete = "SELECT distinct notices.notice_id FROM notices ".$this->get_join_recordslist()." ".$this->acces_j." ".$this->statut_j;
$requete.= " WHERE ".$this->get_clause_authority_id_recordslist()." $this->statut_r ";
//gestion du tri
$requete = sort::get_sort_query($requete, $nbr_lignes, $debut);
$res = pmb_mysql_query($requete);
if ($opac_notices_depliable) $recordslist.= $begin_result_liste;
//gestion du tri
$recordslist.= sort::show_tris_in_result_list($nbr_lignes);
$recordslist.= $add_cart_link;
if($opac_visionneuse_allow && $nbexplnum_to_photo){
$recordslist.= "".$link_to_visionneuse;
$sendToVisionneuseByGet = str_replace("!!mode!!", $this->get_mode_recordslist(),$sendToVisionneuseByGet);
$sendToVisionneuseByGet = str_replace("!!idautorite!!",$this->id,$sendToVisionneuseByGet);
$recordslist.= $sendToVisionneuseByGet;
}
$recordslist.=suggest::get_add_link();
//affinage
//enregistrement de l'endroit actuel dans la session
rec_last_authorities();
// Gestion des alertes à partir de la recherche simple
include_once($include_path."/alert_see.inc.php");
$recordslist.= $alert_see_mc_values;
//affichage
if($opac_search_allow_refinement){
$recordslist.= "".$msg["affiner_recherche"]."";
}
//fin affinage
//Etendre
if ($opac_allow_external_search) $recordslist.= "".$msg["connecteurs_external_search_sources"]."";
//fin etendre
/*****Spécifique au catégories***/
if(get_called_class() == 'authority_page_category') {
global $auto_postage_form;
if ($auto_postage_form) $recordslist.= "
".$auto_postage_form."
";
}
/*****Spécifique au catégories***/
$recordslist.= "