id_tpl=$id_tpl+0;
$this->fetch_data();
}
protected function fetch_data(){
if(!$this->id_tpl)return false;
$this->noti_tpl = notice_tpl_gen::get_instance($this->id_tpl);
}
public function get_onglet_header(){
return($this->noti_tpl->name);
}
public function get_onglet_content($id_notice){
return $this->noti_tpl->build_notice($id_notice);
}
} // class end
class notice_onglets {
protected static $notice_onglet;
protected $data_onglets_perso;
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 = intval($id_notice);
$onglets_title="";
$onglets_content="";
if($this->ids) {
$onglets=explode(",", $this->ids);
foreach($onglets as $id_tpl) {
if(is_numeric($id_tpl)) {
if(!isset(static::$notice_onglet[$id_tpl])) {
static::$notice_onglet[$id_tpl] = new notice_onglet($id_tpl);
}
$notice_onglet=static::$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 && $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 = intval($id_notice);
$onglets_title="";
$onglets_content="";
$this->data_onglets_perso = array();
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)){
if(!isset(static::$notice_onglet[$id_tpl])) {
static::$notice_onglet[$id_tpl] = new notice_onglet($id_tpl);
}
$notice_onglet=static::$notice_onglet[$id_tpl];
$title = $notice_onglet->get_onglet_header();
$content = $notice_onglet->get_onglet_content($id_notice);
if($title && $content){
$onglet_title = "
".$title."
";
$onglet_content = "
".$content."
";
$this->data_onglets_perso[] = array(
'id' => $id_tpl,
'title' => $title,
'content' => $content,
'onglet_title' => $onglet_title,
'onglet_content' => $onglet_content,
);
$onglets_title.= $onglet_title;
$onglets_content.= $onglet_content;
}
}
}
}
return $onglets_title.$li_tags."".$onglets_content;
}
public function get_data_onglets_perso() {
return $this->data_onglets_perso;
}
} // class end