output_format = trim($str_output_format);
} else { $this->output_format = $str_output_format; }
$this->obj_db = $obj_db;
$this->detail_id = $int_detail_id;
$_sql = sprintf('SELECT b.*, l.language_name, p.publisher_name, pl.place_name AS \'publish_place\', gmd.gmd_name, fr.frequency FROM biblio AS b
LEFT JOIN mst_gmd AS gmd ON b.gmd_id=gmd.gmd_id
LEFT JOIN mst_language AS l ON b.language_id=l.language_id
LEFT JOIN mst_publisher AS p ON b.publisher_id=p.publisher_id
LEFT JOIN mst_place AS pl ON b.publish_place_id=pl.place_id
LEFT JOIN mst_frequency AS fr ON b.frequency_id=fr.frequency_id
WHERE biblio_id=%d', $int_detail_id);
// for debugging purpose only
// die($_sql);
// query the data to database
$_det_q = $obj_db->query($_sql);
if ($obj_db->error) {
$this->error = $obj_db->error;
} else {
$this->error = false;
$this->record_detail = $_det_q->fetch_assoc();
// free the memory
$_det_q->free_result();
}
}
/**
* Method to print out the document detail based on template
*
* @return void
*/
public function showDetail()
{
if ($this->error) {
return '
Error Fetching data for record detail. Server return error message: '.$this->error.'
';
} else {
if ($this->output_format == 'html' AND !empty($this->list_template)) {
return parent::parseListTemplate($this->htmlOutput());
} else if ($this->output_format == 'mods') {
return $this->MODSoutput();
} else {
// external output function
if (function_exists($this->output_format)) {
$_ext_func = $this->output_format;
return $_ext_func();
}
return null;
}
}
}
/**
* Record detail output in HTML mode
* @return array
*
*/
protected function htmlOutput()
{
// get global configuration vars array
global $sysconf;
$_detail_link = SWB.'index.php?p=show_detail&id='.$this->detail_id;
//add dfsptra@gmail.com generate viewer
$sql = $this->obj_db->query ("UPDATE biblio SET viewer = viewer + 1, timestamp = NOW()
WHERE biblio_id = ".$this->detail_id);
//
foreach ($this->record_detail as $idx => $data) {
if ($idx == 'notes') {
$data = nl2br($data);
} else {
$data = trim(strip_tags($data));
}
$this->record_detail[$idx] = $data;
}
// get title and set it to public record_title property
$this->record_title = $this->record_detail['title'];
$this->metadata = '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
$this->metadata .= '';
// check image
if (!empty($this->record_detail['image'])) {
if ($sysconf['tg']['type'] == 'phpthumb') {
$this->record_detail['image'] = '';
} elseif ($sysconf['tg']['type'] == 'minigalnano') {
$this->record_detail['image'] = '';
} else {
$this->record_detail['image'] = '';
}
} else {
$this->record_detail['image'] = '';
}
// get single authors
$_biblio_authors_za = $this->obj_db->query('SELECT author_name FROM mst_author AS a'
.' LEFT JOIN biblio_author AS ba ON a.author_id=ba.author_id WHERE ba.biblio_id='.$this->detail_id.' ORDER BY level ASC LIMIT 1');
$autan = '';
$datazzz = $_biblio_authors_za->fetch_row();
$autan .= ''.$datazzz[0]."";
$this->metadata .= $datazzz[0].'; ';
$this->metadata .= '" />';
$this->record_detail['authors_single'] = $autan;
// get the authors data
$_biblio_authors_q = $this->obj_db->query('SELECT author_name, authority_type FROM mst_author AS a'
.' LEFT JOIN biblio_author AS ba ON a.author_id=ba.author_id WHERE ba.biblio_id='.$this->detail_id.' ORDER BY level ASC');
$authors = '';
// authors for metadata
$this->metadata .= ''.$data[0]." - ".$data[1]." ";
$this->metadata .= $data[0].'; ';
}
$this->metadata .= '" />';
$this->record_detail['authors'] = $authors;
// free memory
$_biblio_authors_q->free_result();
// get the topics data
$_biblio_topics_q = $this->obj_db->query('SELECT topic FROM mst_topic AS a
LEFT JOIN biblio_topic AS ba ON a.topic_id=ba.topic_id WHERE ba.biblio_id='.$this->detail_id);
$topics = '';
$this->metadata .= ''.$data[0]." ";
$this->metadata .= $data[0].'; ';
}
$this->metadata .= '" />';
$this->record_detail['subjects'] = $topics;
// free memory
$_biblio_topics_q->free_result();
// availability
$this->record_detail['availability'] = '