class_mcPUIX_CONFIG.inc.php 1.65 KB
<?php
class mcPUIX_CONFIG {
//'KINDOF'	=> 'DATASET',
	protected static $Tables = array();

	public static function setTableConfig($param_tablename, array $param_TableValues) {
		mcPUIX_CONFIG::$Tables[$param_tablename] = $param_TableValues;
	}
	
	/**
	 *	return the table config
	 * 
	 * @param string $param_tablename
	 * @param array $param_ManipulateTableConfig
	 * @return array( mcPUIX::DBUIArray => array( mcPUIX::DBUIConfig => array( $param_tablename => array()) ) ) || FALSE
	 */
	public static function getTableConfig($param_tablename, array $param_ManipulateTableConfig=null) {
		if(array_key_exists($param_tablename, mcPUIX_CONFIG::$Tables) && is_array(mcPUIX_CONFIG::$Tables[$param_tablename])) {
			$Config = mcPUIX_CONFIG::$Tables[$param_tablename];
			if(is_array($param_ManipulateTableConfig)) {
				
				if(!array_key_exists('TABLE', $Config) || !is_array($Config['TABLE'])) {
					$Config['TABLE'] = array();
				}
				foreach($param_ManipulateTableConfig as $key => $value) {
					$Config['TABLE'][$key] = $value;
				}
			} 
			
			$result = array(
				mcPUIX::DBUIArray => array( mcPUIX::DBUIConfig => array( $param_tablename => $Config) )
			);
			
			return $result;
			
		} else {
			return false;
		}

	}

	public static function getReferenceTableName($param_tablename) {
		if(mcArray::checkKeyHasFullArray(mcPUIX_CONFIG::$Tables[$param_tablename], 'TABLE', 'LIST_TABLE')) {
			if(mcPUIX_CONFIG::$Tables[$param_tablename]['TABLE']['LIST_TABLE']['TABLENAME']) {
				$Tablename_LIST = mcPUIX_CONFIG::$Tables[$param_tablename]['TABLE']['LIST_TABLE']['TABLENAME'];		
			} else {
				return false;
			}
			
		} else {
			return false;
		}
		return $Tablename_LIST;
	}
	
}
?>