Exemplo n.º 1
0
 /// <summary>
 /// Requests the form data processor to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is 
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     // Call ExecuteViewProcessFormData with empty parameters.
     ExecuteViewProcessFormData(new NameValueCollection(0), delegate(string formFieldName, out Stream stream, out string filename)
     {
         stream = null;
         filename = null;
         return;
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// Requests the form data processor to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is 
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     ExecuteViewProcessFormData(null);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Requests the form data processor to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is 
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 public abstract void ProcessSessionEnd(RloDataModelContext context);
Exemplo n.º 4
0
 /// <summary>
 /// Requests the form data processor to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is 
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     SetExecuteViewResponses(0, InteractionResultState.Incorrect, String.Empty);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Requests the form data processor to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is 
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     // Call ExecuteViewProcessFormData with empty parameters.
     ExecuteViewProcessFormData(new NameValueCollection(0));            
 }
Exemplo n.º 6
0
 /// <summary>
 /// Requests the form data processor to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is 
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     // Call ExecuteViewProcessFormData with empty data
     ExecuteViewProcessFormData(null);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Process the end of the session.
 /// </summary>
 /// <param name="context"></param>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     // nothing to do
 }
Exemplo n.º 8
0
 /// <summary>
 /// Requests the RloHandler to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 public abstract void ProcessSessionEnd(RloDataModelContext context);
Exemplo n.º 9
0
 /// <summary>
 /// Process the end of the session.
 /// </summary>
 /// <param name="context"></param>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     // nothing to do
 }
Exemplo n.º 10
0
        /// <summary>
        /// Requests the RloHandler to do whatever is required to exit from the current activity.
        /// This request may only be issued when the session is in Execute view and is not active -- it is
        /// either Completed or Abandoned.
        /// </summary>
        /// <param name="context">The context within which the command is processed</param>
        /// <remarks>
        /// This method should only be called for the <c>SessionView.Execute</c> view.  However,
        /// no checks are done internally to verify this - if this is called with other views,
        /// unexpected results will occur.
        /// </remarks>
        public override void ProcessSessionEnd(RloDataModelContext context)
        {
            LearningDataModel learningDataModel = context.LearningDataModel;

            // Set ExitMode to suspend so that when a student exits the activity it is left in a suspended state.
            // This way if the activity is reactivated, the student's previous answers are intact.
            learningDataModel.NavigationRequest.ExitMode = ExitMode.Suspended;
            // If the page has never been visited, "visit" it.
            if (!GetPageHasBeenVisited(learningDataModel))
            {
                AssessmentItemManager.DataModelContext = context;
                // Get the input stream containing the primary file from the resource associated with the
                // current activity in the session.
                using (Stream inputStream = context.GetInputStream())
                {
                    // find all the assessment items (<IMG> tags that contain the text "mslamrk" as part of the src attribute.)
                    using (HtmlTextReader reader = new HtmlTextReader(inputStream))
                    {
                        int srcIndex;
                        while (reader.Read())
                        {
                            if (IsAITag(reader, out srcIndex))
                            {
                                try
                                {
                                    AssessmentItem         ai       = AssessmentItem.Parse(reader.GetAttributeValue(srcIndex));
                                    AssessmentItemRenderer renderer = AssessmentItemManager.GetRenderer(ai);
                                    renderer.TryAddToDataModel();
                                }
                                catch (FormatException)
                                {
                                    // skip this one.
                                }
                            }
                        }
                    }
                }
                SetPageHasBeenVisited(learningDataModel);
            }
            // If the page has never been autograded, call ProcessSessionEnd on the form data processors
            if (!GetPageHasBeenAutograded(learningDataModel))
            {
                AssessmentItemManager.ProcessFormContext = new RloProcessFormDataContext(SessionView.Execute, learningDataModel);
                float?totalPoints = null;
                foreach (Interaction interaction in learningDataModel.Interactions)
                {
                    FormDataProcessor processor = m_assessmentItemMgr.GetFormDataProcessor(interaction);
                    // must check that processor is non null, since GetFormDataProcessor() can return null.
                    // If it is null, any item score associated with this interaction is not totalled into
                    // EvaluationPoints.
                    if (processor != null)
                    {
                        processor.ProcessSessionEnd(context);
                        if (interaction.Evaluation.Points.HasValue)
                        {
                            if (totalPoints.HasValue)
                            {
                                totalPoints += interaction.Evaluation.Points;
                            }
                            else
                            {
                                totalPoints = interaction.Evaluation.Points;
                            }
                        }
                    }
                }
                learningDataModel.EvaluationPoints = totalPoints;
                SetPageHasBeenAutograded(learningDataModel);
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Requests the RloHandler to do whatever is required to exit from the current activity.
 /// This request may only be issued when the session is in Execute view and is not active -- it is 
 /// either Completed or Abandoned.
 /// </summary>
 /// <param name="context">The context within which the command is processed</param>
 /// <remarks>
 /// This method should only be called for the <c>SessionView.Execute</c> view.  However,
 /// no checks are done internally to verify this - if this is called with other views,
 /// unexpected results will occur.
 /// </remarks>
 public override void ProcessSessionEnd(RloDataModelContext context)
 {
     LearningDataModel learningDataModel = context.LearningDataModel;
     // Set ExitMode to suspend so that when a student exits the activity it is left in a suspended state.
     // This way if the activity is reactivated, the student's previous answers are intact.
     learningDataModel.NavigationRequest.ExitMode = ExitMode.Suspended;
     // If the page has never been visited, "visit" it.
     if (!GetPageHasBeenVisited(learningDataModel))
     {
         AssessmentItemManager.DataModelContext = context;
         // Get the input stream containing the primary file from the resource associated with the 
         // current activity in the session. 
         using (Stream inputStream = context.GetInputStream())
         {
             // find all the assessment items (<IMG> tags that contain the text "mslamrk" as part of the src attribute.)
             using (HtmlTextReader reader = new HtmlTextReader(inputStream))
             {
                 int srcIndex;
                 while (reader.Read())
                 {
                     if (IsAITag(reader, out srcIndex))
                     {
                         try
                         {
                             AssessmentItem ai = AssessmentItem.Parse(reader.GetAttributeValue(srcIndex));
                             AssessmentItemRenderer renderer = AssessmentItemManager.GetRenderer(ai);
                             renderer.TryAddToDataModel();
                         }
                         catch (FormatException)
                         {
                             // skip this one.
                         }
                     }
                 }
             }
         }
         SetPageHasBeenVisited(learningDataModel);
     }
     // If the page has never been autograded, call ProcessSessionEnd on the form data processors
     if (!GetPageHasBeenAutograded(learningDataModel))
     {
         AssessmentItemManager.ProcessFormContext = new RloProcessFormDataContext(SessionView.Execute, learningDataModel);
         float? totalPoints = null;
         foreach (Interaction interaction in learningDataModel.Interactions)
         {
             FormDataProcessor processor = m_assessmentItemMgr.GetFormDataProcessor(interaction);
             // must check that processor is non null, since GetFormDataProcessor() can return null.
             // If it is null, any item score associated with this interaction is not totalled into
             // EvaluationPoints.
             if (processor != null)
             {
                 processor.ProcessSessionEnd(context);
                 if (interaction.Evaluation.Points.HasValue)
                 {
                     if (totalPoints.HasValue)
                     {
                         totalPoints += interaction.Evaluation.Points;
                     }
                     else
                     {
                         totalPoints = interaction.Evaluation.Points;
                     }
                 }
             }
         }
         learningDataModel.EvaluationPoints = totalPoints;
         SetPageHasBeenAutograded(learningDataModel);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="context"></param>
 internal TextAssessmentRenderer(RloDataModelContext context)
     : base(context)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="context"></param>
 internal AssessmentItemRenderer(RloDataModelContext context)
 {
     AIResources.Culture = LocalizationManager.GetCurrentCulture();
     m_context = context;
     m_renderContext = context as RloRenderContext;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="context"></param>
 internal ItemScoreAssessmentRenderer(RloDataModelContext context)
     : base(context)
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="context"></param>
 internal CheckboxAssessmentRenderer(RloDataModelContext context)
     : base(context)
 {
 }