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'] = '
LOADING LIST...
'; $this->record_detail['availability'] .= ''; // attachments $this->record_detail['file_att'] = '
LOADING LIST...
'; $this->record_detail['file_att'] .= ''; if ($sysconf['social_shares']) { // share buttons $_detail_link_encoded = urlencode('http://'.$_SERVER['SERVER_NAME'].$_detail_link); $_share_btns = "\n".''."\n"; $this->record_detail['social_shares'] = $_share_btns; } return $this->record_detail; } /** * Record detail output in MODS (Metadata Object Description Schema) XML mode * @return array * */ public function MODSoutput() { // get global configuration vars array global $sysconf; // convert to htmlentities foreach ($this->record_detail as $_field => $_value) { if (is_string($_value)) { $this->record_detail[$_field] = preg_replace_callback('/&([a-zA-Z][a-zA-Z0-9]+);/S', 'utility::convertXMLentities', htmlspecialchars(trim($_value))); } } // set prefix and suffix $this->detail_prefix = ''."\n"; $this->detail_suffix = ''; $_xml_output = ''."\n"; // parse title $_title_sub = ''; $_title_statement_resp = ''; if (stripos($this->record_detail['title'], ':') !== false) { $_title_main = trim(substr_replace($this->record_detail['title'], '', stripos($this->record_detail['title'], ':')+1)); $_title_sub = trim(substr_replace($this->record_detail['title'], '', 0, stripos($this->record_detail['title'], ':')+1)); } else if (stripos($this->record_detail['title'], '/') !== false) { $_title_statement_resp = trim(substr_replace($this->record_detail['title'], '', stripos($this->record_detail['title'], '/')+1)); } else { $_title_main = trim($this->record_detail['title']); } $_xml_output .= ''."\n".''.$_title_main.''."\n"; if ($_title_sub) { $_xml_output .= ''.$_title_sub.''."\n"; } $_xml_output .= ''."\n"; // personal name // get the authors data $_biblio_authors_q = $this->obj_db->query('SELECT a.*,ba.level 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); while ($_auth_d = $_biblio_authors_q->fetch_assoc()) { $_xml_output .= ''."\n" .''.$_auth_d['author_name'].''."\n" .''.$sysconf['authority_level'][$_auth_d['level']].''."\n" .''."\n"; } $_biblio_authors_q->free_result(); // resources type $_xml_output .= 'mixed material'."\n"; // gmd $_xml_output .= 'bibliography'."\n"; // imprint/publication data $_xml_output .= ''."\n"; $_xml_output .= ''.$this->record_detail['publish_place'].''."\n" .''.$this->record_detail['publisher_name'].''."\n" .''.$this->record_detail['publish_year'].''."\n"; if ((integer)$this->record_detail['frequency_id'] > 0) { $_xml_output .= 'continuing'."\n"; $_xml_output .= ''.$this->record_detail['frequency'].''."\n"; } else { $_xml_output .= 'monographic'."\n"; } $_xml_output .= ''.$this->record_detail['edition'].''."\n"; $_xml_output .= ''."\n"; // language $_xml_output .= ''."\n"; $_xml_output .= ''.$this->record_detail['language_id'].''."\n"; $_xml_output .= ''.$this->record_detail['language_name'].''."\n"; $_xml_output .= ''."\n"; // Physical Description/Collation $_xml_output .= ''."\n"; $_xml_output .= '
'.$this->record_detail['gmd_name'].'
'."\n"; $_xml_output .= ''.$this->record_detail['collation'].''."\n"; $_xml_output .= '
'."\n"; // Series title if ($this->record_detail['series_title']) { $_xml_output .= ''."\n"; $_xml_output .= ''."\n"; $_xml_output .= ''.$this->record_detail['series_title'].''."\n"; $_xml_output .= ''."\n"; $_xml_output .= ''."\n"; } // Note $_xml_output .= ''.$this->record_detail['notes'].''."\n"; if ($_title_statement_resp) { $_xml_output .= ''.$_title_statement_resp.''; } // subject/topic $_biblio_topics_q = $this->obj_db->query('SELECT t.topic, t.topic_type, t.auth_list, bt.level FROM mst_topic AS t LEFT JOIN biblio_topic AS bt ON t.topic_id=bt.topic_id WHERE bt.biblio_id='.$this->detail_id.' ORDER BY t.auth_list'); while ($_topic_d = $_biblio_topics_q->fetch_assoc()) { $_subject_type = strtolower($sysconf['subject_type'][$_topic_d['topic_type']]); $_xml_output .= ''; $_xml_output .= '<'.$_subject_type.'>'.$_topic_d['topic'].''; $_xml_output .= ''."\n"; } // classification $_xml_output .= ''.$this->record_detail['classification'].''; // ISBN/ISSN $_xml_output .= ''.str_replace(array('-', ' '), '', $this->record_detail['isbn_issn']).''; // Location and Copies information $_xml_output .= ''."\n"; $_xml_output .= ''.$sysconf['library_name'].' '.$sysconf['library_subname'].''."\n"; $_xml_output .= ''.$this->record_detail['call_number'].''."\n"; $_copy_q = $this->obj_db->query('SELECT i.item_code, i.call_number, stat.item_status_name, loc.location_name, stat.rules, i.site FROM item AS i ' .'LEFT JOIN mst_item_status AS stat ON i.item_status_id=stat.item_status_id ' .'LEFT JOIN mst_location AS loc ON i.location_id=loc.location_id ' .'WHERE i.biblio_id='.$this->detail_id); if ($_copy_q->num_rows > 0) { $_xml_output .= ''."\n"; while ($_copy_d = $_copy_q->fetch_assoc()) { $_xml_output .= ''."\n"; $_xml_output .= ''.$_copy_d['item_code'].''."\n"; $_xml_output .= ''.$_copy_d['location_name'].( $_copy_d['site']?' ('.$_copy_d['site'].')':'' ).''."\n"; $_xml_output .= ''.$_copy_d['call_number'].''."\n"; $_xml_output .= ''."\n"; } $_xml_output .= ''."\n"; } $_xml_output .= ''."\n"; // digital files $attachment_q = $this->obj_db->query('SELECT att.*, f.* FROM biblio_attachment AS att LEFT JOIN files AS f ON att.file_id=f.file_id WHERE att.biblio_id='.$this->detail_id.' AND att.access_type=\'public\' LIMIT 20'); if ($attachment_q->num_rows > 0) { $_xml_output .= ''."\n"; while ($attachment_d = $attachment_q->fetch_assoc()) { // check member type privileges if ($attachment_d['access_limit']) { continue; } $_xml_output .= ''; $_xml_output .= htmlentities($attachment_d['file_title']); $_xml_output .= ''."\n"; } $_xml_output .= ''; } // image if (!empty($this->record_detail['image'])) { $_image = urlencode($this->record_detail['image']); $_xml_output .= ''.htmlentities($_image).''."\n"; } // record info $_xml_output .= ''."\n"; $_xml_output .= ''.$this->detail_id.''."\n"; $_xml_output .= ''.$this->record_detail['input_date'].''."\n"; $_xml_output .= ''.$this->record_detail['last_update'].''."\n"; $_xml_output .= 'machine generated'."\n"; $_xml_output .= ''; $_xml_output .= '
'; return $_xml_output; } /** * Record detail output in MODS (Metadata Object Description Schema) XML mode * @return array * */ public function DublinCoreOutput() { // get global configuration vars array global $sysconf; // convert to htmlentities foreach ($this->record_detail as $_field => $_value) { if (is_string($_value)) { $this->record_detail[$_field] = preg_replace_callback('/&([a-zA-Z][a-zA-Z0-9]+);/S', 'utility::convertXMLentities', htmlspecialchars(trim($_value))); } } // set prefix and suffix $this->detail_prefix = ''; $this->detail_suffix = ''; $_xml_output = ''; // parse title $_title_sub = ''; $_title_statement_resp = ''; if (stripos($this->record_detail['title'], ':') !== false) { $_title_main = trim(substr_replace($this->record_detail['title'], '', stripos($this->record_detail['title'], ':')+1)); $_title_sub = trim(substr_replace($this->record_detail['title'], '', 0, stripos($this->record_detail['title'], ':')+1)); } else if (stripos($this->record_detail['title'], '/') !== false) { $_title_statement_resp = trim(substr_replace($this->record_detail['title'], '', stripos($this->record_detail['title'], '/')+1)); } else { $_title_main = trim($this->record_detail['title']); } $_xml_output .= ''.$_title_main; if ($_title_sub) { $_xml_output .= ' '.$_title_sub; } $_xml_output .= ''."\n"; // get the authors data $_biblio_authors_q = $this->obj_db->query('SELECT a.*,ba.level 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); while ($_auth_d = $_biblio_authors_q->fetch_assoc()) { $_xml_output .= ''."\n"; } $_biblio_authors_q->free_result(); // imprint/publication data $_xml_output .= ''.$this->record_detail['publisher_name'].''."\n"; // date $_xml_output .= ''.$this->record_detail['publish_year'].''."\n"; // edition $_xml_output .= ''.$this->record_detail['edition'].''."\n"; // language $_xml_output .= ''.$this->record_detail['language_name'].''."\n"; // Physical Description/Collation $_xml_output .= ''.$this->record_detail['gmd_name'].''."\n"; $_xml_output .= ''.$this->record_detail['gmd_name'].''."\n"; if ((integer)$this->record_detail['frequency_id'] > 0) { $_xml_output .= 'Serial'."\n"; } $_xml_output .= ''.$this->record_detail['collation'].''."\n"; // Series title if ($this->record_detail['series_title']) { $_xml_output .= ''.$this->record_detail['series_title'].''."\n"; } // Note $_xml_output .= ''.$this->record_detail['notes'].''."\n"; $_xml_output .= ''.$this->record_detail['notes'].''."\n"; // subject/topic $_biblio_topics_q = $this->obj_db->query('SELECT t.topic, t.topic_type, t.auth_list, bt.level FROM mst_topic AS t LEFT JOIN biblio_topic AS bt ON t.topic_id=bt.topic_id WHERE bt.biblio_id='.$this->detail_id.' ORDER BY t.auth_list'); while ($_topic_d = $_biblio_topics_q->fetch_assoc()) { $_xml_output .= ''.$_topic_d['topic'].''."\n"; } // classification $_xml_output .= ''.$this->record_detail['classification'].''; // Permalink $_xml_output .= 'detail_id.']]>'; // ISBN/ISSN $_xml_output .= ''.str_replace(array('-', ' '), '', $this->record_detail['isbn_issn']).''; // Call Number $_xml_output .= ''.$this->record_detail['call_number'].''."\n"; $_copy_q = $this->obj_db->query('SELECT i.item_code, i.call_number, stat.item_status_name, loc.location_name, stat.rules, i.site FROM item AS i ' .'LEFT JOIN mst_item_status AS stat ON i.item_status_id=stat.item_status_id ' .'LEFT JOIN mst_location AS loc ON i.location_id=loc.location_id ' .'WHERE i.biblio_id='.$this->detail_id); if ($_copy_q->num_rows > 0) { while ($_copy_d = $_copy_q->fetch_assoc()) { $_xml_output .= ''.$_copy_d['item_code'].''."\n"; } } // digital files $attachment_q = $this->obj_db->query('SELECT att.*, f.* FROM biblio_attachment AS att LEFT JOIN files AS f ON att.file_id=f.file_id WHERE att.biblio_id='.$this->detail_id.' AND att.access_type=\'public\' LIMIT 20'); if ($attachment_q->num_rows > 0) { while ($attachment_d = $attachment_q->fetch_assoc()) { $_xml_output .= ''."\n"; } } // image if (!empty($this->record_detail['image'])) { $_image = urlencode($this->record_detail['image']); $_xml_output .= ''."\n"; } return $_xml_output; } /** * Get Record detail prefix */ public function getPrefix() { return $this->detail_prefix; } /** * Get Record detail suffix */ public function getSuffix() { return $this->detail_suffix; } }