function xnpbookGetMetadata($prefix, $item_id) { $mydirpath = dirname(dirname(__FILE__)); $mydirname = basename($mydirpath); if (!in_array($prefix, array('oai_dc', 'junii2'))) { return false; } // detail information $detail_handler =& xoonips_getormhandler($mydirname, 'item_detail'); $author_handler =& xoonips_getormhandler($mydirname, 'author'); $detail_obj =& $detail_handler->get($item_id); if (empty($detail_obj)) { return false; } $detail = $detail_obj->getArray(); $criteria = new Criteria('book_id', $item_id); $criteria->setSort('author_order'); $author_objs =& $author_handler->getObjects($criteria); $detail['authors'] = array(); foreach ($author_objs as $author_obj) { $detail['authors'][] = $author_obj->get('author'); } // basic information $basic = xnpGetBasicInformationArray($item_id); $basic['publication_date_iso8601'] = xnpISO8601($basic['publication_year'], $basic['publication_month'], $basic['publication_mday']); // indexes $indexes = array(); if (xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $xids) == RES_OK) { foreach ($xids as $xid) { if (xnp_get_index($_SESSION['XNPSID'], $xid, $index) == RES_OK) { $indexes[] = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid); } } } // files $files = array(); $mimetypes = array(); if ($detail['attachment_dl_limit'] == 0) { $file_handler =& xoonips_gethandler('xoonips', 'file'); $files = $file_handler->getFilesInfo($item_id, 'book_pdf'); foreach ($files as $file) { if (!in_array($file['mime_type'], $mimetypes)) { $mimetypes[] = $file['mime_type']; } } } // related to $related_to_handler =& xoonips_getormhandler('xoonips', 'related_to'); $related_to_ids = $related_to_handler->getChildItemIds($item_id); $related_tos = array(); foreach ($related_to_ids as $related_to_id) { $related_tos[] = array('item_id' => $related_to_id, 'item_url' => XOOPS_URL . '/modules/xoonips/detail.php?item_id=' . $related_to_id); } // repository configs $xconfig_handler =& xoonips_getormhandler('xoonips', 'config'); $myxoopsConfigMetaFooter =& xoonips_get_xoops_configs(XOOPS_CONF_METAFOOTER); $repository = array('download_file_compression' => $xconfig_handler->getValue('download_file_compression'), 'nijc_code' => $xconfig_handler->getValue('repository_nijc_code'), 'publisher' => $xconfig_handler->getValue('repository_publisher'), 'institution' => $xconfig_handler->getValue('repository_institution'), 'meta_author' => $myxoopsConfigMetaFooter['meta_author']); // assign template global $xoopsTpl; $tpl = new XoopsTpl(); $tpl->plugins_dir[] = XOONIPS_PATH . '/class/smarty/plugins'; $tpl->assign($xoopsTpl->get_template_vars()); $tpl->assign('basic', $basic); $tpl->assign('detail', $detail); $tpl->assign('indexes', $indexes); $tpl->assign('files', $files); $tpl->assign('mimetypes', $mimetypes); $tpl->assign('related_tos', $related_tos); $tpl->assign('repository', $repository); $xml = $tpl->fetch('db:' . $mydirname . '_oaipmh_' . $prefix . '.xml'); return $xml; }
function xnpconferenceGetMetadata($prefix, $item_id) { $mydirpath = dirname(dirname(__FILE__)); $mydirname = basename($mydirpath); if (!in_array($prefix, array('oai_dc', 'junii2'))) { return false; } // detail information $detail_handler =& xoonips_getormhandler($mydirname, 'item_detail'); $author_handler =& xoonips_getormhandler($mydirname, 'author'); $detail_obj =& $detail_handler->get($item_id); if (empty($detail_obj)) { return false; } $detail = $detail_obj->getArray(); $criteria = new Criteria('conference_id', $item_id); $criteria->setSort('author_order'); $author_objs =& $author_handler->getObjects($criteria); $detail['authors'] = array(); foreach ($author_objs as $author_obj) { $detail['authors'][] = $author_obj->get('author'); } $detail['conference_from_iso8601'] = xnpISO8601($detail['conference_from_year'], $detail['conference_from_month'], $detail['conference_from_mday']); $detail['conference_to_iso8601'] = xnpISO8601($detail['conference_to_year'], $detail['conference_to_month'], $detail['conference_to_mday']); $types = xnpconferenceGetTypes(); $detail['presentation_type_display'] = $types[$detail['presentation_type']]; // basic information $basic = xnpGetBasicInformationArray($item_id); $basic['publication_date_iso8601'] = xnpISO8601($basic['publication_year'], $basic['publication_month'], $basic['publication_mday']); // indexes $indexes = array(); if (xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $xids) == RES_OK) { foreach ($xids as $xid) { if (xnp_get_index($_SESSION['XNPSID'], $xid, $index) == RES_OK) { $indexes[] = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid); } } } // files $files = array(); $mimetypes = array(); $file_handler =& xoonips_gethandler('xoonips', 'file'); if ($detail['attachment_dl_limit'] == 0) { $files = $file_handler->getFilesInfo($item_id, 'conference_file'); foreach ($files as $file) { if (!in_array($file['mime_type'], $mimetypes)) { $mimetypes[] = $file['mime_type']; } } } // related to $related_to_handler =& xoonips_getormhandler('xoonips', 'related_to'); $related_to_ids = $related_to_handler->getChildItemIds($item_id); $related_tos = array(); foreach ($related_to_ids as $related_to_id) { $related_tos[] = array('item_id' => $related_to_id, 'item_url' => XOOPS_URL . '/modules/xoonips/detail.php?item_id=' . $related_to_id); } // repository configs $xconfig_handler =& xoonips_getormhandler('xoonips', 'config'); $myxoopsConfigMetaFooter =& xoonips_get_xoops_configs(XOOPS_CONF_METAFOOTER); $repository = array('download_file_compression' => $xconfig_handler->getValue('download_file_compression'), 'nijc_code' => $xconfig_handler->getValue('repository_nijc_code'), 'publisher' => $xconfig_handler->getValue('repository_publisher'), 'institution' => $xconfig_handler->getValue('repository_institution'), 'meta_author' => $myxoopsConfigMetaFooter['meta_author']); // conference date if ($detail['conference_from_year'] == $detail['conference_to_year']) { if ($detail['conference_from_month'] == $detail['conference_to_month']) { if ($detail['conference_from_mday'] == $detail['conference_to_mday']) { if ($basic['lang'] == 'jpn') { $fmt = "%1\$d年%2\$d月%3\$d日"; } else { $fmt = '%7$s %3$d, %1$d'; } } else { if ($basic['lang'] == 'jpn') { $fmt = "%1\$d年%2\$d月%3\$d〜%6\$d日"; } else { $fmt = '%7$s %3$d-%6$d, %1$d'; } } } else { if ($basic['lang'] == 'jpn') { $fmt = "%1\$d年%2\$d月%3\$d日〜%5\$d月%6\$d日"; } else { $fmt = '%7$s %3$d-%8$s %6$d, %1$d'; } } } else { if ($basic['lang'] == 'jpn') { $fmt = "%1\$d年%2\$d月%3\$d日〜%4\$d年%5\$d月%6\$d日"; } else { $fmt = '%7$s %3$d %1$d-%8$s %6$d %4$d'; } } $month_str = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec'); $detail['conference_date'] = sprintf($fmt, $detail['conference_from_year'], $detail['conference_from_month'], $detail['conference_from_mday'], $detail['conference_to_year'], $detail['conference_to_month'], $detail['conference_to_mday'], $month_str[$detail['conference_from_month']], $month_str[$detail['conference_to_month']]); if (_CHARSET != 'UTF-8' && ($basic['lang'] = 'jpn')) { $detail['conference_date'] = mb_convert_encoding($detail['conference_date'], _CHARSET, 'UTF-8'); } // assign template global $xoopsTpl; $tpl = new XoopsTpl(); $tpl->plugins_dir[] = XOONIPS_PATH . '/class/smarty/plugins'; $tpl->assign($xoopsTpl->get_template_vars()); $tpl->assign('basic', $basic); $tpl->assign('detail', $detail); $tpl->assign('indexes', $indexes); $tpl->assign('files', $files); $tpl->assign('mimetypes', $mimetypes); $tpl->assign('related_tos', $related_tos); $tpl->assign('repository', $repository); $xml = $tpl->fetch('db:' . $mydirname . '_oaipmh_' . $prefix . '.xml'); return $xml; }
function xnpbinderGetMetadata($prefix, $item_id) { $mydirpath = dirname(dirname(__FILE__)); $mydirname = basename($mydirpath); if (!in_array($prefix, array('oai_dc', 'junii2'))) { return false; } // detail information $detail_handler =& xoonips_getormhandler($mydirname, 'item_detail'); $detail_obj =& $detail_handler->get($item_id); if (empty($detail_obj)) { return false; } $detail = $detail_obj->getArray(); $detail['links'] = xnpbidner_get_child_item_urls($item_id); // basic information $basic = xnpGetBasicInformationArray($item_id); $basic['publication_date_iso8601'] = xnpISO8601($basic['publication_year'], $basic['publication_month'], $basic['publication_mday']); // indexes $indexes = array(); if (xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $xids) == RES_OK) { foreach ($xids as $xid) { if (xnp_get_index($_SESSION['XNPSID'], $xid, $index) == RES_OK) { $indexes[] = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid); } } } // repository configs $xconfig_handler =& xoonips_getormhandler('xoonips', 'config'); $myxoopsConfigMetaFooter =& xoonips_get_xoops_configs(XOOPS_CONF_METAFOOTER); $repository = array('download_file_compression' => $xconfig_handler->getValue('download_file_compression'), 'nijc_code' => $xconfig_handler->getValue('repository_nijc_code'), 'publisher' => $xconfig_handler->getValue('repository_publisher'), 'institution' => $xconfig_handler->getValue('repository_institution'), 'meta_author' => $myxoopsConfigMetaFooter['meta_author']); // assign template global $xoopsTpl; $tpl = new XoopsTpl(); $tpl->plugins_dir[] = XOONIPS_PATH . '/class/smarty/plugins'; $tpl->assign($xoopsTpl->get_template_vars()); $tpl->assign('basic', $basic); $tpl->assign('detail', $detail); $tpl->assign('indexes', $indexes); $tpl->assign('repository', $repository); $xml = $tpl->fetch('db:' . $mydirname . '_oaipmh_' . $prefix . '.xml'); return $xml; }
function xnppaperGetMetadata($prefix, $item_id) { $mydirpath = dirname(dirname(__FILE__)); $mydirname = basename($mydirpath); if (!in_array($prefix, array('oai_dc', 'junii2'))) { return false; } // module config $mhandler =& xoops_gethandler('module'); $chandler =& xoops_gethandler('config'); $module = $mhandler->getByDirname($mydirname); $mconfig = $chandler->getConfigsByCat(false, $module->get('mid')); // detail information $detail_handler =& xoonips_getormhandler($mydirname, 'item_detail'); $author_handler =& xoonips_getormhandler($mydirname, 'author'); $detail_obj =& $detail_handler->get($item_id); if (empty($detail_obj)) { return false; } $detail = $detail_obj->getArray(); $criteria = new Criteria('paper_id', $item_id); $criteria->setSort('author_order'); $author_objs =& $author_handler->getObjects($criteria); $detail['authors'] = array(); foreach ($author_objs as $author_obj) { $detail['authors'][] = $author_obj->get('author'); } $detail['start_page'] = ''; $detail['end_page'] = ''; if (!empty($detail['page'])) { if (preg_match('/^(\\d+)\\s*[- ,_]+\\s*(\\d+)$/', $detail['page'], $matches)) { $detail['start_page'] = intval($matches[1]); $slen = strlen($matches[1]); $elen = strlen($matches[2]); if ($slen <= $elen) { $detail['end_page'] = intval($matches[2]); } else { $detail['end_page'] = intval(substr($matches[1], 0, $slen - $elen) . $matches[2]); } } else { $detail['start_page'] = $detail['end_page'] = intval($detail['page']); } } if ($mconfig['abstract_access_rights'] != 1) { // abstract has no rights to the public $detail['abstract'] = ''; } // basic information $basic = xnpGetBasicInformationArray($item_id); $basic['publication_date_iso8601'] = xnpISO8601($basic['publication_year'], $basic['publication_month'], $basic['publication_mday']); // indexes $indexes = array(); if (xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $xids) == RES_OK) { foreach ($xids as $xid) { if (xnp_get_index($_SESSION['XNPSID'], $xid, $index) == RES_OK) { $indexes[] = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid); } } } // files $files = array(); $mimetypes = array(); $file_handler =& xoonips_gethandler('xoonips', 'file'); if ($mconfig['pdf_access_rights'] == 1) { $files = $file_handler->getFilesInfo($item_id, 'paper_pdf_reprint'); foreach ($files as $file) { if (!in_array($file['mime_type'], $mimetypes)) { $mimetypes[] = $file['mime_type']; } } } // related to $related_to_handler =& xoonips_getormhandler('xoonips', 'related_to'); $related_to_ids = $related_to_handler->getChildItemIds($item_id); $related_tos = array(); foreach ($related_to_ids as $related_to_id) { $related_tos[] = array('item_id' => $related_to_id, 'item_url' => XOOPS_URL . '/modules/xoonips/detail.php?item_id=' . $related_to_id); } // repository configs $xconfig_handler =& xoonips_getormhandler('xoonips', 'config'); $myxoopsConfigMetaFooter =& xoonips_get_xoops_configs(XOOPS_CONF_METAFOOTER); $repository = array('download_file_compression' => $xconfig_handler->getValue('download_file_compression'), 'nijc_code' => $xconfig_handler->getValue('repository_nijc_code'), 'publisher' => $xconfig_handler->getValue('repository_publisher'), 'institution' => $xconfig_handler->getValue('repository_institution'), 'meta_author' => $myxoopsConfigMetaFooter['meta_author']); // assign template global $xoopsTpl; $tpl = new XoopsTpl(); $tpl->plugins_dir[] = XOONIPS_PATH . '/class/smarty/plugins'; $tpl->assign($xoopsTpl->get_template_vars()); $tpl->assign('basic', $basic); $tpl->assign('detail', $detail); $tpl->assign('indexes', $indexes); $tpl->assign('files', $files); $tpl->assign('mimetypes', $mimetypes); $tpl->assign('related_tos', $related_tos); $tpl->assign('repository', $repository); $xml = $tpl->fetch('db:' . $mydirname . '_oaipmh_' . $prefix . '.xml'); return $xml; }
function xnpGetBasicInformationMetadata($metadataPrefix, $item_id) { $textutil =& xoonips_getutility('text'); $xconfig_handler =& xoonips_getormhandler('xoonips', 'config'); $myxoopsConfigMetaFooter =& xoonips_get_xoops_configs(XOOPS_CONF_METAFOOTER); $basic = array(); xnp_get_item($_SESSION['XNPSID'], $item_id, $basic); $tmparray = array(); if (xnp_get_item_types($tmparray) == RES_OK) { foreach ($tmparray as $i) { if ($i['item_type_id'] == $basic['item_type_id']) { $itemtype = $i; break; } } } $nijc_code = $xconfig_handler->getValue('repository_nijc_code'); if ($basic['doi'] == "") { $identifier = $nijc_code . '/' . $basic['item_type_id'] . '.' . $basic['item_id']; } else { $identifier = $nijc_code . ':' . XNP_CONFIG_DOI_FIELD_PARAM_NAME . '/' . $basic['doi']; } if ($metadataPrefix == 'junii' || $metadataPrefix == 'junii2') { $lines = array(); $publisher = $xconfig_handler->getValue('repository_publisher'); $institution = $xconfig_handler->getValue('repository_institution'); $meta_author = $myxoopsConfigMetaFooter['meta_author']; if (strcasecmp($publisher, 'meta_author') == 0) { $publisher = $meta_author; } else { if (strcasecmp($publisher, 'creator') == 0) { $publisher = _MD_XOONIPS_ITEM_CONTRIBUTOR_LABEL; } else { if (strcasecmp($publisher, 'none') == 0) { $publisher = null; } } } if (strcasecmp($institution, 'meta_author') == 0) { $institution = $meta_author; } else { if (strcasecmp($institution, 'creator') == 0) { $institution = _MD_XOONIPS_ITEM_CONTRIBUTOR_LABEL; } else { if (strcasecmp($institution, 'none') == 0) { $institution = null; } } } $lines[] = "<title>" . $textutil->xml_special_chars(reset($basic['titles'])) . "</title>"; while (next($basic['titles'])) { $lines[] = "<title>" . $textutil->xml_special_chars(current($basic['titles'])) . "</title>"; } $lines[] = "<identifier>" . $textutil->xml_special_chars($identifier) . "</identifier>"; $lines[] = "<identifier xsi:type=\"URL\">" . $textutil->xml_special_chars(xnpGetItemDetailURL($basic['item_id'], $basic['doi'])) . "</identifier>"; $lines[] = "<type>itemType:" . $textutil->xml_special_chars($itemtype['name']) . "</type>"; $lines[] = "<language xsi:type=\"ISO639-2\">" . $textutil->xml_special_chars($basic['lang']) . "</language>"; if ($institution != null) { $lines[] = "<institution>" . $textutil->xml_special_chars($institution) . "</institution>"; } if ($publisher != null) { $lines[] = "<publisher>" . $textutil->xml_special_chars($publisher) . "</publisher>"; } $subject = array(); $index_ids = array(); $res = xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $index_ids); if ($res == RES_OK) { foreach ($index_ids as $xid) { if ($xid > 0) { $index = array(); $result = xnp_get_index($_SESSION['XNPSID'], $xid, $index); if ($result == 0) { $str = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid); $subject[] = "{$str}"; } } } } if (!empty($basic['keywords'])) { $subject = array_merge($subject, $basic['keywords']); } $lines[] = "<subject>" . $textutil->xml_special_chars(implode(', ', $subject)) . "</subject>"; $lines[] = "<description>comment:" . $textutil->xml_special_chars($basic['description']) . "</description>"; return implode("\n", $lines); } else { if ($metadataPrefix == 'oai_dc') { /* title, identifier, type, language, subject, description */ $lines = array(); $publisher = $xconfig_handler->getValue('repository_publisher'); $meta_author = $myxoopsConfigMetaFooter['meta_author']; if (strcasecmp($publisher, 'meta_author') == 0) { $publisher = $meta_author; } else { if (strcasecmp($publisher, 'creator') == 0) { $publisher = _MD_XOONIPS_ITEM_CONTRIBUTOR_LABEL; } else { if (strcasecmp($publisher, 'none') == 0) { $publisher = null; } } } $lines[] = "<dc:title>" . $textutil->xml_special_chars($basic['title']) . "</dc:title>"; $lines[] = "<dc:identifier>" . $textutil->xml_special_chars($identifier) . "</dc:identifier>"; $lines[] = "<dc:identifier>" . $textutil->xml_special_chars(xnpGetItemDetailURL($basic['item_id'], $basic['doi'])) . "</dc:identifier>"; $lines[] = "<dc:type>itemType:" . $textutil->xml_special_chars($itemtype['name']) . "</dc:type>"; $lines[] = "<dc:language>" . $textutil->xml_special_chars($basic['lang']) . "</dc:language>"; if ($publisher != null) { $lines[] = "<dc:publisher>" . $textutil->xml_special_chars($publisher) . "</dc:publisher>"; } $subject = array(); $index_ids = array(); $res = xnp_get_index_id_by_item_id($_SESSION['XNPSID'], $item_id, $index_ids); if ($res == RES_OK) { foreach ($index_ids as $xid) { if ($xid > 0) { $index = array(); $result = xnp_get_index($_SESSION['XNPSID'], $xid, $index); if ($result == 0) { $str = xnpGetIndexPathServerString($_SESSION['XNPSID'], $xid); $subject[] = "{$str}"; } } } } if (!empty($basic['keywords'])) { $subject = array_merge($subject, $basic['keywords']); } foreach ($subject as $str) { $lines[] = "<dc:subject>" . $textutil->xml_special_chars($str) . "</dc:subject>"; } $lines[] = "<dc:description>comment:" . $textutil->xml_special_chars($basic['description']) . "</dc:description>"; return implode("\n", $lines) . "\n"; } } return false; }