id = $id+0; } public function proceed($entity_type,$context=array()){ global $charset; $frbr_build = new frbr_build($this->id, $entity_type); $display_graph = false; if($frbr_build->has_page() && $frbr_build->has_cadres()) { //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->get_details_display(); if($charset == "utf-8"){ $this->dom->loadHTML("".$html); }else{ $this->dom->loadHTML($html); } if (!$this->dom->getElementById('noticeNot')) { $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("noticeNot")->parentNode->appendChild($this->dom->importNode($this->dom->getElementById("blocNotice_descr"),true)); $this->dom->getElementById("noticeNot")->parentNode->appendChild($this->dom->importNode($this->dom->getElementById("docnum"),true)); break; case 'frbr_graph' : $graph_node = $this->dom->createElement("div"); $graph_node->setAttribute('id', 'frbr_entity_graph'); $this->dom->getElementById("noticeNot")->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("noticeNot")->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("noticeNot")->parentNode->removeChild($this->dom->getElementById('noticeNot')); } //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); } else { print $this->get_details_display(); } } protected function calculate_restrict_access_rights() { global $gestion_acces_active, $gestion_acces_empr_notice; $this->acces_v=TRUE; if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $ac= new acces(); $dom_2= $ac->setDomain(2); $this->acces_v = $dom_2->getRights($_SESSION['id_empr_session'],$this->id,4); } else { $query = "SELECT notice_visible_opac, expl_visible_opac, notice_visible_opac_abon, expl_visible_opac_abon, explnum_visible_opac, explnum_visible_opac_abon FROM notices, notice_statut WHERE notice_id ='".$this->id."' and id_notice_statut=statut "; $result = pmb_mysql_query($query); if(pmb_mysql_num_rows($result)) { $statut_temp = pmb_mysql_fetch_object($result); if(!$statut_temp->notice_visible_opac) $this->acces_v=FALSE; if($statut_temp->notice_visible_opac_abon && !$_SESSION['id_empr_session']) $this->acces_v=FALSE; } else $this->acces_v=FALSE; } } protected function get_details_explnum_display() { global $msg, $charset; global $mode_phototeque, $opac_photo_mean_size_x, $opac_photo_show_form; global $opac_visionneuse_allow, $sendToVisionneuseNoticeDisplay; $display = ''; if (isset($mode_phototeque) && $mode_phototeque) { // Traitement exemplaire numerique $query = "SELECT explnum_id, explnum_notice, explnum_bulletin, explnum_nom, explnum_mimetype, explnum_url, explnum_data, explnum_vignette, explnum_nomfichier, explnum_extfichier FROM explnum WHERE "; $query .= "explnum_notice='".$this->id."' "; $query .= " order by explnum_id LIMIT 1"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $explnumobj=pmb_mysql_fetch_object($result); if ($explnumobj->explnum_url) { $display .= "
explnum_url."\"/>

"; } else{ //répertoire d'upload ou stockage en base, le traitement reste identique... $display .= "
explnum_id."\"/>

"; } if ($opac_photo_show_form) { $display .= "
".htmlentities($msg["command_phototeque_command_command"],ENT_QUOTES,$charset)."
"; } } $hide_explnum=1; } else { $query = "select explnum_id from explnum join bulletins on explnum_bulletin=bulletin_id where num_notice=".$this->id." union select explnum_id from explnum where explnum_notice=".$this->id; $result = pmb_mysql_query($query); if($opac_visionneuse_allow && pmb_mysql_num_rows($result)){ //print "   ".$link_to_visionneuse; $display .= $sendToVisionneuseNoticeDisplay; } } return $display; } protected function get_details_display() { global $msg, $charset; global $pmb_logs_activate; global $opac_notices_depliable; $display = ''; if(!isset($this->acces_v)) { $this->calculate_restrict_access_rights(); } if($this->id && $this->acces_v) { if($pmb_logs_activate) notice::recup_notice_infos($this->id); $query = "SELECT notice_id, niveau_biblio,typdoc,(opac_visible_bulletinage&0x1) as opac_visible_bulletinage FROM notices WHERE notice_id='".$this->id."' LIMIT 1"; $result = pmb_mysql_query($query); while ($obj=pmb_mysql_fetch_object($result)) { $display .= $this->get_details_explnum_display(); $opac_notices_depliable = 0; switch($obj->niveau_biblio) { case "s": $display .= aff_notice($this->id); if(!$obj->opac_visible_bulletinage) { break; } $display .= record_display::get_display_bulletins_list($this->id); break; case "a": $display .= aff_notice($this->id); break; case "m": default : $display .= "
".aff_notice($this->id); break; } } } else { $display .= "

".htmlentities($msg['record_display_forbidden'],ENT_QUOTES,$charset).'

'; } return $display; } public function get_facetteslist() { global $nbr_lignes; if(!isset($this->acces_j)) { $this->calculate_restrict_access_rights(); } $facettes_tpl = ''; //comparateur de facettes : on ré-initialise $_SESSION['facette']=""; if($nbr_lignes){ $query = "SELECT distinct notices.notice_id FROM notices ".$this->get_join_recordslist()." ".$this->acces_j." ".$this->statut_j; $query .= " WHERE ".$this->get_clause_authority_id_recordslist()." $this->statut_r "; $facettes_tpl .= facettes::get_display_list_from_query($query); } return $facettes_tpl; } protected function build_graph(){ global $include_path; $html = ''; $record = new record_datas($this->id); $frbr_entity_graph = frbr_entity_graph::get_entity_graph($record, 'record'); $frbr_entity_graph->get_entities_graphed(true); $content = $frbr_entity_graph->get_json_entities_graphed(); $entities_graphed = $frbr_entity_graph->get_entities_graphed(); if (count($entities_graphed['links'])) { $template_path = $include_path.'/templates/frbr_entities_graph.tpl.html'; if(file_exists($include_path.'/templates/frbr_entities_graph_subst.tpl.html')){ $template_path = $include_path.'/templates/frbr_entities_graph_subst.tpl.html'; } if(file_exists($template_path)){ $h2o = new H2o($template_path); $graph = array('nodes'=> $content['nodes'], 'links' => $content['links']); $html = $h2o->render(array('graph' => $graph)); $tmp_dom = new domDocument(); if($charset == "utf-8"){ @$tmp_dom->loadHTML("".$html); }else{ @$tmp_dom->loadHTML($html); } if (!$tmp_dom->getElementById('entity_graph')) { $tmp_dom = $this->setAllId($tmp_dom); } $this->dom->getElementById("frbr_entity_graph")->appendChild($this->dom->importNode($tmp_dom->getElementById('entity_graph'),true)); } } } public function setAllId($DOMNode){ if($DOMNode->hasChildNodes()){ for ($i=0; $i<$DOMNode->childNodes->length;$i++) { $this->setAllId($DOMNode->childNodes->item($i)); } } if($DOMNode->hasAttributes()){ $id=$DOMNode->getAttribute("id"); if($id){ $DOMNode->setIdAttribute("id",true); } } return $DOMNode; } }