Beispiel #1
0
        private void LoadPlayer(Int32 idUser, String playSessionId, Guid workingSessionId, liteRepositoryItem item, liteRepositoryItemVersion version, liteFileTransfer fileTransfer, liteModuleLink link, String language, Boolean saveCompleteness, Boolean isOnModal, Boolean refreshContainer, Boolean saveStatistics)
        {
            List <litePlayerSettings> players = Service.PlayerGetSettings();

            if (players == null || (version != null && !players.Any(p => p.Id == version.IdPlayer && !String.IsNullOrEmpty(p.PlayUrl) && !String.IsNullOrEmpty(p.PlayerRenderUrl) && !String.IsNullOrEmpty(p.ModalPlayerRenderUrl))))
            {
                View.DisplayMessage(item.DisplayName, item.Extension, item.Type, Domain.PlayerErrors.PlayerUnavailable);
            }
            else
            {
                String             playUrl       = "";
                String             ajaxActionUrl = "";
                litePlayerSettings player        = players.FirstOrDefault(p => p.Id == version.IdPlayer);
                Int32 idCommunity = View.ItemIdCommunity;
                Int32 idAction    = (link == null) ? (int)ModuleRepository.ActionType.PlayFile : link.Action;
                if (saveStatistics)
                {
                    Service.StatisticsAddPlay(idUser, item.Repository, version, idCommunity, (long)ModuleRepository.ActionType.PlayFile, playSessionId);
                }

                ajaxActionUrl = RootObject.AjaxAction(idCommunity, item.Id, version.UniqueIdItem, version.Id, version.UniqueIdVersion, version.Type, (link == null ? 0 : link.Id), idAction, workingSessionId, playSessionId, isOnModal);
                switch (version.Type)
                {
                case ItemType.Multimedia:
                    if (saveCompleteness && link != null)
                    {
                        View.SaveLinkEvaluation(idUser, link.Id);
                    }



                    playUrl  = player.PlayUrl.Replace("#" + PlayerPlaceHolders.defaultDocumentPath + "#", System.Web.HttpUtility.HtmlEncode(fileTransfer.DefaultDocumentPath.Replace("\\", "/")));
                    playUrl += (!playUrl.Contains("?")) ? "?" : "&";

                    playUrl += QueryKeyNames.wSessionId.ToString() + "=" + playSessionId;
                    playUrl += "&" + QueryKeyNames.idUser.ToString() + "=" + idUser.ToString();
                    if (link != null)
                    {
                        playUrl += "&" + QueryKeyNames.idLink.ToString() + "=" + link.Id.ToString();
                    }
                    playUrl += "&" + QueryKeyNames.uniqueIdVersion.ToString() + "=" + version.UniqueIdVersion.ToString();
                    if (isOnModal)
                    {
                        View.DisplayClosingToolBar();
                    }
                    break;
                    //case ItemType.ScormPackage:
                    //    Service.ScormAddPendingEvaluation(item, version,UserContext.CurrentUserID, (link==null ? 0 : link.Id));
                    //    if (saveStatistics)
                    //    {
                    //        using (NHibernate.ISession session = View.GetScormSession(player.MappingPath))
                    //        {
                    //            lm.Comol.Modules.ScormStat.Business.ScormService service = new Modules.ScormStat.Business.ScormService(AppContext, session);
                    //            DateTime referenceTime = DateTime.Now;

                    //            lm.Comol.Core.FileRepository.Domain.dtoPackageEvaluation dto = service.EvaluatePackage_NEW(idUser, playSessionId, item.Id, item.UniqueId, version.Id, version.UniqueIdVersion, out referenceTime);

                    //            if (dto != null)
                    //            {
                    //                dto.IdLink = (link == null) ? 0 : link.Id;
                    //                lm.Comol.Core.FileRepository.Domain.ScormPackageUserEvaluation saved = Service.ScormSaveEvaluation(dto, idUser, referenceTime, false, true);
                    //                if (saveCompleteness && saved != null && link != null)
                    //                {
                    //                    if (saved.ModuleCode == View.EduPathModuleCode && link.Id > 0)
                    //                        View.SaveLinkEvaluation(idUser, link.Id, saved);
                    //                }
                    //            }
                    //        }
                    //    }

                    //    playUrl = player.PlayUrl;
                    //    playUrl = playUrl.Replace("#" + PlayerPlaceHolders.idUser.ToString() + "#", idUser.ToString());
                    //    playUrl = playUrl.Replace("#" + PlayerPlaceHolders.courseId.ToString() + "#", version.UniqueIdVersion.ToString().Replace(" ", "%20").Replace("\\", "%2F").Replace("/", "%2F"));
                    //    playUrl = playUrl.Replace("#" + PlayerPlaceHolders.workingSessionId.ToString() + "#", playSessionId);
                    //    playUrl = playUrl.Replace("#" + PlayerPlaceHolders.dbIdentifier.ToString() + "#", player.DBidentifier);

                    //    if (!saveStatistics && !String.IsNullOrEmpty(player.NoSaveStatParameter))
                    //        playUrl += (playUrl.Contains("?") ? "&" : "?") + player.NoSaveStatParameter;
                    //    playUrl +=RootObject.PlayBaseParameters(!saveStatistics, refreshContainer, isOnModal, saveCompleteness);
                    //    playUrl += RootObject.UrlItemParameters(false, version.IdItem, version.Id, (link != null ? link.Id : 0));
                    //    playUrl += RootObject.UrlGuidParameters(version.UniqueIdItem, version.UniqueIdVersion);

                    //    break;
                }
                View.InitializePlayer((isOnModal ? player.ModalPlayerRenderUrl : player.PlayerRenderUrl), playUrl, ajaxActionUrl, item.DisplayName, item.Type);
            }
        }