<?php
/*
 * shopping/order/option/LoadList.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(dirname(__FILE__)))
.DIRECTORY_SEPARATOR.'PackageConfig.class.php' );
require_once( dirname(dirname(dirname(dirname(__FILE__))))
.DIRECTORY_SEPARATOR.'util'
.DIRECTORY_SEPARATOR.'File.class.php');
require_once( dirname(dirname(dirname(__FILE__)))
.DIRECTORY_SEPARATOR.'DaoShoppingOrderOption.class.php' );
class shopping_order_option_LoadList extends system_login_ModuleBase {
	function shopping_order_option_LoadList() {
	}
	function execute( & $request ) {
		$searchDataId	= $request->getParam('schdi','get');
		$optionFileUri	= SHOPPING_OPTIONS_FILE_URI;
		if( preg_match('/^[0-9a-zA-Z]+$/',$searchDataId) > 0 ) {
			$optionFileUri	= dirname(SHOPPING_OPTIONS_FILE_URI).'/extoptions/'.$searchDataId;
		}
		// 検索パッケージ連携
		if( strlen(trim($searchDataId)) > 0 ) {
			$dbo		= $request->getAttribute( 'dbo' );
			$searchDataObject	= spider_Controller::createObject('search_DaoSearchData');
			if( $dbo->loadById($searchDataObject,$searchDataId) ) {
			} else {
				$request->addLocaledError('shopping.error.search.notfound',SPIDER_LOG_LEVEL_FATAL,array(''));
			}
		}
		$strings		= system_DataFileWriter::getContents( $request, $optionFileUri );
		$optionHash	= unserialize($strings);
		if( !is_array($optionHash) ) {
			$optionHash	= array();
		}
		foreach( $optionHash as $key => $optionObject ) {
			$optionHash[$key]->option_name	= $optionHash[$key]->optionName;
		}
		$request->setAttribute('shopping.order.option.optionHash',$optionHash);
	}
}
?>