/////////////////////////////////////////////////////////////////
//Copyright (C) 2005 NTT CORPORATION.
//
//	X}[gtH[Xރ^Cg|[giwK҈ꗗjʕ\ActionNX
//
//		ύX
//			2005.02.16  VK쐬   ΍茫Y
//
//	@\
//
//	X}[gtH[Xރ^Cg|[giwK҈ꗗjʕ\ActionNXłB
//
/////////////////////////////////////////////////////////////////
package jp.co.ntt.lms.xmf.actions.lo.SmartForce;

import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jp.co.ntt.lms.lo.SmartForce.CourseUnitLogRecord;
import jp.co.ntt.lms.lo.SmartForce.SmartForceLoEnv;
import jp.co.ntt.lms.xmf.common.CommonFunction;
import jp.co.ntt.lms.xmo.Environment;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * X}[gtH[Xރ^Cg|[giwK҈ꗗjʕ\ActionNXłB
 * 
 * @author Kentaro Ishizaki (UNITEC)
 * @version 1.0
 */
public class SmartForceMatRep_LearnerListAction extends Action
{
	/**
	 * bZ[W萔B
	 */
	private static final String MSG_ENV_ERR = "ݒG[܂B";
	/**
	 * ʁipXj萔B
	 */
	private final String STR_LIST_PASS = "PASS";
	/**
	 * ʁisj萔B
	 */
	private final String STR_LIST_FAIL = "FAIL";

	/**
	 * strutst[[NĂ΂郁\bhłB
	 * 
	 * @param mapping }bsOIuWFNgB
	 * @param form ANVtH[IuWFNgB
	 * @param request NGXgIuWFNgB
	 * @param response X|XIuWFNgB
	 * @return ActionForward ANVtH[hIuWFNgB
	 * @throws Exception
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		// LbV
		response.setHeader("cache-control", "no-cache");
		
		//-------------------------------------------------------------------------
		//ϐ`
		//-------------------------------------------------------------------------
		//[UID(rp)
		String strStudentID = "";
		//Unit̃^Cg\E\̔tO(true	:\,false	:\ĂȂ)
		boolean blDispUnitTitleFlg = false;

		//ϓ_Zop
		int intUserCount = 0;					//wKҐ̍v
		Integer intWk;							//ώZopWork
		int intTotalAccessCount 	= 0;		//ANZX񐔂̍v
		int intTotalProgressRate 	= 0;		//ϐi̍v
		int intTotalTestCount 		= 0;		//eXg񐔂̍v
		int intTotalAverageScore 	= 0;		//ϓ_̍v
		int intTotalHighestScore 	= 0;		//ō_̍v

		int intAllUserAccessCountAve 	= 0;	//SwK҂̃ANZX񐔂̕
		int intAllUserProgressRateAve 	= 0;	//SwK҂̕ϐi̕
		int intAllUserTestCountAve 		= 0;	//SwK҂̃eXg񐔂̕
		int intAllUserAverageScoreAve 	= 0;	//SwK҂̕ϓ_̕
		int intAllUserHighestScoreAve 	= 0;	//SwK҂̍ō_̕

		String strComplete 	= "";		//wKI\p
		String strPass 		= "";		//eXgە\p
		String strUnitPass 	= "";		//jbgە\p

		//-------------------------------------------------------------------------
		// wK҈ꗗ̎擾()
		// objRecord̊eڂ̃f[^́ASCommonFunction.encodeSJIS()ŃGR[hsB
		//-------------------------------------------------------------------------
		CourseUnitLogRecord[] objRecord = (CourseUnitLogRecord[])request.getAttribute("RECORD_LIST");
		if (objRecord.length == 0)
		{
			// ***************************
			// NGXgɕϐZbg邱
			return mapping.findForward("success");
		}
		

		Object[][] arrayRecord = new Object[objRecord.length][8];
		final int RECORD_OUTPUT_TITLE_NO_UNIT = 0;
		final int RECORD_OUTPUT_TITLE_UNIT = 1;
		final int RECORD_OUTPUT_ENDTAG = 2;
		final int RECORD_USER_ID = 3;
		final int RECORD_ACCESS_COUNT = 4;
		final int RECORD_PROGRESS_RATE = 5;
		final int RECORD_TEST_COUNT = 6;
		
		final int USER_ID = 0;
		final int USER_ACCESS_COUNT = 1;
		final int USER_PROGRESS_RATE = 2;
		final int USER_COMPLETE = 3;
		final int USER_PASS = 4;
		final int USER_AVERAGE_SCORE = 5;
		final int USER_HIGHEST_SCORE = 6;
		final int USER_UNIT_COUNT = 7;
		
		final int UNIT_NAME = 0;
		final int UNIT_ACCESS_COUNT = 1;
		final int UNIT_PROGRESS = 2;
		final int UNIT_TEST_COUNT = 3;
		final int UNIT_COMPLETE = 4;
		final int UNIT_PASS = 5;
		final int UNIT_AVERAGE_SCORE = 6;
		final int UNIT_HIGHEST_SCORE = 7;
		
		Vector vecUser = new Vector();
		
		//-------------------------------------------------------------------------
		//SwK҂̈ꗗ\
		//-------------------------------------------------------------------------
		//t@CDBʏ擾̂EnvironmentNX𐶐
		Environment objEnv = new Environment();
		SmartForceLoEnv objSFEnv = new SmartForceLoEnv();
		String lsDBEnv = objSFEnv.getDBType();
		if(lsDBEnv == null || lsDBEnv.trim().equals("")) {
			lsDBEnv = objEnv.getDBType();
		}
		int i = 0;
		for (i = 0; i < objRecord.length; i++) 
		{
			// [UIDςwK҂̃f[^ǉ
			if (!strStudentID.equalsIgnoreCase(objRecord[i].getStudentID()))
			{
				Object[] arrayUserInfo = new Object[3];
				// [U[ID
				arrayUserInfo[USER_ID] = objRecord[i].getUserID();
				// ANZX
				arrayUserInfo[USER_ACCESS_COUNT] = objRecord[i].getAccessCount();
				// i
				arrayUserInfo[USER_PROGRESS_RATE] = objRecord[i].getProgressRate();
				// wKI
				arrayUserInfo[USER_COMPLETE] = objRecord[i].getCompleteFlag();
				//eXg
				arrayUserInfo[USER_PASS] = objRecord[i].getPassFlag();
				// ϓ_
				arrayUserInfo[USER_AVERAGE_SCORE] = objRecord[i].getAverageScore();
				// ō_
				arrayUserInfo[USER_HIGHEST_SCORE] = objRecord[i].getHighestScore();
				// jbg
				arrayUserInfo[USER_UNIT_COUNT] = objRecord[i].getUnitCount();
				
				vecUser.add(arrayUserInfo);
				
				// (1R[h)͏Ȃ
				if (!strStudentID.equals(""))
				{
					//-------------------------------------------------------------
					//wKҐJEg
					//-------------------------------------------------------------
					intUserCount += 1;

					// jbg݂ꍇvɉZ
					if (!objRecord[i].getUnitCount().equals("0"))
					{
						//-------------------------------------------------------------
						//eڂ̍viPFString^̐lIntegerփZbg,QFInteger^int^֕ϊj
						//-------------------------------------------------------------
						//ANZX񐔂̍v
						intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[i].getAccessCount()/*)*/);
						intTotalAccessCount += intWk.intValue();

						//ϐi̍v
						intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[i].getProgressRate()/*)*/);
						intTotalProgressRate += intWk.intValue();
						//eXg񐔂̍v
						intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[i].getTestCount()/*)*/);
						intTotalTestCount += intWk.intValue();
						//ϓ_̍v
						intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[i].getAverageScore()/*)*/);
						intTotalAverageScore += intWk.intValue();
						//ō_̍v
						intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[i].getHighestScore()/*)*/);
						intTotalHighestScore += intWk.intValue();
					}
				}
			}
			//-------------------------------------------------------------
			//jbgL`FbN
			//-------------------------------------------------------------
			//jbgJEg0̏ꍇ́AuN\
			if (!/*CommonFunction.encodeSJIS(*/objRecord[i].getUnitCount()/*)*/.equals("0"))
			{
				//-------------------------------------------------------------
				//jbgۂ̃tOɑΉ֕ϊ
				//-------------------------------------------------------------
				//jbg
				if (/*CommonFunction.encodeSJIS(*/objRecord[i].getUnitPassFlag()/*)*/.equals("0"))
				{
					//"PASS"Zbg
					strUnitPass = STR_LIST_FAIL;
				}
				else
				{
					//"FAIL"Zbg
					strUnitPass = STR_LIST_PASS;
				}
				String strTemp = "";
				try {
					//DBʏ "0" ̎@MS SQLServer
					//DBʏ "1" ̎@Oracle
					if ( lsDBEnv.equals(Environment.DB_SQLSERVER) ) {
						strTemp = /*CommonFunction.encodeSJIS(*/objRecord[i].getUnitName()/*)*/;
					}
					else {
						strTemp = objRecord[i].getUnitName();
					}
				}
				catch( Exception e ) {
					e.printStackTrace();
					request.setAttribute("message", MSG_ENV_ERR);
					request.setAttribute("detail", "");
					request.setAttribute("close", "on");
					request.setAttribute("errorurl", "");
					return mapping.findForward("error");
				}
				
				arrayRecord[i][UNIT_NAME] = strTemp;
				arrayRecord[i][UNIT_ACCESS_COUNT] = objRecord[i].getUnitAccessCount();
				arrayRecord[i][UNIT_PROGRESS] = objRecord[i].getUnitProgress();
				arrayRecord[i][UNIT_TEST_COUNT] = objRecord[i].getUnitTestCount();
				arrayRecord[i][UNIT_AVERAGE_SCORE] = objRecord[i].getUnitAverageScore();
				arrayRecord[i][UNIT_HIGHEST_SCORE] = objRecord[i].getUnitHighestScore();
				arrayRecord[i][UNIT_PASS] = strUnitPass;
			}

			//---------------------------------------------------------------------
			//rp̕ϐɃ[UIDi[
			//---------------------------------------------------------------------
			strStudentID = /*CommonFunction.encodeSJIS(*/objRecord[i].getStudentID()/*)*/;
		}

		//---------------------------------------------------------------------
		//wKҐJEg
		//---------------------------------------------------------------------
		intUserCount += 1;

		//---------------------------------------------------------------------
		//eڂ̍viPFString^̐lIntegerփZbg,QFInteger^int^֕ϊj
		//zINDEXi-1ƂĂ̂́ALoopoゾi̒lAobjRecord.length + 1
		//ȂACfbNX͈̔̓G[ƂȂĂ܂߁A邽߂̈ӖB
		//---------------------------------------------------------------------
		//ANZX񐔂̍v
		intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[objRecord.length-1].getAccessCount()/*)*/);
		intTotalAccessCount += intWk.intValue();
		//ϐi̍v
		intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[objRecord.length-1].getProgressRate()/*)*/);
		intTotalProgressRate += intWk.intValue();
		//eXg񐔂̍v
		intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[objRecord.length-1].getTestCount()/*)*/);
		intTotalTestCount += intWk.intValue();
		//ϓ_̍v
		intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[objRecord.length-1].getAverageScore()/*)*/);
		intTotalAverageScore += intWk.intValue();
		//ō_̍v
		intWk = new Integer(/*CommonFunction.encodeSJIS(*/objRecord[objRecord.length-1].getHighestScore()/*)*/);
		intTotalHighestScore += intWk.intValue();


		//-------------------------------------------------------------
		//e^Cgڂ̕ϒl̎Zo
		//-------------------------------------------------------------
		//SwK҂̃ANZX񐔂̕
		intAllUserAccessCountAve 	= intTotalAccessCount / intUserCount;
		//SwK҂̕ϐi̕
		intAllUserProgressRateAve 	= intTotalProgressRate / intUserCount;
		//SwK҂̃eXg񐔂̕
		intAllUserTestCountAve 		= intTotalTestCount / intUserCount;
		//SwK҂̕ϓ_̕
		intAllUserAverageScoreAve 	= intTotalAverageScore / intUserCount;
		//SwK҂̍ō_̕
		intAllUserHighestScoreAve 	= intTotalHighestScore / intUserCount;

		return mapping.findForward("success");
	}
}
/*
// LbV
response.setHeader("cache-control", "no-cache");

//-------------------------------------------------------------------------
//ϐ`
//-------------------------------------------------------------------------
//[UID(rp)
String strStudentID = "";
//Unit̃^Cg\E\̔tO(true	:\,false	:\ĂȂ)
boolean blDispUnitTitleFlg = false;

//ϓ_Zop
int intUserCount = 0;					//wKҐ̍v
Integer intWk;							//ώZopWork
int intTotalAccessCount 	= 0;		//ANZX񐔂̍v
int intTotalProgressRate 	= 0;		//ϐi̍v
int intTotalTestCount 		= 0;		//eXg񐔂̍v
int intTotalAverageScore 	= 0;		//ϓ_̍v
int intTotalHighestScore 	= 0;		//ō_̍v

int intAllUserAccessCountAve 	= 0;	//SwK҂̃ANZX񐔂̕
int intAllUserProgressRateAve 	= 0;	//SwK҂̕ϐi̕
int intAllUserTestCountAve 		= 0;	//SwK҂̃eXg񐔂̕
int intAllUserAverageScoreAve 	= 0;	//SwK҂̕ϓ_̕
int intAllUserHighestScoreAve 	= 0;	//SwK҂̍ō_̕

String strComplete 	= "";		//wKI\p
String strPass 		= "";		//eXgە\p
String strUnitPass 	= "";		//jbgە\p

//-------------------------------------------------------------------------
// wK҈ꗗ̎擾()
// objRecord̊eڂ̃f[^́ASCommonFunction.encodeSJIS()ŃGR[hsB
//-------------------------------------------------------------------------
CourseUnitLogRecord[] objRecord = (CourseUnitLogRecord[])request.getAttribute("RECORD_LIST");
if (objRecord.length == 0)
{
	// ***************************
	// NGXgɕϐZbg邱
	return mapping.findForward("success");
}


Object[][] arrayRecord = new Object[objRecord.length][8];
final int RECORD_OUTPUT_TITLE_NO_UNIT = 0;
final int RECORD_OUTPUT_TITLE_UNIT = 1;
final int RECORD_OUTPUT_ENDTAG = 2;
final int RECORD_USER_ID = 3;
final int RECORD_ACCESS_COUNT = 4;
final int RECORD_PROGRESS_RATE = 5;
final int RECORD_TEST_COUNT = 6;

Vector vecUser = new Vector();

//-------------------------------------------------------------------------
//SwK҂̈ꗗ\
//-------------------------------------------------------------------------
//t@CDBʏ擾̂EnvironmentNX𐶐
Environment objEnv = new Environment();
SmartForceLoEnv objSFEnv = new SmartForceLoEnv();
String lsDBEnv = objSFEnv.getDBType();
if(lsDBEnv == null || lsDBEnv.trim().equals("")) {
	lsDBEnv = objEnv.getDBType();
}
int i = 0;
for(i = 0; i < objRecord.length; i++) 
{
	//---------------------------------------------------------------------
	//e^Cgڂ̕\
	//---------------------------------------------------------------------
	// [UIDς玟̍siwKҁj̃f[^\
	if( ! strStudentID.equalsIgnoreCase(CommonFunction.encodeSJIS(objRecord[i].getStudentID())) )
	{
		Object[] arrayUserInfo = new Object[3];
		// [U[ID
		arrayUserInfo[USER_ID] = objRecord[i].getUserID();
		// ANZX
		arrayUserInfo[USER_ACCESS_COUNT] = objRecord[i].getAccessCount();
		// i
		arrayUserInfo[USER_PROGRESS_RATE] = objRecord[i].getProgressRate();
		// wKI
		if (CommonFunction.encodeSJIS(objRecord[i].getCompleteFlag()).equals("0"))
		{
			//""Zbg
			strComplete = STR_LIST_INCOMPLETE;
		}
		else
		{
			//"COMPLETE"Zbg
			strComplete = STR_LIST_COMPLETE;
		}
		arrayUserInfo[USER_COMPLETE] = strComplete;
		//eXg
		if (CommonFunction.encodeSJIS(objRecord[i].getPassFlag()).equals("0"))
		{
			//"PASS"Zbg
			strPass = STR_LIST_FAIL;
		}
		else
		{
			//"FAIL"Zbg
			strPass = STR_LIST_PASS;
		}
		arrayUserInfo[USER_PASS] = strPass;
		// ϓ_
		arrayUserInfo[USER_AVERAGE_SCORE] = objRecord[i].getAverageScore();
		// ō_
		arrayUserInfo[USER_HIGHEST_SCORE] = objRecord[i].getHighestScore();
		// jbg
		arrayUserInfo[USER_UNIT_COUNT] = objRecord[i].getUnitCount();
		
		vecUser.add(arrayUserInfo);
		
		
		arrayRecord[i][RECORD_CHANGED_USER_ID] = new Boolean(true);
		arrayRecord[i][RECORD_UNIT_COUNT] = objRecord[i].getUnitCount();
		
		//-------------------------------------------------------------
		//jbgL`FbN
		//-------------------------------------------------------------
		//jbgJEg0̏ꍇ́AuN\
		if (CommonFunction.encodeSJIS(objRecord[i].getUnitCount()).equals("0"))
		{
			arrayRecord[i][RECORD_OUTPUT_TITLE_NO_UNIT] = new Boolean(true);
			
			//(1R[h)͏Ȃ
			if (!strStudentID.equals(""))
			{
				arrayRecord[i][RECORD_NOT_FIRST_RECORD] = new Boolean(true);
				
				//---------------------------------------------------------------------
				//jbg^Cg\ꂽꍇ̂݁AI^O\
				//---------------------------------------------------------------------
				if (blDispUnitTitleFlg == true)
				{
					arrayRecord[i][RECORD_OUTPUT_ENDTAG] = new Boolean(true);
					
					//out.println("</table>");	//jbgڕ\e[ȕI^O
					//out.println("</td>");		//jbgڗ̏I^O
					//out.println("</tr>");		//wKҍs̏I^O
					
				}
				else
				{
					arrayRecord[i][RECORD_OUTPUT_ENDTAG] = new Boolean(false);
				}
				//-------------------------------------------------------------
				//wK҂ς邽߁Ajbg^Cg\tO(false)
				//-------------------------------------------------------------
				blDispUnitTitleFlg = false;	
				
				//-------------------------------------------------------------
				//wKҐJEg
				//-------------------------------------------------------------
				intUserCount += 1;
			}
			
			arrayRecord[i][RECORD_USER_ID] = objRecord[i].getUserID();
			arrayRecord[i][RECORD_ACCESS_COUNT] = objRecord[i].getAccessCount();
			arrayRecord[i][RECORD_PROGRESS_RATE] = objRecord[i].getProgressRate();
			arrayRecord[i][RECORD_TEST_COUNT] = objRecord[i].getTestCount();
		}
		else
		{
			arrayRecord[i][RECORD_OUTPUT_TITLE_UNIT] = new Boolean(true);
			
			//(1R[h)͏Ȃ
			if (!strStudentID.equals(""))
			{
				arrayRecord[i][RECORD_NOT_FIRST_RECORD] = new Boolean(true);
				
				//---------------------------------------------------------------------
				//jbg^Cg\ꂽꍇ̂݁AI^O\
				//---------------------------------------------------------------------
				if (blDispUnitTitleFlg == true)
				{
					arrayRecord[i][RECORD_OUTPUT_ENDTAG] = new Boolean(true);
					
					//out.println("</table>");	//jbgڕ\e[ȕI^O
					//out.println("</td>");		//jbgڗ̏I^O
					//out.println("</tr>");		//wKҍs̏I^O
					
				}
				//-------------------------------------------------------------
				//wK҂ς邽߁Ajbg^Cg\tO(false)
				//-------------------------------------------------------------
				blDispUnitTitleFlg = false;	
				
				//-------------------------------------------------------------
				//wKҐJEg
				//-------------------------------------------------------------
				intUserCount += 1;

				//-------------------------------------------------------------
				//eڂ̍viPFString^̐lIntegerփZbg,QFInteger^int^֕ϊj
				//-------------------------------------------------------------
				//ANZX񐔂̍v
				intWk = new Integer(CommonFunction.encodeSJIS(objRecord[i].getAccessCount()));
				intTotalAccessCount += intWk.intValue();

				//ϐi̍v
				intWk = new Integer(CommonFunction.encodeSJIS(objRecord[i].getProgressRate()));
				intTotalProgressRate += intWk.intValue();
				//eXg񐔂̍v
				intWk = new Integer(CommonFunction.encodeSJIS(objRecord[i].getTestCount()));
				intTotalTestCount += intWk.intValue();
				//ϓ_̍v
				intWk = new Integer(CommonFunction.encodeSJIS(objRecord[i].getAverageScore()));
				intTotalAverageScore += intWk.intValue();
				//ō_̍v
				intWk = new Integer(CommonFunction.encodeSJIS(objRecord[i].getHighestScore()));
				intTotalHighestScore += intWk.intValue();
			}

			//-------------------------------------------------------------
			//wKIAeXgہÃtOɑΉ֕ϊ
			//-------------------------------------------------------------
			//wKI
			if (CommonFunction.encodeSJIS(objRecord[i].getCompleteFlag()).equals("0"))
			{
				//""Zbg
				strComplete = STR_LIST_INCOMPLETE;
			}
			else
			{
				//"COMPLETE"Zbg
				strComplete = STR_LIST_COMPLETE;
			}

			//eXg
			if (CommonFunction.encodeSJIS(objRecord[i].getPassFlag()).equals("0"))
			{
				//"PASS"Zbg
				strPass = STR_LIST_FAIL;
			}
			else
			{
				//"FAIL"Zbg
				strPass = STR_LIST_PASS;
			}
			
			arrayRecord[i][RECORD_USER_ID] = objRecord[i].getUserID();
			arrayRecord[i][RECORD_COMPLETE] = strComplete;
			arrayRecord[i][RECORD_PASS] = strPass;
			arrayRecord[i][RECORD_ACCESS_COUNT] = objRecord[i].getAccessCount();
			arrayRecord[i][RECORD_PROGRESS_RATE] = objRecord[i].getProgressRate();
			arrayRecord[i][RECORD_TEST_COUNT] = objRecord[i].getTestCount();
			arrayRecord[i][RECORD_AVERAGE_SCORE] = objRecord[i].getAverageScore();
			arrayRecord[i][RECORD_HIGHEST_SCORE] = objRecord[i].getHighestScore();
		}
	}
	//-------------------------------------------------------------
	//jbgL`FbN
	//-------------------------------------------------------------
	//jbgJEg0̏ꍇ́AuN\
	if (CommonFunction.encodeSJIS(objRecord[i].getUnitCount()).equals("0"))
	{
		arrayRecord[i][RECORD_UNIT_COUNT] = objRecord[i].getUnitCount();
	}
	else
	{
		//-------------------------------------------------------------
		//ejbgڂ̕\
		//-------------------------------------------------------------
		//wK҂ԁAAjbg^Cg܂\ĂȂꍇ̂ݏ
		if( ( ! strStudentID.equalsIgnoreCase(CommonFunction.encodeSJIS(objRecord[i].getStudentID()))) && (blDispUnitTitleFlg == false))
		{
			arrayRecord[i][RECORD_OUTPUT_UNIT_TITLE] = new Boolean(true);
			
			//-------------------------------------------------------------
			//jbg^Cg\߁AtruetO𗧂ĂB
			//-------------------------------------------------------------
			blDispUnitTitleFlg = true;
		}

		//-------------------------------------------------------------
		//jbgۂ̃tOɑΉ֕ϊ
		//-------------------------------------------------------------
		//jbg
		if (CommonFunction.encodeSJIS(objRecord[i].getUnitPassFlag()).equals("0"))
		{
			//"PASS"Zbg
			strUnitPass = STR_LIST_FAIL;
		}
		else
		{
			//"FAIL"Zbg
			strUnitPass = STR_LIST_PASS;
		}
		String strTemp = "";
		try {
			//DBʏ "0" ̎@MS SQLServer
			//DBʏ "1" ̎@Oracle
			if ( lsDBEnv.equals(objEnv.DB_SQLSERVER) ) {
				strTemp = CommonFunction.encodeSJIS(objRecord[i].getUnitName());
			}
			else {
				strTemp = objRecord[i].getUnitName();
			}
		}
		catch( Exception e ) {
			e.printStackTrace();
			response.sendRedirect(getParamErrURL(MSG_ENV_ERR, null, true));
			return;
		}
		
		arrayRecord[i][RECORD_UNIT_NAME] = strTemp;
		arrayRecord[i][RECORD_UNIT_ACCESS_COUNT] = objRecord[i].getUnitAccessCount();
		arrayRecord[i][RECORD_UNIT_PROGRESS] = objRecord[i].getUnitProgress();
		arrayRecord[i][RECORD_UNIT_TEST_COUNT] = objRecord[i].getUnitTestCount();
		arrayRecord[i][RECORD_UNIT_AVERAGE_SCORE] = objRecord[i].getUnitAverageScore();
		arrayRecord[i][RECORD_UNIT_HIGHEST_SCORE] = objRecord[i].getUnitHighestScore();
		arrayRecord[i][RECORD_UNIT_PASS] = strUnitPass;
	}

	//---------------------------------------------------------------------
	//rp̕ϐɃ[UIDi[
	//---------------------------------------------------------------------
	strStudentID = CommonFunction.encodeSJIS(objRecord[i].getStudentID());
}

//-------------------------------------------------------------------------
//Loop㏈
//-------------------------------------------------------------------------
//jbg^Cg\ꂽꍇ̂݁AI^O\
boolean isOutputEndTag = false;
if (blDispUnitTitleFlg == true)
{
	isOutputEndTag = true;
	out.println("</table>");	//jbgڕ\e[ȕI^O
	out.println("</td>");		//jbgڗ̏I^O
	out.println("</tr>");		//wKҍs̏I^O
}

//---------------------------------------------------------------------
//wKҐJEg
//---------------------------------------------------------------------
intUserCount += 1;

//---------------------------------------------------------------------
//eڂ̍viPFString^̐lIntegerփZbg,QFInteger^int^֕ϊj
//zINDEXi-1ƂĂ̂́ALoopoゾi̒lAobjRecord.length + 1
//ȂACfbNX͈̔̓G[ƂȂĂ܂߁A邽߂̈ӖB
//---------------------------------------------------------------------
//ANZX񐔂̍v
intWk = new Integer(CommonFunction.encodeSJIS(objRecord[objRecord.length-1].getAccessCount()));
intTotalAccessCount += intWk.intValue();
//ϐi̍v
intWk = new Integer(CommonFunction.encodeSJIS(objRecord[objRecord.length-1].getProgressRate()));
intTotalProgressRate += intWk.intValue();
//eXg񐔂̍v
intWk = new Integer(CommonFunction.encodeSJIS(objRecord[objRecord.length-1].getTestCount()));
intTotalTestCount += intWk.intValue();
//ϓ_̍v
intWk = new Integer(CommonFunction.encodeSJIS(objRecord[objRecord.length-1].getAverageScore()));
intTotalAverageScore += intWk.intValue();
//ō_̍v
intWk = new Integer(CommonFunction.encodeSJIS(objRecord[objRecord.length-1].getHighestScore()));
intTotalHighestScore += intWk.intValue();


//-------------------------------------------------------------
//e^Cgڂ̕ϒl̎Zo
//-------------------------------------------------------------
//SwK҂̃ANZX񐔂̕
intAllUserAccessCountAve 	= intTotalAccessCount / intUserCount;
//SwK҂̕ϐi̕
intAllUserProgressRateAve 	= intTotalProgressRate / intUserCount;
//SwK҂̃eXg񐔂̕
intAllUserTestCountAve 		= intTotalTestCount / intUserCount;
//SwK҂̕ϓ_̕
intAllUserAverageScoreAve 	= intTotalAverageScore / intUserCount;
//SwK҂̍ō_̕
intAllUserHighestScoreAve 	= intTotalHighestScore / intUserCount;
*/
