<?php

class Request {

	private static $action;
	private static $method;
	private static $session;
 	private static $className;
	private static $methodName;
	private static $application;	
	private static $data;
	private static $_isModulClass;
	private static $_modulDir;	
		
	function __constructor(){}

	static function setRequest($method, $session, $action, $application, &$data){
	 	
	 	self::$method = urldecode($method);
	 	self::$action = urldecode($action);
	 	self::$session = urldecode($session);
	 
		//Util::writeFile("__session.txt", 	self::$session );
		//Util::writeFile("__method.txt", 	self::$method );
	 	
	 	$delimiter = ":" ;
	 	
	 	
		$aa = explode(".", $action);

		self::$className = $aa[0]; 
		if(substr(self::$className, 0, 2)=="M:"){
			self::$_isModulClass = true;
			self::$className = substr(self::$className, 2);
			$aa2 = explode($delimiter, self::$className);
			self::$_modulDir = $aa2[0]; 
			self::$className = $aa2[1]; 
		 	// moduo class
		}
		self::$methodName = $aa[1];
	
		//Util::writeFile("__mmethodName.txt", 	self::$methodName );
		
		self::$application =  ($method=="GET" ? urldecode($application) : $application);
		
		if($method=="GET"){	
		 	$data =  urldecode($data);
			self::$data = explode(",", $data);
		}else{
		 	self::$data = $data;
		}

		//Util::writeFile("__data.txt", serialize(self::$data) );

	}

	static function isModulClass(){
		return self::$_isModulClass;
	}
	
	static function getModulDir(){
		return self::$_modulDir;
	}
	
	static function getMethod(){
		return self::$method;
	}
	
	static function getSession(){
		return self::$session;
	}
	
	static function getClassName(){
		return self::$className;
	}
	
	static function getMethodName(){
		return self::$methodName;
	}
	
	static function getApplicationName(){
		return self::$application;
	}
	
	static function getData(){
		return self::$data;
	}
	
	static function getRequestObject(){
	 
	 	$reqObj = (object) array();
	 	$reqObj->method = self::$method;
	 	$reqObj->action = self::$action;
	 	$reqObj->application = self::$application;
	 	$reqObj->session = self::$session;
	 	$reqObj->className = self::$className;
	 	$reqObj->methodName = self::$methodName;
	 	$reqObj->data = self::$data;
	 	
		return 	$reqObj;
	}

	 
}