<?php

	
	
		
			
		

	class LocationDisplay extends BlogAction
	{
		function LocationDisplay( $actionInfo, $request )
		{
			$this->BlogAction( $actionInfo, $request );
			
			$this->registerFieldValidator( "locId", new IntegerValidator());
			$view = new ErrorView( $this->_blogInfo, $this->_locale->tr("incorrect_location_id" ));
			$this->setValidationErrorView( $view );
		}
		
		function perform()
		{
			$locId = $this->_request->getValue( "locId" );
			
			$locs = new Locations();
			$location = $locs->getLocation( $locId );
			if( !$location ) {
				$this->_view = new ErrorView( $this->_blogInfo, $this->_locale->tr("incorrect_location_id" ));
				$this->setCommonData();
				return( false );
			}
			
			$this->_view = new LocationView( $this->_blogInfo, Array( "location" => $location->getId()));
			$this->_view->setLocation( $location );
			$this->_view->setValue( "url", $this->_blogInfo->getBlogRequestGenerator());			
			$this->setCommonData();
			
			return( true );
		}
		
		function performAjax()
		{
			return( $this->perform());
		}
	}
?>