id_tpl=$id_tpl+0;
$this->fetch_data();
}
protected function fetch_data(){
if(!$this->id_tpl)return false;
$this->noti_tpl=new notice_tpl_gen($this->id_tpl);
}
public function get_onglet_header(){
//print ($this->noti_tpl->name);
return($this->noti_tpl->name);
}
public function get_onglet_content($id_notice){
$tpl= $this->noti_tpl->build_notice($id_notice);
return $tpl;
}
} // class end
class notice_onglets {
public function __construct($ids=''){
global $opac_notices_format_onglets;
if(!$ids)$ids=$opac_notices_format_onglets;
$this->ids=$ids;
}
public function insert_onglets($id_notice,$retour_aff){
$id_notice+=0;
$onglets_title="";
$onglets_content="";
if($this->ids){
$onglets=explode(",", $this->ids);
foreach($onglets as $id_tpl){
if(is_numeric($id_tpl)){
$notice_onglet=new notice_onglet($id_tpl);
$title=$notice_onglet->get_onglet_header();
$onglet_title="
".$title."
";
$content=$notice_onglet->get_onglet_content($id_notice);
$onglet_content="
".$content."
";
// Si pas de titre ou de contenu rien ne s'affiche.
if($title && $onglet_content){
$onglets_title.=$onglet_title;
$onglets_content.=$onglet_content;
}
}
}
}
$retour_aff=str_replace('', $onglets_title, $retour_aff);
$retour_aff=str_replace('', $onglets_content, $retour_aff);
return $retour_aff;
}
public function build_onglets($id_notice,$li_tags){
global $opac_notices_format,$msg;
$id_notice+=0;
$onglets_title="";
$onglets_content="";
if($this->ids){
$onglets=explode(",", $this->ids);
$first=1;
foreach($onglets as $id_tpl){
// gestion du premier onglet vivible
if(!$opac_notices_format && $first){
$class_onglet='isbd_public_active';
$display_onglet='display:block;';
$first=0;
}else {
$class_onglet='isbd_public_inactive';
$display_onglet='display:none;';
}
if($id_tpl=="ISBD"){
$onglets_title.="
".$msg['ISBD']."";
$onglets_content.="
!!ISBD!!
";
}elseif($id_tpl=="PUBLIC"){
$onglets_title.="
".$msg['Public']."";
$onglets_content.="
!!PUBLIC!!
";
}elseif(is_numeric($id_tpl)){
$notice_onglet=new notice_onglet($id_tpl);
$title=$notice_onglet->get_onglet_header();
if($title){
$onglets_title.="
".$title."
";
$onglets_content.="
".$notice_onglet->get_onglet_content($id_notice)."
";
}
}
}
}
return $onglets_title.$li_tags."".$onglets_content;
}
} // class end