id = $id+0;
$datetime = new DateTime();
$this->datetime = $datetime->getTimestamp();
$this->hash = $this->generate_hash();
}
public function proceed($entity_type,$context=array()){
global $charset;
$frbr_build = frbr_build::get_instance($this->id, $entity_type);
$display_graph = false;
$this->calculate_restrict_access_rights();
if($frbr_build->has_page() && $frbr_build->has_cadres() && $this->acces_v) {
//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);
}
if ($this->dom->getElementById("noticeNot") == null) {
print $html;
$this->add_tab_result_read();
return;
}
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));
if ($this->dom->getElementById("docnum") !== null) {
$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();
}
$this->add_tab_result_read();
}
protected function is_authorized_in_view() {
if(!empty($_SESSION["opac_view"]) && !empty($_SESSION["opac_view_query"])){
$query = "select opac_view_num_notice from opac_view_notices_".$_SESSION["opac_view"]." where opac_view_num_notice =".$this->id;
$result = pmb_mysql_query($query);
if(!pmb_mysql_num_rows($result)) {
$this->acces_v = FALSE;
}
}
}
protected function calculate_restrict_access_rights() {
global $gestion_acces_active, $gestion_acces_empr_notice;
global $opac_opac_view_activate;
$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;
}
//Visible - Mais est-elle visible dans la vue OPAC ?
if($this->acces_v && $opac_opac_view_activate) {
$this->is_authorized_in_view();
}
}
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 .= "