<?php
/*
 * member/upload/Form.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.'system'
.DIRECTORY_SEPARATOR.'login'
.DIRECTORY_SEPARATOR.'ModuleBase.class.php');
require_once( dirname(dirname(__FILE__))
.DIRECTORY_SEPARATOR.'PackageConfig.class.php');
require_once( dirname(dirname(__FILE__))
.DIRECTORY_SEPARATOR.'DaoMember.class.php');
require_once(dirname(dirname(dirname(__FILE__)))
.DIRECTORY_SEPARATOR.'system'
.DIRECTORY_SEPARATOR.'DataFileWriter.class.php');
class member_upload_Form extends system_login_ModuleBase {
	function member_upload_Form(){
		array_push($this->require_module_array,'database2.Connect');
	}
	function execute( & $request ) {
		$dbo 					= $request->getAttribute( 'dbo' );
		$sessionHashName		= 'member.upload.columnSelectedArray';
		$sessionInfoName		= 'member.upload.registInformationHash';
		$registInformationHash	= $request->getSession($sessionInfoName);
		// セッション登録済みのカラム定義を確認
		$columnSelectedArray	= $request->getSession($sessionHashName);
		if( !is_array($columnSelectedArray) ) {
			$columnSelectedArray	= array_keys($GLOBALS['MEMBER_UPLOAD_COLUMN_NAME_DEFINITION']);
		}
		if( !is_array($registInformationHash) ) {
			$registInformationHash	= array(
				'ignoreFirstLine'		=> true,
			);
		} else {
			if( strlen($registInformationHash['temporaryUri']) > 0 ) {
				if( system_DataFileWriter::isExists( $request, $registInformationHash['temporaryUri'], DIR_NAME_TMP ) ) {
					system_DataFileWriter::delete( $request, $registInformationHash['temporaryUri'], DIR_NAME_TMP );
				}
			}
		}
		$request->setAttribute($sessionHashName, $columnSelectedArray);
		$request->setAttribute($sessionInfoName, $registInformationHash );		
	}
}
?>