amdaintegration_autoload.php 2.19 KB
<?php
//autoload configuration

$autoload_cache = array();

$autoload_dirs = array(
	'InputOutput',
	'InputOutput/IHMImpl',
	'InputOutput/IHMImpl/Config',
	'InputOutput/IHMImpl/Params',
	'InputOutput/IHMImpl/Params/DataMiningImpl',
	'InputOutput/IHMImpl/Params/StatisticsImpl',
	'InputOutput/IHMImpl/Params/DownloadImpl',
	'InputOutput/IHMImpl/Params/PlotImpl',
	'InputOutput/IHMImpl/Params/GeneratorImpl',
	'InputOutput/IHMImpl/Params/GenInfoParamImpl',
	'InputOutput/IHMImpl/Process',
	'InputOutput/IHMImpl/ParamInfo',
	'InputOutput/IHMImpl/Tools',
	'InputOutput/IHMImpl/TimeTables',
	'InputOutput/TestImpl',
	'InputOutput/WSImpl',
	'InputOutput/WSImpl/Config',
	'InputOutput/WSImpl/Process',
	'InputOutput/WSImpl/Params/DownloadImpl',
	'InputOutput/WSImpl/Params/PlotImpl',
	'InputOutput/WSImpl/Tools',
	'InputOutput/WSImpl/TimeTables',
	'InputOutput/SharedObjectsUpdater',
	'InputOutput/SharedObjectsUpdater/TimeTables',
	'Request',
	'Request/Config',
	'Request/ParamsRequestImpl',
	'Request/ParamsRequestImpl/Nodes',
	'Request/ParamsRequestImpl/Nodes/Infos',
	'Request/ParamsRequestImpl/Nodes/Params',
	'Request/ParamsRequestImpl/Nodes/Requests',
	'Request/ProcessRequestImpl',
	'Request/ProcessRequestImpl/Process',
	'Request/TTRequestImpl',
	'Request/ParserRequestImpl',
);

$autoload_ihm_dirs = array(
	IHM_SRC_DIR.'/php/classes',
	IHM_SRC_DIR.'/php/RemoteDataCenter',
	IHM_SRC_DIR.'/php/WebServices',
	IHM_SRC_DIR.'/php/WebServices/Client'
);

function amdaintegration_autoload($class_name)
{
	global $autoload_cache, $autoload_dirs, $autoload_ihm_dirs;

	if (isset($autoload_cache[$class_name])) {
		require $autoload_cache[$class_name];
		return;
	}

	$file = __DIR__.'/'.$class_name.'.php';
	
	if (file_exists($file))
	{
		require $file;
		$autoload_cache[$class_name] = $file;
		return;	
	}
		
	foreach($autoload_dirs as $dir)
	{
		$file = __DIR__.'/'.$dir.'/'.$class_name.'.php';
		if (file_exists($file))
		{
			require $file;
			$autoload_cache[$class_name] = $file;
			return;
		}
	}
	
	foreach($autoload_ihm_dirs as $dir)
	{
		$file = $dir.'/'.$class_name.'.php';
		if (file_exists($file))
		{
			require $file;
			$autoload_cache[$class_name] = $file;
			break;
		}
	}
}

spl_autoload_register('amdaintegration_autoload');

?>