function exportRecords($result, $rowOffset, $showRows, $exportStylesheet, $displayType) { // Generate and serve a MODS XML file of ALL records: $recordCollection = modsCollection($result); // function 'modsCollection()' is defined in 'modsxml.inc.php' return $recordCollection; }
function exportBibutils($result, $program) { global $contentTypeCharset; // these variables are defined in 'ini.inc.php' global $convertExportDataToUTF8; // Get the absolute path for the bibutils package: // (function 'getExternalUtilityPath()' is defined in 'include.inc.php') $bibutilsPath = getExternalUtilityPath("bibutils"); // Generate and serve a MODS XML file of ALL records: // (function 'modsCollection()' is defined in 'modsxml.inc.php') $recordCollection = modsCollection($result); // Write the MODS XML data to a temporary file: $tempFile = writeToTempFile($recordCollection); // Set input and output encoding: if ($convertExportDataToUTF8 == "no" and $contentTypeCharset != "UTF-8") { $inputEncodingArg = " -i iso8859_1"; $outputEncodingArg = " -o iso8859_1"; } else { $inputEncodingArg = " -i utf8"; $outputEncodingArg = " -o utf8"; } // Pass this temp file to the bibutils utility for conversion: $outputFile = convertBibutils($bibutilsPath, $tempFile, $program, $inputEncodingArg, $outputEncodingArg); unlink($tempFile); // Read the resulting output file and return the converted data: $resultString = readFromFile($outputFile); unlink($outputFile); return $resultString; }