<?php

	

	class Location extends DbObject
	{
		var $_lat;
		var $_long;
		var $_desc;
		var $_id;
		var $_blogId;
		
		function Location( $lat, $long, $blogId, $desc = "", $id = -1 )
		{
			$this->_lat = $lat;
			$this->_long = $long;
			$this->_desc = $desc;
			$this->_id = $id;
			$this->_blogId = $blogId;
						
			$this->_pk = "id";
			$this->_fields = Array(
				"latitude" => "getLatitude",
				"longitude" => "getLongitude",
				"description" => "getDescription",
				"blog_id" => "getBlogId",
				"id" => "getId"
			);
		}
		
		function getId()
		{
			return( $this->_id );
		}
		
		function setId( $id )
		{
			$this->_id = $id;
		}
				
		function getLatitude()
		{
			return( $this->_lat );
		}
		
		function getLongitude()
		{
			return( $this->_long );
		}
		
		function getDescription()
		{
			return( $this->_desc );
		}
		
		function getBlogId()
		{
			return( $this->_blogId );
		}
		
		function setDescription( $desc )
		{
			$this->_desc = $desc;
		}
		
		function setLatitude( $lat )
		{
			$this->_lat = $lat;
		}
		
		function setLongitude( $long )
		{
			$this->_long = $long;
		}
		
		function toXml( $useEnvelope = false )
		{
			$xml = "";
			
			if( $useEnvelope )
				$xml = "<?xml version=\"1.0\"?><dbobject>";
				
			$xml .= "<id>".$this->getId()."</id>";
			$xml .= "<lat>".$this->getLatitude()."</lat>";
			$xml .= "<long>".$this->getLongitude()."</long>";
			$xml .= "<desc><![CDATA[".$this->getDescription()."]]></desc>";
				
			if( $useEnvelope )
				$xml .= "</dbobject>";
				
			return( $xml );			
		}
	}
?>