You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
2.2 KiB

  1. <?php
  2. // Project: Web Reference Database (refbase) <http://www.refbase.net>
  3. // Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
  4. // original author(s).
  5. //
  6. // This code is distributed in the hope that it will be useful,
  7. // but WITHOUT ANY WARRANTY. Please see the GNU General Public
  8. // License for more details.
  9. //
  10. // File: ./export/export_atomxml.php
  11. // Repository: $HeadURL$
  12. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  13. //
  14. // Created: 08-Jan-08, 22:00
  15. // Modified: $Date: 2008-04-04 08:12:54 +0000 (Fri, 04 Apr 2008) $
  16. // $Author$
  17. // $Revision: 1026 $
  18. // This exports OpenSearch Atom XML. This file must reside in the 'export' directory of the refbase root directory.
  19. // It uses functions from include files 'opensearch.inc.php' and 'atomxml.inc.php' that require the ActiveLink PHP XML Package,
  20. // which is available under the GPL from: <http://www.active-link.com/software/>
  21. // --------------------------------------------------------------------
  22. // --- BEGIN EXPORT FORMAT ---
  23. // Export found records as OpenSearch Atom XML:
  24. function exportRecords($result, $rowOffset, $showRows, $exportStylesheet, $displayType)
  25. {
  26. global $rowsFound;
  27. if ($rowsFound > 0 && ($rowOffset + 1) > $rowsFound) // Invalid offset for current MySQL result set, error with an appropriate diagnostics response:
  28. {
  29. if ($rowsFound == 1)
  30. $recordString = "record";
  31. else
  32. $recordString = "records";
  33. $recordCollection = openSearchDiagnostics(61, "Record offset " . ($rowOffset + 1) . " is invalid for current result set (" . $rowsFound . " " . $recordString . " found)", $exportStylesheet); // function 'openSearchDiagnostics()' is defined in 'opensearch.inc.php'
  34. }
  35. else // Generate and serve an OpenSearch Atom XML file of ALL records:
  36. {
  37. $recordCollection = atomCollection($result, $rowOffset, $showRows, $exportStylesheet, $displayType); // function 'atomCollection()' is defined in 'atomxml.inc.php'
  38. }
  39. return $recordCollection;
  40. }
  41. // --- END EXPORT FORMAT ---
  42. // --------------------------------------------------------------------
  43. ?>