<?php
/*
 * design/SynchronizeVariable.class.php
 * 
 * CopyRight(C) 2010 Shopformer Development Team. All Right Reserved
 * URL: http://sourceforge.jp/projects/shopformer/
 * 
 * 
 * Mail: m_nakashima@users.sourceforge.jp
 * Auther: Masanori Nakashima
 * Last Update: 2010-06-18
 */
require_once(dirname(dirname(__FILE__))
	.DIRECTORY_SEPARATOR.'content'
	.DIRECTORY_SEPARATOR.'SynchronizeVariable.class.php');
require_once(dirname(__FILE__)
	.DIRECTORY_SEPARATOR.'PackageConfig.class.php');
class design_SynchronizeVariable extends content_SynchronizeVariable {
	function design_SynchronizeVariable() {
	}
	function apply( & $request ) {
		// 利用可能なテンプレートファイルの一覧を取得する
		$templateInfoHash	= array();
		$targetDir			= DIR_PATH_DATA.DIRECTORY_SEPARATOR.'design'.DIRECTORY_SEPARATOR.'template';
		if( is_dir($targetDir) ) {
			if ($dh = opendir($targetDir)) {
				while (($fileName = readdir($dh)) !== false) {
					if( $fileName != '.' && $fileName != '..' ) {
						$absolutePath	= $targetDir.DIRECTORY_SEPARATOR.$fileName;
						if( is_dir($absolutePath) ) {
							$templateObject	= new design_DaoTemplate($fileName);
							$templateObject->loadInfo( $request );
							$templateInfoHash[$fileName]	= $templateObject;
							
						}
					}
				}
				closedir($dh);
			}
		}
		ksort($templateInfoHash);
		foreach( $templateInfoHash as $templateObject ) {
			$templateObject->rebuildAll( $request );
		}
		return true;
	}
}
?>