Source for file location.php

Documentation is available at location.php

  1. <?php
  2. /**
  3. * @package org.routamc.positioning
  4. * @author The Midgard Project, http://www.midgard-project.org
  5. * @version $Id: location.php 3757 2006-07-27 14:32:42Z bergie $
  6. * @copyright The Midgard Project, http://www.midgard-project.org
  7. * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
  8. */
  9.  
  10. /**
  11. * MidCOM wrapper class for access to cached object locations
  12. *
  13. * @package org.routamc.positioning
  14. */
  15. class org_routamc_positioning_location_dba extends __org_routamc_positioning_location_dba
  16. {
  17. function org_routamc_positioning_location_dba($id = null)
  18. {
  19. return parent::__org_routamc_positioning_location_dba($id);
  20. }
  21.  
  22. /**
  23. * Returns the person who reported the position
  24. *
  25. * @return midcom_db_person Parent person
  26. */
  27. function get_parent_guid_uncached()
  28. {
  29. if ( $this->parent
  30. && $this->parentclass)
  31. {
  32. $classname = $this->parentclass;
  33. $parent = new $classname($this->parent);
  34. if (! $parent)
  35. {
  36. debug_push_class(__CLASS__, __FUNCTION__);
  37. debug_add("Could not load {$classname} {$this->parent} from the database, aborting.",
  38. MIDCOM_LOG_INFO);
  39. debug_pop();
  40. return null;
  41. }
  42. return $parent->guid;
  43. }
  44.  
  45. return null;
  46. }
  47.  
  48. /**
  49. * Checks after location cache creation
  50. */
  51. function _on_created()
  52. {
  53. if (!$this->log)
  54. {
  55. // This location entry is stored to object directly without
  56. // corresponding log, create one.
  57. // This situation can happen for example when importing images
  58. // that have EXIF geo tags set
  59. $object = $this->get_parent();
  60. $log = new org_routamc_positioning_log();
  61. $log->date = $this->date;
  62. $log->person = $this->object->creator;
  63. $log->latitude = $this->latitude;
  64. $log->longitude = $this->longitude;
  65. $log->altitude = $this->altitude;
  66. $log->importer = 'objectlocation';
  67. // Usually the positions based on objects are manual, except in
  68. // case of GPS-equipped cameras etc. We still need to figure
  69. // out how to handle those.
  70. $log->accuracy = ORG_ROUTAMC_POSITIONING_ACCURACY_MANUAL;
  71. $log->create();
  72. }
  73. return true;
  74. }
  75. }

Documentation generated on Tue, 15 Aug 2006 12:41:23 +0300 by phpDocumentor 1.3.0RC3