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 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 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; }