Exemplo n.º 1
0
        public static void PopulateSessionVariables(Learner learner, ContentModuleSession session, Course assignment)
        {
            LMSSession.AddSessionItem(CommonKeys.SESSION_LOGEDUSERNAME, learner.UserName);
            LMSSession.AddSessionItem(ContentKeys.SESSION_USER_LAST_FIRST_NAME, learner.LastName + ", " + learner.FirstName);
            //LMSSession.AddSessionItem(Client.CLIENT_SESSION_ID, learner.ClientId);
            LMSSession.AddSessionItem(ContentKeys.SESSION_LEARNER_ID, session.SystemUserGuid);
            LMSSession.AddSessionItem(ContentKeys.SESSION_USERNAMEALIAS, learner.UserName);
            // LMSSession.AddSessionItem(ContentKeys.SESSION_LERNER_LANGUAGE_ID, learner.DefaultLanguageId);
            //LMSSession.AddSessionItem(ContentKeys.SESSION_RVSETTINGS, learner.RegionViewName);

            LMSSession.AddSessionItem(ContentKeys.SESSION_RET_TOSERVER_URL, session.ReturnUrl);
            LMSSession.AddSessionItem(ContentKeys.SESSION_ISREVIEW, session.IsReview);
            LMSSession.AddSessionItem(ContentKeys.SESSION_IS_FOR_ADMIN_PREVIEW, (session.LaunchSite == LaunchSite.Admin));
            LMSSession.AddSessionItem(CommonManager.IS_SSO_LOGIN, session.SsoLogin);
            LMSSession.AddSessionItem(ContentKeys.SESSION_IS_SAME_WINDOW, session.SameWindow);
            if (session.GridPageSize.HasValue)
            {
                LMSSession.AddSessionItem(CommonManager.SESSION_GRID_PAGE_SIZE, session.GridPageSize.Value);
            }
            if (session.Attempt.HasValue)
            {
                LMSSession.AddSessionItem(ContentKeys.SESSION_ATTEMPT_ID, assignment.ActivityId + "-" + learner.EmployeeId + "-" + session.Attempt.Value);
            }
            LMSSession.AddSessionItem(ContentKeys.SESSION_ACTIVITYID, assignment.ActivityId);
            LMSSession.AddSessionItem(ContentKeys.SESSION_COURSENAME, assignment.ContentModuleName);
            LMSSession.AddSessionItem(ContentKeys.SESSION_ACTIVITY_ISAUTH, true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.HttpMethod == "GET")
            {
                ////if (LMSSession.IsInSession(Client.CLIENT_SESSION_ID))
                ////    hdnClientId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(Client.CLIENT_SESSION_ID)));

                if (LMSSession.IsInSession(ContentKeys.SESSION_ACTIVITYID))
                {
                    hdnContentModuleId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID)));
                    courseId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
                }
                if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
                {
                    hdnUserId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID)));
                    learnerId       = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
                }
                hdnCStartDate.Value = Convert.ToString(DateTime.UtcNow);
                return;
            }
            var    requestXml = LoadRequestXml();
            XMLLib xLib       = new XMLLib();

            if (requestXml == null)
            {
                Response.Redirect("DisplayError.aspx?error=SessionTimeout");
            }
            //sClientId = CommonManager.DecodeAndDecrypt(xLib.fGetValue(requestXml, "/Root/ClientId"));
            sessionId = xLib.fGetValue(requestXml, "/Root/SessionId");
            courseId  = EncryptionManager.Decrypt(Convert.ToString(hdnContentModuleId.Value));

            if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
            {
                hdnUserId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID)));
                learnerId       = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
            }



            if (requestXml != null)
            {
                XmlNode oRootNode = null;

                if (xLib.fCreateFirstContext(requestXml, "Root", ref oRootNode))
                {
                    string useCase = xLib.fGetValue(requestXml, "/Root/Case");
                    ProcessRequest(requestXml, useCase);
                }
            }
        }
Exemplo n.º 3
0
        public static void AddAttemptNumberToSession(string clientId, string sessionId, string attemptId)
        {
            if (LMSSession.IsInSession(ContentKeys.SESSION_ATTEMPT_ID))
            {
                return;
            }
            var idParts = attemptId.Split(new[] { '-' });

            if (idParts.Length > 2)
            {
                var sessionDam = new ContentModuleSessionDAM();
                sessionDam.AddAttemptNumber(clientId, sessionId, Convert.ToInt16(idParts[2]));
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string sCourseName = string.Empty;

            if (LMSSession.IsInSession(ContentKeys.SESSION_COURSENAME))
            {
                sCourseName = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_COURSENAME));

                if (sCourseName != "")
                {
                    lblContentModuleName.Text = sCourseName;
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Launches activity
        /// </summary>
        /// <param name="activityAssignment"></param>
        private void LaunchActivity(Course activityAssignment, ContentModuleSession session, Learner currentUser) //, ContentModuleSession session
        {
            SessionManager.PopulateSessionVariables(currentUser, session, activityAssignment);

            LMSSession.RemoveSessionItem(ContentKeys.SESSION_ATTEMPT_ID);
            LMSSession.RemoveSessionItem(ContentKeys.SESSION_TOTAL_NO_PAGES);


            string sessionId = session.SystemUserGuid + "--" + session.ContentModuleId;
            string sLaunchPlayer;

            sLaunchPlayer = "HTMLGetSCORM.htm?sessionId=" + sessionId + "&contentmoduleid=" + session.ContentModuleId + "&learnerid=" + session.SystemUserGuid;// +"&LangId=" + langId;

            Response.Redirect(sLaunchPlayer);
        }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID) || Request["firstLoad"] == "true")
     {
         if (Request.QueryString["SessionTimeOut"] != null &&
             Convert.ToString(Request.QueryString["SessionTimeOut"]) != string.Empty)
         {
             string sSessionTimeout = Convert.ToString(Request.QueryString["SessionTimeOut"]);
             bodyMain.Attributes.Add("onload", "fnSetSessionPoller(" + sSessionTimeout + ")");
         }
     }
     else
     {
         Response.Redirect("DisplayError.aspx?error=SessionTimeout");
     }
 }
        /// <summary>
        /// This method return page elements text.
        /// </summary>
        /// <param name="entListPageElements">List<UserPageElementLanguage> entListPageElements</param>
        /// <param name="string">pElementName</param>
        /// <returns>string</returns>
        ///
        //public static string GetPageElementsText(List<UserPageElementLanguage> entListPageElements, string pElementName)
        //{
        //    string strElementText = string.Empty;
        //    UserPageElementLanguage entElementSearch = new UserPageElementLanguage();
        //    entElementSearch.ElementName = pElementName;

        //    UserPageElementLanguage entElementReturn = entListPageElements.Find(delegate(UserPageElementLanguage entElement)
        //    { return entElement.ElementName == entElementSearch.ElementName; });
        //    if (entElementReturn != null)
        //    {
        //        strElementText = entElementReturn.ElementText;
        //    }

        //    return strElementText;
        //}
        #endregion

        ////#region GetPageElements
        /////// <summary>
        /////// This method return user page elements.
        /////// </summary>
        /////// <param name="pClientId"></param>
        /////// <param name="pPageId"></param>
        /////// <param name="pLangId"></param>
        /////// <returns>string</returns>
        ///////
        ////public static List<UserPageElementLanguage> GetPageElements(string pClientId, string pPageId, string pLangId)
        ////{
        ////    List<UserPageElementLanguage> entListPageElements = new List<UserPageElementLanguage>();
        ////    UserPage entPage = new UserPage();
        ////    UserPageManager mgrUserPage = new UserPageManager();
        ////    entPage.ClientId = pClientId;
        ////    entPage.ID = pPageId;
        ////    entPage.ParaLanguageId = pLangId;

        ////    entPage = mgrUserPage.Execute(entPage, UserPage.Method.Get);
        ////    entListPageElements = entPage.PageElementLanguage;

        ////    return entListPageElements;
        ////}
        ////#endregion

        ////#region GetLearnerLanguage
        /////// <summary>
        /////// This method return current Learner language.
        /////// </summary>
        /////// <returns>string</returns>
        ///////
        ////public static string GetLearnerLanguage(Client entClient)
        ////{
        ////    string _strDefaultLanguage = string.Empty;
        ////    string _strLearnerId = string.Empty;
        ////    //Check for Learner Id in session
        ////    if (LMSSession.IsInSession(Learner.USER_SESSION_ID))
        ////    {
        ////        try
        ////        {

        ////            _strLearnerId = (string)LMSSession.GetValue(Learner.USER_SESSION_ID);
        ////            _strDefaultLanguage = CommonManager.GetLearnerDefaultLanguage(_strLearnerId);
        ////        }
        ////        catch
        ////        {
        ////            Learner entInnerlearner = (Learner)LMSSession.GetValue(Learner.USER_SESSION_ID);
        ////            if (entInnerlearner != null)
        ////                _strLearnerId = entInnerlearner.ID;

        ////            _strDefaultLanguage = CommonManager.GetLearnerDefaultLanguage(_strLearnerId);

        ////        }
        ////    }
        ////    else //Get Clients Language
        ////    {
        ////        if (LMSSession.IsInSession(CommonManager.SESSION_MYCULTURE))
        ////        {
        ////            _strDefaultLanguage = Convert.ToString(LMSSession.GetValue(CommonManager.SESSION_MYCULTURE));
        ////        }
        ////        else
        ////        {
        ////            //Check client cookie is present
        ////            string strClientID = entClient.ID;
        ////            if (LMSCookie.CheckCookie(strClientID))
        ////            {
        ////                _strDefaultLanguage = LMSCookie.GetCookieParam(strClientID, CommonManager.COOKIES_LANG);
        ////                LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////            }
        ////            else //Create client cookie and set its value
        ////            {
        ////                LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, entClient.DefaultLanguageId);
        ////                _strDefaultLanguage = entClient.DefaultLanguageId;
        ////            }
        ////        }
        ////    }
        ////    string strLangTextDirection = CommonManager.LANGUAGE_TEXT_DIRECTION_LTR;

        ////    if (!String.IsNullOrEmpty(entClient.Language.TextDirection))
        ////        strLangTextDirection = entClient.Language.TextDirection;
        ////    LMSSession.AddSessionItem(CommonManager.SESSION_LANG_TEXTDIRC, strLangTextDirection);

        ////    entClient = null;
        ////    return _strDefaultLanguage;
        ////}
        ////#endregion

        ////public static string GetLearnerDefaultLanguage(string strLearnerId)
        ////{
        ////    string _strDefaultLanguage = string.Empty;
        ////    //Get Learner Language is in Cookie
        ////    if (LMSCookie.CheckCookie(strLearnerId))
        ////    {
        ////        _strDefaultLanguage = LMSCookie.GetCookieParam(strLearnerId, CommonManager.COOKIES_LANG);
        ////        LMSSession.AddSessionItem(CommonManager.SESSION_LEARNER_CULTURE, _strDefaultLanguage);
        ////        LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////    }
        ////    else
        ////    {
        ////        //Get Learner Language in Session
        ////        if (LMSSession.IsInSession(CommonManager.SESSION_LEARNER_CULTURE))
        ////        {
        ////            _strDefaultLanguage = Convert.ToString(LMSSession.GetValue(CommonManager.SESSION_LEARNER_CULTURE));
        ////            LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////        }
        ////        else
        ////        {
        ////            //Get Learner Language from Database
        ////            Learner entLearner = new Learner();
        ////            entLearner = CommonManager.GetLearnerById(strLearnerId);
        ////            if (entLearner != null && !string.IsNullOrEmpty(entLearner.DefaultLanguageId))
        ////            {
        ////                _strDefaultLanguage = entLearner.DefaultLanguageId;
        ////            }
        ////            else
        ////            {
        ////                Client _entClient = new Client();
        ////                _entClient = CommonManager.GetClient();
        ////                _strDefaultLanguage = _entClient.DefaultLanguageId;
        ////            }
        ////            LMSSession.AddSessionItem(CommonManager.SESSION_LEARNER_CULTURE, _strDefaultLanguage);
        ////            LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////            LMSCookie.CreateUserCookies(strLearnerId);
        ////            LMSCookie.SetCookieParam(strLearnerId, CommonManager.COOKIES_LANG, _strDefaultLanguage);
        ////        }
        ////    }
        ////    return _strDefaultLanguage;
        ////}

        #region GetLearnerById
        /// <summary>
        /// Get Learner
        /// </summary>
        /// <param name="pstrUserId"></param>
        /// <returns>Learner</returns>
        public static Learner GetLearnerById(string pstrUserId)
        {
            Learner entLearner = new Learner();

            if (LMSSession.IsInSession(CommonManager.SESSION_LEARNER))
            {
                entLearner = (Learner)LMSSession.GetValue(CommonManager.SESSION_LEARNER);
            }
            else
            {
                LearnerManager mgrLearner = new LearnerManager();
                entLearner.ID = pstrUserId;

                entLearner = mgrLearner.Execute(entLearner, Learner.Method.Get);
                //Add learner into session
                LMSSession.AddSessionItem(CommonManager.SESSION_LEARNER, entLearner);
            }
            return(entLearner);
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btnExitServer.Visible = false;
            if (!LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
            {
                if (String.IsNullOrEmpty(Request["clientId"]) || String.IsNullOrEmpty(Request["sessionId"]))
                {
                    Response.Redirect("DisplayError.aspx?error=SessionTimeout");
                }
                string sessionId = Request["sessionId"];
                string clientId  = CommonManager.DecodeAndDecrypt(Request["clientId"]);
                //if (!SessionManager.RestoreAspSession(clientId, sessionId))
                //{
                //    Response.Redirect("DisplayError.aspx?error=SessionTimeout");
                //}
            }
            if (Request.QueryString["ExitType"] != null && Convert.ToString(Request.QueryString["ExitType"]).Trim() != string.Empty)
            {
                if (LMSSession.IsInSession(ContentKeys.SESSION_IS_SAME_WINDOW))
                {
                    string sDefaultLang = "en-US";
                    if (LMSSession.IsInSession(ContentKeys.SESSION_LERNER_LANGUAGE_ID))
                    {
                        sDefaultLang = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LERNER_LANGUAGE_ID));
                    }

                    btnExitServer.Text = "Back To Home"; //MessageAdaptor.GetMessage(Services.Messages.Content.BACK_TO_HOME, sDefaultLang);

                    btnExitServer.Visible = Convert.ToBoolean(LMSSession.GetValue(ContentKeys.SESSION_IS_SAME_WINDOW));
                }
                else
                {
                    btnExitServer.Visible = false;
                }
            }
        }
Exemplo n.º 9
0
        protected void btnExitServer_Click(object sender, EventArgs e)
        {
            //Client entClient = CommonManager.GetClient();
            string sClientId         = "";// Convert.ToString(LMSSession.GetValue(Client.CLIENT_SESSION_ID));
            string sUserName         = Convert.ToString(LMSSession.GetValue(CommonKeys.SESSION_LOGEDUSERNAME));
            string sLearnerId        = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
            bool   blnIsAdminPreview = Convert.ToBoolean(LMSSession.GetValue(ContentKeys.SESSION_IS_FOR_ADMIN_PREVIEW));
            string CourseId          = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
            bool   bIsSSOLogin       = false; //This value will be initially passed to player from Application

            if (LMSSession.IsInSession(CommonManager.IS_SSO_LOGIN))
            {
                bIsSSOLogin = Convert.ToBoolean(LMSSession.GetValue(CommonManager.IS_SSO_LOGIN));
            }
            string sessionId = Request["sessionId"];

            if (!String.IsNullOrEmpty(sessionId))
            {
                new ContentModuleSessionDAM().Expire(sClientId, sessionId);
            }

            //LoginKey entLoginKey = new LoginKey();
            //entLoginKey.SystemUserGUID = sLearnerId;
            //entLoginKey.UserNameAlias = sUserName;
            //entLoginKey.IsSSOLogin = bIsSSOLogin;
            ////Issue No # 127
            ////entLoginKey.StartUrl = "http://" + entClient.ClientAccessURL + LMSSession.GetValue(ContentKeys.SESSION_RET_TOSERVER_URL).ToString() ;
            //if (blnIsAdminPreview) //If from Admin Site
            //{
            //    entLoginKey.StartUrl = "/pages/content/managecourses.aspx?Id=8s9";
            //}
            //else
            //{
            //    entLoginKey.StartUrl = "/Pages/mainpage.aspx";
            //}


            //entLoginKey.ClientId = sClientId;
            ////This value will be initially passed to player from Application
            //if (LMSSession.IsInSession(CommonManager.SESSION_GRID_PAGE_SIZE))
            //{
            //    entLoginKey.PageSize = Convert.ToInt32(LMSSession.GetValue(CommonManager.SESSION_GRID_PAGE_SIZE));
            //}
            //else
            //{
            //    entLoginKey.PageSize = CommonManager.GRID_DEFAULT_PAGE_SIZE;
            //}
            //LoginKeyManager mgrLoginKey = new LoginKeyManager();
            //entLoginKey = mgrLoginKey.Execute(entLoginKey, LoginKey.Method.Add);
            string sResponseRedirect = string.Empty;

            //////////-aw 6/29/2011 Return to the default protocol
            ////////string sProtocol;

            ////////sProtocol = entClient.IsHTTPSAllowed
            ////////                ? ConfigurationManager.ConnectionStrings[CommonManager.DEFAULT_PROTOCOL].ConnectionString
            ////////                : "http";

            ////////if (blnIsAdminPreview) //If from Admin Site
            ////////{
            ////////    //-aw 6/29/2011 Return to the default protocol
            ////////    //sResponseRedirect = Request.Url.Scheme + "://" + entClient.ClientAccessURL + "/Admin/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID);
            ////////    sResponseRedirect = sProtocol + "://" + entClient.ClientAccessURL + "/Admin/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID) + "&AID=" + HttpUtility.UrlEncode(CourseId); ;
            ////////}
            ////////else //for Learner Site
            ////////{
            ////////    //-aw 6/29/2011 Return to the default protocol
            ////////    //sResponseRedirect = Request.Url.Scheme + "://" + entClient.ClientAccessURL + "/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID);

            ////////    sResponseRedirect = sProtocol + "://" + entClient.ClientAccessURL + "/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID) + "&AID=" + HttpUtility.UrlEncode(CourseId); ;
            ////////}
            sResponseRedirect = System.Configuration.ConfigurationManager.AppSettings["sAppUrl"] + System.Configuration.ConfigurationManager.AppSettings["Launchlink"].ToString();
            ScriptManager.RegisterClientScriptBlock(Page, this.Page.GetType(), "", "parent.fnExitFrame();parent.ChangeURL('" + sResponseRedirect + "')", true);
        }
        private void SaveSuspendData(XmlDocument requestXml)
        {
            string strContentModuleId = string.Empty;
            string strAttempId        = string.Empty;
            string strSystemUserGUID  = string.Empty;
            string strClientId        = string.Empty;

            if (LMSSession.IsInSession(ContentKeys.SESSION_ACTIVITYID))
            {
                strContentModuleId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
            }
            if (LMSSession.IsInSession(ContentKeys.SESSION_ATTEMPT_ID))
            {
                strAttempId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ATTEMPT_ID));
            }
            if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
            {
                strSystemUserGUID = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
            }
            if (LMSSession.IsInSession("CLIENT_SESSION_ID"))
            {
                strClientId = Convert.ToString(LMSSession.GetValue("CLIENT_SESSION_ID"));
            }

            if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnClientId.Value))
            {
                strClientId = EncryptionManager.Decrypt(hdnClientId.Value);
            }

            if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnContentModuleId.Value))
            {
                strContentModuleId = EncryptionManager.Decrypt(hdnContentModuleId.Value);
            }

            if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnUserId.Value))
            {
                strSystemUserGUID = EncryptionManager.Decrypt(hdnUserId.Value);
            }


            if (string.IsNullOrEmpty(strContentModuleId) || string.IsNullOrEmpty(strSystemUserGUID) || string.IsNullOrEmpty(strClientId))
            {
                RedirectToMainPage();
            }
            else
            {
                //var activityAssignment = CoursePlayerAssignmentManager.GetAssignmentForLaunch(strClientId, strContentModuleId, strSystemUserGUID, LaunchSite.Learner);
                //if (activityAssignment.ActivityStatus != ActivityCompletionStatus.Completed)
                //{
                //List<UserAssessmentQuestionTracking> lstQTrack = BusinessManager.UserDataXMLUtil.GetSuspendData(requestXml, strContentModuleId, strAttempId, strSystemUserGUID, strClientId);

                //#region SaveTracking
                //if (lstQTrack != null && lstQTrack.Count > 0)
                //{
                //    try
                //    {
                //        UserAssessmentQuestionTrackingManager objAssessmentQTrackMgr = new UserAssessmentQuestionTrackingManager();
                //        List<UserAssessmentQuestionTracking> lstRetAssessmentQTrack = new List<UserAssessmentQuestionTracking>();

                //        lstRetAssessmentQTrack = objAssessmentQTrackMgr.Execute(lstQTrack, UserAssessmentQuestionTracking.ListMethod.BulkAdd);
                //    }
                //    catch
                //    {

                //    }
                //}
                //#endregion
                //}
            }
        }
        private void ProcessRequest(XmlDocument RequestXMLObj, string useCase)
        {
            switch (useCase)
            {
            case "SaveCurrentSco":
                try
                {
                    string strContentModuleId = string.Empty;
                    string strLearnerId       = string.Empty;
                    ////string strClientId = string.Empty;

                    if (LMSSession.IsInSession(ContentKeys.SESSION_ACTIVITYID))
                    {
                        strContentModuleId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
                    }

                    if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
                    {
                        strLearnerId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
                    }

                    ////if (LMSSession.IsInSession(Client.CLIENT_SESSION_ID))
                    ////    strClientId = Convert.ToString(LMSSession.GetValue(Client.CLIENT_SESSION_ID));

                    ////if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnClientId.Value))
                    ////{
                    ////    strClientId = EncryptionManager.Decrypt(hdnClientId.Value);
                    ////}

                    if (!string.IsNullOrEmpty(hdnContentModuleId.Value))
                    {
                        strContentModuleId = EncryptionManager.Decrypt(hdnContentModuleId.Value);
                    }

                    if (!String.IsNullOrEmpty(strContentModuleId))
                    {
                        bool flag = false;
                        if (hdnContentModuleIdIsA.Value == String.Empty)
                        {
                            ContentModuleManager _CMManager       = new ContentModuleManager();
                            ContentModule        entContentModule = new ContentModule();
                            entContentModule.ID = strContentModuleId;
                            ////entContentModule.ClientId = strClientId;
                            entContentModule            = _CMManager.Execute(entContentModule, ContentModule.Method.GetByIDCoursePlayer);
                            flag                        = entContentModule.IsAssessment;
                            hdnContentModuleIdIsA.Value = entContentModule.IsAssessment.ToString();
                        }
                        else
                        {
                            flag = Convert.ToBoolean(hdnContentModuleIdIsA.Value);
                        }

                        if (flag)
                        {
                            SaveSuspendData(RequestXMLObj);
                        }
                    }
                    else
                    {
                        RedirectToMainPage();
                    }
                }
                catch (Exception ex)
                {
                }

                SaveCurrentSco(RequestXMLObj);
                ////string xmlFromPost = Request["TARecords"];

                break;
            }
        }
        /// <summary>
        /// Page Load event call of the page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (String.IsNullOrEmpty(Request["clientId"]) || String.IsNullOrEmpty(Request["sessionId"]))
            if (String.IsNullOrEmpty(Request["sessionId"]))
            {
                Response.Redirect("DisplayError.aspx?error=SessionTimeout");
            }

            //~ var sClientId = CommonManager.DecodeAndDecrypt(Request["clientId"]);
            var sClientId       = "HRS";
            var sessionId       = Request["sessionId"];
            var contentmoduleid = Request["contentmoduleid"];
            var learnerid       = Request["learnerid"];
            //Session["contentmoduleid"] = Request["contentmoduleid"];

            var session = ContentModuleSessionRepository.GetByIdForCourseLaunch(learnerid, contentmoduleid);
            //var session = new ContentModuleSession();

            //if (session == null)
            //{
            //    Response.Redirect("DisplayError.aspx?error=SessionTimeout");
            //}

            string sLearnerUserNameAlias = session.Learner.UserName;

            //string sManagerEmail = session.Learner.ManagerEmailId;
            //_sManagerEmail = session.Learner.ManagerEmailId;
            //~ _sManagerEmail = _sManagerEmail.Replace("'", "\'");

            //string sStudentEmail = session.Learner.EmailID;
            //~ sStudentEmail = sStudentEmail.Replace("'", "\'");


            sStudentName = session.Learner.LastName + ", " + session.Learner.FirstName;
            string sCourseID = Request["contentmoduleid"];
            //~string sCourseName = session.Assignment.ActivityName;
            string sCourseName = "HRS";
            //~string sRVSettings = session.Learner.RegionViewName;
            string sRVSettings      = "HRS";
            string sIsScoreTracking = string.Empty;
            bool   blnIsShortLanguageCode;

            ContentModuleTracking contModTracking = session.ContentModuleTracking;
            ContentModule         entContent      = session.ContentModule; //new ContentModule();

            //blnIsShortLanguageCode = entContent.IsShortLanguageCode;

            iMasteryScore = 100;///****session.ContentModule.MasteryScore;
            ////sAVPath = session.Learner.AvPath;

            sIsScoreTracking = "";

            sContentFolderUrl = System.Configuration.ConfigurationManager.AppSettings["sAppUrl"].ToString() + System.Configuration.ConfigurationManager.AppSettings["sContentFolderUrl"].ToString() + "/" + contentmoduleid;

            lblErr.Text = "";
            if (!Page.IsPostBack)
            {
                lblWelcome.Text = sLearnerUserNameAlias;

                string strIMSCourseBasePath = sContentFolderUrl + "/";

                string sAttempId = string.Empty;

                if (contModTracking.ID != null)
                {
                    sAttempId = contModTracking.ID;
                    LMSSession.AddSessionItem(ContentKeys.SESSION_ATTEMPT_ID, sAttempId);
                    SessionManager.AddAttemptNumberToSession(sClientId, sessionId, contModTracking.ID);
                }

                int TotalNoOfPages = entContent.TotalLessons;
                totalscos = TotalNoOfPages.ToString();
                LMSSession.AddSessionItem(ContentKeys.SESSION_TOTAL_NO_PAGES, TotalNoOfPages);

                lblContentModuleName.Text = sCourseName;
                lblMessage.Text           = "To receive your certificate of completion you must view each screen in each section.";
                Response.Write("<script language='Javascript'>\n\tvar gLearnerId = \"" + sLearnerUserNameAlias + "\";\n");
                Response.Write("\tvar gStudentId = \"" + sLearnerUserNameAlias + "\";\n");
                Response.Write("\tvar sessionId = \"" + sessionId + "\";\n");
                Response.Write("\tvar clientId = \"" + Request["clientId"] + "\";\n");
                Response.Write("\tgLearnerName = \"" + sStudentName + "\";\n");
                Response.Write("\tgContentPath=\"" + strIMSCourseBasePath + "\";\n");
                Response.Write("\tvar gTrackScoreSettingFromLMS=\"" + sIsScoreTracking + "\";\n");


                var sbLaunchParameter = new StringBuilder();
                sbLaunchParameter.Append("LMSID=SAI");
                if (!string.IsNullOrEmpty(sAVPath))
                {
                    sbLaunchParameter.Append("&AVPath=" + sAVPath);
                    sbLaunchParameter.Append("&AudioPath=" + sAVPath);
                    sbLaunchParameter.Append("&VideoPath=" + sAVPath);
                }
                if (!string.IsNullOrEmpty(sRVSettings))
                {
                    sbLaunchParameter.Append("&rip=" + sRVSettings);
                }
                if (!string.IsNullOrEmpty(sLearnerLanguageId))
                {
                    sLanguageCode = "en-US";
                    sbLaunchParameter.Append("&lang=" + sLanguageCode);
                }

                sLaunchParameter = sbLaunchParameter.ToString();

                Response.Write("\tvar sLearnerLanguageId='" + sLanguageCode + "';\n");
                Response.Write("\tvar gManifestId='" + sCourseID + "';\n</script>\n");
                Response.Write("<script language='Javascript' src='ScormLibrary/js/ClientScripts.js'></script>\n");
                Response.Write("<script language='Javascript' src='ScormLibrary/js/LMSRTEWrapperJS.js'></script>\n");
                Response.Write("<script language='Javascript' src='ScormLibrary/js/Master.js'></script>\n");
                Response.Write("<script language='Javascript' src='ScormLibrary/js/ScormValidations.js'></script>\n");
                Response.Write("<script language='Javascript' src='ScormLibrary/js/RTEMaster.js'></script>\n");
                Response.Write("<script language='Javascript' src='js/NewScormJS.js'></script>\n");
                Response.Write("<script language='Javascript'>\n");

                launchUrls     = new Dictionary <string, string>();
                lessonStatuses = new Dictionary <string, string>();
                sections       = entContent.Sections.SortedValues();
                foreach (var section in sections)
                {
                    foreach (var lesson in section.Lessons.SortedValues())
                    {
                        var    sco         = (Sco)lesson;
                        string sTempAVPath = sLaunchParameter != string.Empty ? sLaunchParameter : sco.DataFromLms;
                        string siTempMasterScore;
                        if (iMasteryScore > -1)
                        {
                            siTempMasterScore = Convert.ToString(iMasteryScore);
                        }
                        else
                        {
                            siTempMasterScore = sco.MasteryScore.HasValue ? sco.MasteryScore.ToString() : String.Empty;
                        }
                        var sUrl = sco.Resource.Href;
                        if (sUrl.IndexOf(strIMSCourseBasePath) <= 0)
                        {
                            sUrl = sUrl.AppendUrlParameter("passingScore", siTempMasterScore) + "&" +
                                   sLaunchParameterQueryString;
                        }
                        launchUrls[lesson.Identifier] = sUrl;

                        var arrOfNodeProp =
                            String.Format(
                                "['{0}','','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}']",
                                sco.Identifier, sco.TargetWindow, sco.Prerequisites, sTempAVPath, siTempMasterScore,
                                sco.MaxTimeAllowed, sco.TimeLimitAction, sco.Resource.Identifier, sco.Resource.ScormType,
                                sco.Resource.Type, sco.Resource.Base, sUrl);
                        Response.Write("\tarrManifestNodes[arrManifestNodes.length] = new ManifestNode(" + arrOfNodeProp +
                                       ");\n");
                        if (contModTracking.LessonTracking != null &&
                            contModTracking.LessonTracking.ContainsKey(lesson.Identifier))
                        {
                            var scoTracking = contModTracking.LessonTracking[lesson.Identifier];
                            lessonStatuses[lesson.Identifier] = CommonManager.GetScoStatus(scoTracking.LessonStatus);
                            WriteScoTracking(scoTracking);
                        }
                        else
                        {
                            lessonStatuses[lesson.Identifier] = CommonManager.GetScoStatus("not-started");
                        }
                    }
                }
                Response.Write("</script>\n");
            }
        }
Exemplo n.º 13
0
        //public ICoursePlayerAssignmentManager CoursePlayerAssignmentManager { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            // string aid = Request.Params["AID"];

            //if (Request.Params["AID"] == null || Request.Params["client"] == null ||
            //    Request.Params["LID"] == null || Request.Params["Preview"] == null)
            if (Request.Params["AID"] == null || Request.Params["LID"] == null)
            {
                Response.Write("Course Preview not available. Please Contact Administrator.");
                Response.End();
            }

            //Response.Write("<BR>AID : " + Request.Params["AID"]);
            //Response.Write("<BR>LID : " + Request.Params["LID"]);
            //Response.End();

            //string activityId = CommonManager.DecodeAndDecrypt(Request.Params["AID"]);
            //string clientId = CommonManager.DecodeAndDecrypt(Request.Params["client"]);

            string activityId = Request.Params["AID"];

            string learnerId = Request.Params["LID"];
            string langId    = Request.Params["Lang"];

            if (string.IsNullOrEmpty(langId))
            {
                langId = "en-US";
            }

            LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, langId);

            bool isReview = CheckReview();

            bool   isForAdminPreview = false;
            bool   isSsoLogin        = CheckSso();
            bool   isSameWindow      = CheckSameWindow();
            string returnUrl         = CheckReturnUrl(isForAdminPreview);
            int?   gridPageSize      = CheckGridPageSize();

            var session = new ContentModuleSession
            {
                ContentModuleId = activityId,
                Expiration      = DateTime.UtcNow.AddDays(2),
                IsReview        = isReview,
                SystemUserGuid  = learnerId,
                LaunchSite      = isForAdminPreview ? LaunchSite.Admin : LaunchSite.Learner,
                SsoLogin        = isSsoLogin,
                SameWindow      = isSameWindow,
                ReturnUrl       = returnUrl,
                GridPageSize    = gridPageSize
            };

            Course oCourse = new Course();

            oCourse.ActivityId = activityId;
            oCourse.LearnerId  = learnerId;
            var assignment = ContentModuleBLL.GetUserContentModuleTracking(oCourse);

            if (Convert.ToString(assignment.RetMessage) != "success")
            {
                Response.Write("Error Occured: " + Convert.ToString(assignment.RetMessage));
            }

            // checks if activity already exists.
            if (assignment.ContentTrackId != null)
            {
                Learner oLearner = new Learner();
                oLearner.ID = learnerId;
                LaunchActivity(assignment, session, oLearner);
            }
        }