<?php

	namespace Mocha\UI\Pages;
	
	use Mocha\Core\InstanceKey;
	use Phast\RenderingEventArgs;
	use Phast\System;
	use Phast\WebPage;

	class SearchPage extends WebPage
	{
		protected function OnRendering(RenderingEventArgs $re)
		{
			$query = $_GET["q"];
			
			$inst = null;
			if (InstanceKey::TryParse($query, $inst))
			{
				System::Redirect("~/d/inst/1\$" . $inst->ClassIndex . "/" . $inst->__toString() . ".htmld");
			}
		}

		protected function RenderContents()
		{
			?>
			<h1>Search Results</h1>
			<?php
		}
	}

?>