예제 #1
0
        public static String Translate(string content, lm.Comol.Core.DomainModel.iApplicationContext appContext, long idPath, Int32 idUser, SubActivity subActivity)
        {
            String translation = content;

            lm.Comol.Modules.EduPath.BusinessLogic.Service service = new lm.Comol.Modules.EduPath.BusinessLogic.Service(appContext);
            Path path = service.GetPath(idPath);

            if (path != null)
            {
                translation = Translate(translation, service, path, idUser, subActivity);
            }
            return(translation);
        }
예제 #2
0
        public static String Translate(string content, lm.Comol.Core.DomainModel.iApplicationContext appContext, long idPath, Int32 idUser, SubActivity subActivity, List <dtoQuizInfo> items)
        {
            //return content;

            #region Setup

            lm.Comol.Modules.EduPath.BusinessLogic.Service service = new lm.Comol.Modules.EduPath.BusinessLogic.Service(appContext);

            Path   path        = service.GetPath(idPath);
            String translation = Translate(content, service, path, idUser, subActivity);

            DateTime?endDate = service.GetEpEndDate(path, idUser);

            #endregion

            if (items.Count > 0 && translation.Contains(OpenTag + "ep.Quiz"))
            {
                foreach (dtoQuizInfo quiz in items)
                {
                    // DATE LE INFO RELATIVE AI QUIZ SISTEMARE l'OUTPUT INTANTO UN ESEMPIO PER VEDERE SE VA
                    var query = quiz.Attempts.Where(a => (!subActivity.UsePathEndDateStatistics || !endDate.HasValue) || (subActivity.UsePathEndDateStatistics && endDate.HasValue && a.CompletedOn <= endDate.Value));

                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizName)))
                    //    translation = translation.Replace(GetPlaceHolder(EduPathPlaceHoldersType.QuizName), ReplaceChars(quiz.Name));
                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizMinMark)))
                    //    translation = translation.Replace(GetPlaceHolder(EduPathPlaceHoldersType.QuizMinMark), quiz.MinScore.ToString());
                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizMaxMark)))
                    //    translation = translation.Replace(GetPlaceHolder(EduPathPlaceHoldersType.QuizMaxMark), quiz.EvaluationScale.ToString());
                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizMark)))
                    //    translation = translation.Replace(GetPlaceHolder(EduPathPlaceHoldersType.QuizMark), (query.Any()) ? ((int)query.OrderByDescending(a=> a.CompletedOn).FirstOrDefault().RelativeScore).ToString() : "");

                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizAttempts)))
                    //    translation = translation.Replace(GetPlaceHolder(EduPathPlaceHoldersType.QuizAttempts), query.Count().ToString());

                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizQuestionsNumber)))
                    //{

                    //}
                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizList)))
                    //{
                    //}
                    //if (content.Contains(GetPlaceHolder(EduPathPlaceHoldersType.QuizTable)))
                    //{
                    //}
                }
            }
            return(translation);
        }