<?php
// ActionHandler.php


class ActionHandler
{
	var $actions = array();
	
	var $action_dir;
	
	var $context;
	
	/**
	 *
	 * @param $action_directory string
	 * @param $context Context
	 */
	function ActionHandler($action_directory, & $context)
	{
		$this->action_dir = $action_directory;
		$this->context =& $context;
	}
	
	function registerAction( $command,  $action ) 
	{
		$this->actions[$command] = $action;		
	}
	
	
	function execute( $command )
	{
		include_once( $this->action_dir.$this->actions[$command].".php" );
		$action =& new $this->actions[$command];
		return $action->execute(& $this->context);
	}
}

?>