/** * * create XML for exporting detail information * see xnpExportItem for detail * @see xnpExportItem * * @param export_path folder that export file is written to. * @param fhdl file handle that items are exported to. * @param item_id item id that is exported * @param attachment true if attachment files are exported, else false. * @return true: success * @return false:error */ function xnppresentationExportItem($export_path, $fhdl, $item_id, $attachment) { // get DetailInformation if (!$fhdl) { return false; } $handler =& xoonips_getormhandler('xnppresentation', 'item_detail'); $detail =& $handler->get($item_id); if (!$detail) { return false; } $creators = ''; foreach ($detail->getCreators() as $creator) { $creators .= '<creator>' . $creator->getVar('creator', 's') . '</creator>'; } if (!fwrite($fhdl, "<detail id=\"{$item_id}\" version=\"1.03\">\n" . '<presentation_type>' . $detail->getVar('presentation_type', 's') . "</presentation_type>\n" . "<creators>{$creators}</creators>\n" . '<readme>' . $detail->getVar('readme', 's') . "</readme>\n" . '<rights>' . $detail->getVar('rights', 's') . "</rights>\n" . '<use_cc>' . intval($detail->get('use_cc', 's')) . "</use_cc>\n" . '<cc_commercial_use>' . intval($detail->get('cc_commercial_use')) . "</cc_commercial_use>\n" . '<cc_modification>' . intval($detail->get('cc_modification')) . "</cc_modification>\n" . '<attachment_dl_limit>' . intval($detail->get('attachment_dl_limit')) . "</attachment_dl_limit>\n" . '<attachment_dl_notify>' . intval($detail->get('attachment_dl_notify')) . "</attachment_dl_notify>\n")) { return false; } if (!($attachment ? xnpExportFile($export_path, $fhdl, $item_id) : true)) { return false; } if (!fwrite($fhdl, "</detail>\n")) { return false; } return true; }
/** * create XML for exporting detail information * see xnpExportItem for detail * @see xnpExportItem * * @param export_path folder that export file is written to. * @param fhdl file handle that items are exported to. * @param item_id item id that is exported * @param attachment true if attachment files are exported, else false. * @return true: success * @return false:error */ function xnpbookExportItem($export_path, $fhdl, $item_id, $attachment) { // get DetailInformation if (!$fhdl) { return false; } $handler =& xoonips_getormhandler('xnpbook', 'item_detail'); $detail =& $handler->get($item_id); if (!$detail) { return false; } $authors = ''; foreach ($detail->getAuthors() as $author) { $authors .= '<author>' . $author->getVar('author', 's') . '</author>'; } if (!fwrite($fhdl, "<detail id=\"{$item_id}\" version=\"1.03\">\n" . "<authors>{$authors}</authors>\n" . '<editor>' . $detail->getVar('editor', 's') . "</editor>\n" . '<publisher>' . $detail->getVar('publisher', 's') . "</publisher>\n" . '<isbn>' . $detail->getVar('isbn', 's') . "</isbn>\n" . '<url>' . $detail->getVar('url', 's') . "</url>\n" . '<attachment_dl_limit>' . intval($detail->get('attachment_dl_limit')) . "</attachment_dl_limit>\n" . '<attachment_dl_notify>' . intval($detail->get('attachment_dl_notify')) . "</attachment_dl_notify>\n")) { return false; } if (!($attachment ? xnpExportFile($export_path, $fhdl, $item_id) : true)) { return false; } if (!fwrite($fhdl, "</detail>\n")) { return false; } return true; }
/** * create XML for exporting detail information * see xnpExportItem for detail * @see xnpExportItem * * @param export_path folder that export file is written to. * @param fhdl file handle that items are exported to. * @param item_id item id that is exported * @param attachment true if attachment files are exported, else false. * @return true: success * @return false:error */ function xnpconferenceExportItem($export_path, $fhdl, $item_id, $attachment) { // get DetailInformation if (!$fhdl) { return false; } $handler =& xoonips_getormhandler('xnpconference', 'item_detail'); $detail =& $handler->get($item_id); if (!$detail) { return false; } $authors = ''; foreach ($detail->getAuthors() as $author) { $authors .= '<author>' . $author->getVar('author', 's') . '</author>'; } if (!fwrite($fhdl, "<detail id=\"{$item_id}\" version=\"1.02\">\n" . '<conference_from_year>' . $detail->getVar('conference_from_year', 's') . "</conference_from_year>\n" . '<conference_from_month>' . $detail->getVar('conference_from_month', 's') . "</conference_from_month>\n" . '<conference_from_mday>' . $detail->getVar('conference_from_mday', 's') . "</conference_from_mday>\n" . '<conference_to_year>' . $detail->getVar('conference_to_year', 's') . "</conference_to_year>\n" . '<conference_to_month>' . $detail->getVar('conference_to_month', 's') . "</conference_to_month>\n" . '<conference_to_mday>' . $detail->getVar('conference_to_mday', 's') . "</conference_to_mday>\n" . '<presentation_type>' . $detail->getVar('presentation_type', 's') . "</presentation_type>\n" . '<conference_title>' . $detail->getVar('conference_title', 's') . "</conference_title>\n" . '<place>' . $detail->getVar('place', 's') . "</place>\n" . "<authors>{$authors}</authors>\n" . '<abstract>' . $detail->getVar('abstract', 's') . "</abstract>\n" . '<attachment_dl_limit>' . intval($detail->get('attachment_dl_limit')) . "</attachment_dl_limit>\n" . '<attachment_dl_notify>' . intval($detail->get('attachment_dl_notify')) . "</attachment_dl_notify>\n")) { return false; } if (!($attachment ? xnpExportFile($export_path, $fhdl, $item_id) : true)) { return false; } if (!fwrite($fhdl, "</detail>\n")) { return false; } return true; }
/** * * write item detail information xml form export * * @see xnpExportItem * * @param string $export_path export file path * @param resource $fhdl output file handle * @param int $item_id target item id * @param bool $attachment true if export attachment or image file * @return bool false if failure */ function xnpfilesExportItem($export_path, $fhdl, $item_id, $attachment) { global $xoopsDB; if (!$fhdl) { return false; } // get DetailInformation $result = $xoopsDB->query('select * from ' . $xoopsDB->prefix('xnpfiles_item_detail') . " where files_id={$item_id}"); if (!$result) { return NULL; } $detail = $xoopsDB->fetchArray($result); if (!fwrite($fhdl, "<detail id=\"{$item_id}\">\n" . '<data_file_name>' . htmlspecialchars($detail['data_file_name'], ENT_QUOTES) . "</data_file_name>\n" . '<data_file_mimetype>' . htmlspecialchars($detail['data_file_mimetype'], ENT_QUOTES) . "</data_file_mimetype>\n" . '<data_file_filetype>' . htmlspecialchars($detail['data_file_filetype'], ENT_QUOTES) . "</data_file_filetype>\n")) { return false; } if (!($attachment ? xnpExportFile($export_path, $fhdl, $item_id) : true)) { return false; } if (!fwrite($fhdl, "</detail>\n")) { return false; } return true; }
/** * * create XML for exporting detail information * see xnpExportItem for detail * @see xnpExportItem * * @param export_path folder that export file is written to. * @param fhdl file handle that items are exported to. * @param item_id item id that is exported * @param attachment true if attachment files are exported, else false. * @return true: success * @return false:error */ function xnppaperExportItem($export_path, $fhdl, $item_id, $attachment) { // get DetailInformation if (!$fhdl) { return false; } $handler =& xoonips_getormhandler('xnppaper', 'item_detail'); $detail =& $handler->get($item_id); if (!$detail) { return false; } $authors = ''; foreach ($detail->getAuthors() as $author) { $authors .= '<author>' . $author->getVar('author', 's') . '</author>'; } if (!fwrite($fhdl, "<detail id=\"{$item_id}\" version=\"1.02\">\n" . "<authors>{$authors}</authors>\n" . '<journal>' . $detail->getVar('journal', 's') . "</journal>\n" . '<volume>' . $detail->getVar('volume', 's') . "</volume>\n" . '<number>' . $detail->getVar('number', 's') . "</number>\n" . '<page>' . $detail->getVar('page', 's') . "</page>\n" . '<abstract>' . $detail->getVar('abstract', 's') . "</abstract>\n" . '<pubmed_id>' . $detail->getVar('pubmed_id', 's') . "</pubmed_id>\n")) { return false; } if (!($attachment ? xnpExportFile($export_path, $fhdl, $item_id) : true)) { return false; } if (!fwrite($fhdl, "</detail>\n")) { return false; } return true; }
/** * create XML for exporting detail information * see xnpExportItem for detail * @see xnpExportItem * * @param string $export_path folder that export file is written to. * @param resource $fhdl file handle that items are exported to. * @param int $item_id item id that is exported * @param bool $attachment true if attachment files are exported, else false. * @return bool false if failure */ function xnptoolExportItem($export_path, $fhdl, $item_id, $attachment) { // get detail information if (!$fhdl) { return false; } $handler =& xoonips_getormhandler('xnptool', 'item_detail'); $detail =& $handler->get($item_id); if (!$detail) { return false; } $developers = ''; foreach ($detail->getDevelopers() as $developer) { $developers .= '<developer>' . $developer->getVar('developer', 's') . '</developer>'; } $xml = array(); $xml[] = sprintf('<detail id="%u" version="1.03">', $item_id); $xml[] = sprintf('<tool_type>%s</tool_type>', $detail->getVar('tool_type', 's')); $xml[] = sprintf('<developers>%s</developers>', $developers); $xml[] = sprintf('<readme>%s</readme>', $detail->getVar('readme', 's')); $xml[] = sprintf('<rights>%s</rights>', $detail->getVar('rights', 's')); $xml[] = sprintf('<use_cc>%u</use_cc>', $detail->getVar('use_cc', 's')); $xml[] = sprintf('<cc_commercial_use>%s</cc_commercial_use>', $detail->getVar('cc_commercial_use', 's')); $xml[] = sprintf('<cc_modification>%s</cc_modification>', $detail->getVar('cc_modification', 's')); $xml[] = sprintf('<attachment_dl_limit>%u</attachment_dl_limit>', $detail->getVar('attachment_dl_limit', 's')); $xml[] = sprintf('<attachment_dl_notify>%u</attachment_dl_notify>', $detail->getVar('attachment_dl_notify', 's')); if (!fwrite($fhdl, implode("\n", $xml) . "\n")) { return false; } if (!($attachment ? xnpExportFile($export_path, $fhdl, $item_id) : true)) { return false; } if (!fwrite($fhdl, "</detail>\n")) { return false; } return true; }
/** * * create XML for exporting detail information * see xnpExportItem for detail * @see xnpExportItem * * @param export_path folder that export file is written to. * @param fhdl file handle that items are exported to. * @param item_id item id that is exported * @param attachment true if attachment files are exported, else false. * @return true: success * @return false:error */ function xnpurlExportItem($export_path, $fhdl, $item_id, $attachment) { global $xoopsDB; if (!$fhdl) { return false; } // retrieve detail information $result = $xoopsDB->query('select * from ' . $xoopsDB->prefix('xnpurl_item_detail') . " where url_id={$item_id}"); if (!$result) { return false; } $detail = $xoopsDB->fetchArray($result); if (!fwrite($fhdl, "<detail id=\"{$item_id}\">\n" . '<url>' . htmlspecialchars($detail['url'], ENT_QUOTES) . "</url>\n")) { return false; } if (!($attachment ? xnpExportFile($export_path, $fhdl, $item_id) : true)) { return false; } if (!fwrite($fhdl, "</detail>\n")) { return false; } return true; }