public static void AddCommentFromLearnerByFields(string commentText, string location) { StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner (); comment.timeStamp = DateTime.Now; comment.comment = commentText; comment.location = location; AddCommentFromLearner (comment); }
/// <summary> /// Adds the comment from learner to the list. /// </summary> /// <remarks>When a new comment is added via the GUI, we need to add it to the list in the GUI and a string</remarks> /// <param name="comment">Comment.</param> public void AddCommentFromLearnerToList(StudentRecord.CommentsFromLearner comment) { string stringCommentsFromLearnerList = ""; string timeStamp = comment.timeStamp.ToString(); string location = comment.location; string text = comment.comment; stringCommentsFromLearnerList += timeStamp + " :: " + location + "\n" + text + "\n\n"; GameObject.Find("LearnerCommentList").GetComponent <Text> ().text += stringCommentsFromLearnerList; }
/// <summary> /// The add comment button pressed. /// </summary> /// <remarks>Validates the input GUI elements are not empty, then adds a new comment to SCORM and the GUI</remarks> public void ButtonAddCommentPressed() { GameObject inputFieldComment = GameObject.Find("InputFieldComment"); GameObject inputFieldCommentLocation = GameObject.Find("InputFieldCommentLocation"); string commentText = inputFieldComment.GetComponent <InputField> ().text; string commentLocation = inputFieldCommentLocation.GetComponent <InputField> ().text; if (commentText == "" | commentLocation == "") // Validate the Input Elements { if (commentText == "") { inputFieldComment.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "You must enter a comment!"; } if (commentLocation == "") { inputFieldCommentLocation.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "You must enter a location!"; } } else // Add the Comment { StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner(); comment.comment = commentText; comment.location = commentLocation; ScormManager.AddCommentFromLearner(comment); comment.timeStamp = DateTime.Now; AddCommentFromLearnerToList(comment); //Reset Fields inputFieldComment.GetComponent <InputField> ().text = ""; inputFieldCommentLocation.GetComponent <InputField> ().text = ""; inputFieldComment.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "New Learner Comment..."; inputFieldCommentLocation.transform.Find("Placeholder").gameObject.GetComponent <Text> ().text = "Comment Location..."; } }
/// <summary> /// The add comment button pressed. /// </summary> /// <remarks>Validates the input GUI elements are not empty, then adds a new comment to SCORM and the GUI</remarks> public void ButtonAddCommentPressed() { GameObject inputFieldComment = GameObject.Find ("InputFieldComment"); GameObject inputFieldCommentLocation = GameObject.Find ("InputFieldCommentLocation"); string commentText = inputFieldComment.GetComponent<InputField> ().text; string commentLocation = inputFieldCommentLocation.GetComponent<InputField> ().text; if (commentText == "" | commentLocation == "") { // Validate the Input Elements if (commentText == "") { inputFieldComment.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "You must enter a comment!"; } if (commentLocation == "") { inputFieldCommentLocation.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "You must enter a location!"; } } else { // Add the Comment StudentRecord.CommentsFromLearner comment = new StudentRecord.CommentsFromLearner(); comment.comment = commentText; comment.location = commentLocation; ScormManager.AddCommentFromLearner(comment); comment.timeStamp = DateTime.Now; AddCommentFromLearnerToList(comment); //Reset Fields inputFieldComment.GetComponent<InputField> ().text = ""; inputFieldCommentLocation.GetComponent<InputField> ().text = ""; inputFieldComment.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "New Learner Comment..."; inputFieldCommentLocation.transform.FindChild ("Placeholder").gameObject.GetComponent<Text> ().text = "Comment Location..."; } }
/// <summary> /// Loads the student record. /// </summary> /// <remarks>This is called on initialise and loads the SCORM data into the StudentRecord object. <see cref="Initialize_imp"/></remarks> /// <returns>The StudentRecord student record object.</returns> private static StudentRecord LoadStudentRecord() { studentRecord = new StudentRecord(); studentRecord.version = scormAPIWrapper.GetValue ("cmi._version"); //Comments From Learner int commentsFromLearnerCount = ParseInt (scormAPIWrapper.GetValue ("cmi.comments_from_learner._count")); studentRecord.commentsFromLearner = new List<StudentRecord.CommentsFromLearner>(); if (commentsFromLearnerCount != 0) { for (int i = 0; i < commentsFromLearnerCount; i++) { string comment = scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".comment"); string location = scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".location"); DateTime timestamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.comments_from_learner."+i+".timestamp") ); StudentRecord.CommentsFromLearner newRecord = new StudentRecord.CommentsFromLearner(); newRecord.comment = comment; newRecord.location = location; newRecord.timeStamp = timestamp; studentRecord.commentsFromLearner.Add(newRecord); } } //Comments From LMS int commentsFromLMSCount = ParseInt (scormAPIWrapper.GetValue ("cmi.comments_from_lms._count")); studentRecord.commentsFromLMS = new List<StudentRecord.CommentsFromLMS>(); if (commentsFromLMSCount != 0) { for (int i = 0; i < commentsFromLMSCount; i++) { string comment = scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".comment"); string location = scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".location"); DateTime timeStamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.comments_from_lms."+i+".timestamp") ); StudentRecord.CommentsFromLMS newRecord = new StudentRecord.CommentsFromLMS(); newRecord.comment = comment; newRecord.location = location; newRecord.timeStamp = timeStamp; studentRecord.commentsFromLMS.Add(newRecord); } } studentRecord.completionStatus = StringToCompletionStatusType (scormAPIWrapper.GetValue ("cmi.completion_status")); studentRecord.completionThreshold = ParseFloat(scormAPIWrapper.GetValue ("cmi.completion_threshold")); studentRecord.credit = StringToCreditType (scormAPIWrapper.GetValue ("cmi.credit")); studentRecord.entry = StringToEntryType (scormAPIWrapper.GetValue ("cmi.entry")); //Interactions int interactionCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions._count")); studentRecord.interactions = new List<StudentRecord.LearnerInteractionRecord>(); if (interactionCount != 0) { for (int i = 0; i < interactionCount; i++) { string id = scormAPIWrapper.GetValue ("cmi.interactions."+i+".id"); StudentRecord.InteractionType type = StringToInteractionType( scormAPIWrapper.GetValue ("cmi.interactions."+i+".type") ); DateTime timestamp = DateTime.Parse( scormAPIWrapper.GetValue ("cmi.interactions."+i+".timestamp") ); float weighting = ParseFloat( scormAPIWrapper.GetValue ("cmi.interactions."+i+".weighting") ); string response = scormAPIWrapper.GetValue ("cmi.interactions."+i+".learner_response"); float latency = timeIntervalToSeconds ( scormAPIWrapper.GetValue ("cmi.interactions."+i+".latency") ); string description = scormAPIWrapper.GetValue ("cmi.interactions."+i+".description"); float estimate = 0; StudentRecord.ResultType result = StringToResultType(scormAPIWrapper.GetValue ("cmi.interactions."+i+".result"), out estimate); StudentRecord.LearnerInteractionRecord newRecord = new StudentRecord.LearnerInteractionRecord(); newRecord.id = id; newRecord.type = type; newRecord.timeStamp = timestamp; newRecord.weighting = weighting; newRecord.response = response; newRecord.latency = latency; newRecord.description = description; newRecord.result = result; newRecord.estimate = estimate; int interactionObjectivesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions."+i+".objectives._count")); newRecord.objectives = new List<StudentRecord.LearnerInteractionObjective>(); if(interactionObjectivesCount != 0) { for (int x = 0; x < interactionObjectivesCount; x++) { StudentRecord.LearnerInteractionObjective newObjective = new StudentRecord.LearnerInteractionObjective(); newObjective.id = scormAPIWrapper.GetValue ("cmi.interactions."+i+".objectives."+x+".id"); newRecord.objectives.Add(newObjective); } } int correctResponsesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.interactions."+i+".correct_responses._count")); newRecord.correctResponses = new List<StudentRecord.LearnerInteractionCorrectResponse>(); if(correctResponsesCount != 0) { for (int x = 0; x < correctResponsesCount; x++) { StudentRecord.LearnerInteractionCorrectResponse newCorrectResponse = new StudentRecord.LearnerInteractionCorrectResponse(); newCorrectResponse.pattern = scormAPIWrapper.GetValue ("cmi.interactions."+i+".correct_responses."+x+".pattern"); newRecord.correctResponses.Add(newCorrectResponse); } } studentRecord.interactions.Add(newRecord); } } studentRecord.launchData = scormAPIWrapper.GetValue ("cmi.launch_data"); studentRecord.learnerID = scormAPIWrapper.GetValue ("cmi.learner_id"); studentRecord.learnerName = scormAPIWrapper.GetValue ("cmi.learner_name"); //learner_preference StudentRecord.LearnerPreference learnerPreference = new StudentRecord.LearnerPreference (); learnerPreference.audioLevel = ParseFloat (scormAPIWrapper.GetValue ("cmi.learner_preference.audio_level")); learnerPreference.langauge = scormAPIWrapper.GetValue ("cmi.learner_preference.language"); learnerPreference.deliverySpeed = ParseFloat (scormAPIWrapper.GetValue ("cmi.learner_preference.delivery_speed")); learnerPreference.audioCaptioning = ParseInt (scormAPIWrapper.GetValue ("cmi.learner_preference.audio_captioning")); studentRecord.learnerPreference = learnerPreference; studentRecord.location = scormAPIWrapper.GetValue ("cmi.location"); //Objectives int objectivesCount = ParseInt (scormAPIWrapper.GetValue ("cmi.objectives._count")); studentRecord.objectives = new List<StudentRecord.Objectives> (); if (objectivesCount != 0) { for (int i = 0; i < objectivesCount; i++) { string id = scormAPIWrapper.GetValue ("cmi.objectives."+i+".id"); StudentRecord.LearnerScore objectivesScore = new StudentRecord.LearnerScore(); objectivesScore.scaled = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.scaled")); objectivesScore.raw = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.raw")); objectivesScore.max = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.max")); objectivesScore.min = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".score.min")); StudentRecord.SuccessStatusType successStatus = StringToSuccessStatusType(scormAPIWrapper.GetValue ("cmi.objectives."+i+".success_status")); StudentRecord.CompletionStatusType completionStatus = StringToCompletionStatusType(scormAPIWrapper.GetValue ("cmi.objectives."+i+".completion_status")); float progressMeasure = ParseFloat (scormAPIWrapper.GetValue ("cmi.objectives."+i+".progress_measure")); string description = scormAPIWrapper.GetValue ("cmi.objectives."+i+".description"); StudentRecord.Objectives newRecord = new StudentRecord.Objectives(); newRecord.id = id; newRecord.score = objectivesScore; newRecord.successStatus = successStatus; newRecord.completionStatus = completionStatus; newRecord.progressMeasure = progressMeasure; newRecord.description = description; studentRecord.objectives.Add(newRecord); } } studentRecord.maxTimeAllowed = timeIntervalToSeconds (scormAPIWrapper.GetValue ("cmi.max_time_allowed")); studentRecord.mode = StringToModeType (scormAPIWrapper.GetValue ("cmi.mode")); studentRecord.progressMeasure = ParseFloat (scormAPIWrapper.GetValue ("cmi.progress_measure")); studentRecord.scaledPassingScore = ParseFloat(scormAPIWrapper.GetValue ("cmi.scaled_passing_score")); //Score studentRecord.learnerScore = new StudentRecord.LearnerScore (); studentRecord.learnerScore.scaled = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.scaled")); studentRecord.learnerScore.raw = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.raw")); studentRecord.learnerScore.max = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.max")); studentRecord.learnerScore.min = ParseFloat (scormAPIWrapper.GetValue ("cmi.score.min")); studentRecord.successStatus = StringToSuccessStatusType (scormAPIWrapper.GetValue ("cmi.success_status")); studentRecord.suspendData = scormAPIWrapper.GetValue ("cmi.suspend_data"); studentRecord.timeLimitAction = StringToTimeLimitActionType (scormAPIWrapper.GetValue ("cmi.time_limit_action")); studentRecord.totalTime = timeIntervalToSeconds (scormAPIWrapper.GetValue ("cmi.total_time")); return studentRecord; }