/// <summary>
        /// Getting Header navigation menu along with logo details for the header
        /// </summary>
        /// <returns>Header details</returns>
        public IHeaderViewModel GetHeader()
        {
            IMvcContext mvcContext = _mvcContext();
            //Checking the current item is the home item to display the Header based on this
            IHome contextItem = mvcContext.GetContextItem <IHome>();

            _headerViewModel.SiteRoot = mvcContext.GetRootItem <ISiteRoot>();
            if (contextItem.TemplateId.ToString().Equals(SitecoreSettings.HomeTemplateID, StringComparison.InvariantCultureIgnoreCase))
            {
                _headerViewModel.SearchIcon = _sitecoreHelper.HomePageSearch;
                _headerViewModel.CloseIcon  = _sitecoreHelper.HomePageClose;
                _headerViewModel.HeaderCss  = CommonConstants.HomePageHeaderCss;
                _headerViewModel.IsHomePage = true;
            }
            else
            {
                _headerViewModel.SearchIcon = _sitecoreHelper.ContentPageSearch;
                _headerViewModel.CloseIcon  = _sitecoreHelper.ContentPageClose;
                _headerViewModel.HeaderCss  = CommonConstants.ContentPageHeaderCss;
                _headerViewModel.IsHomePage = false;
            }
            if (contextItem.TemplateId.ToString().Equals(SitecoreSettings.SearchPageTemplateID, StringComparison.InvariantCultureIgnoreCase))
            {
                _headerViewModel.IsSearchPage = true;
            }
            else
            {
                _headerViewModel.IsSearchPage = false;
            }
            _headerViewModel.Header = _sitecoreHelper.NavigationHeader;

            return(_headerViewModel);
        }
Пример #2
0
        /// <summary>
        /// Method to get image gallery
        /// </summary>
        /// <returns>IImage_Gallery_Page<ListingSearchResultItem> </returns>
        public IImage_Gallery_Page GetImageGallery()
        {
            IMvcContext         mvcContext   = _mvcContext();
            IImage_Gallery_Page imageGallery = mvcContext.GetContextItem <IImage_Gallery_Page>();

            return(imageGallery ?? _imageGallery);
        }
Пример #3
0
        public ActionResult Index(Data data)
        {
            try
            {
                var model = new ResponseItem();
                if (!string.IsNullOrEmpty(data.SearchTerm))
                {
                    var bookitems = Solr.SolrHelper.GetBookResults(data.SearchTerm, _context, _sitecoreRequestContext);
                    var pageItems = Solr.SolrHelper.GetPageResults(data.SearchTerm, _context, _sitecoreRequestContext);
                    if (bookitems.Any())
                    {
                        model.Books = bookitems;
                    }
                    if (pageItems.Any())
                    {
                        model.Pages = pageItems;
                    }
                    return(View(model));
                }
                else
                {
                    model.Message = _context.GetContextItem <Foundation.Orm.Models.sitecore.templates.User_Defined.Base.IBasePage>().Message;
                    return(View(model));
                }
            }
            catch (System.NotSupportedException ex)
            {
                Sitecore.Diagnostics.Log.Error("There was an issue with Solr or your Response item + ", ex);
            }

            return(null);
        }
Пример #4
0
        public override LayoutModel InitialiseViewModel(Rendering rendering, IMvcContext mvcContext)
        {
            var viewModel = mvcContext.GetContextItem <LayoutModel>();

            viewModel.SiteRoot = mvcContext.GetRootItem <SiteRoot>();
            return(viewModel);
        }
Пример #5
0
        // GET: Book
        public ActionResult Index()
        {
            #region
            ////Summary Field
            /////Book Item
            ///BookModel model = new BookModel();
            //model.BookItem = Sitecore.Context.Item;
            //Field summaryField = Sitecore.Context.Item.Fields[BookTemplate.Book.Fields.Summary];
            //model.Summary =
            //    new MvcHtmlString(Sitecore.Web.UI.WebControls.FieldRenderer.Render(Sitecore.Context.Item, "Summary"));

            ////Author Field
            //MultilistField authorField = Sitecore.Context.Item.Fields[BookTemplate.Book.Fields.Author];
            //if (authorField?.Count > 0)
            //{
            //    model.Authors = authorField.GetItems().ToList();
            //}

            ////Book Type Field
            //ReferenceField bookTypeField = Sitecore.Context.Item.Fields[BookTemplate.Book.Fields.BookType];
            //if (bookTypeField != null && !string.IsNullOrWhiteSpace(bookTypeField.Value))
            //{
            //    model.BookType = bookTypeField.TargetItem;
            //}


            ////Language Field
            //Field laguageField = Sitecore.Context.Item.Fields[BookTemplate.Book.Fields.BookLanguage];
            //model.BookLanguage = laguageField.Value;
            #endregion
            return(View(_mvcContext.GetContextItem <IBook>()));
        }
Пример #6
0
        public IVideo_Gallery_Page GetVideoGalleryModel()
        {
            IMvcContext         mvcContext   = _mvcContext();
            IVideo_Gallery_Page VideoGallery = mvcContext.GetContextItem <IVideo_Gallery_Page>();

            return(VideoGallery ?? _videoGallery);
        }
Пример #7
0
        /// <summary>
        /// Method to get image album
        /// </summary>
        /// <returns>IImage_Album<ListingSearchResultItem></returns>
        public IImage_Album GetImageAlbum()
        {
            IMvcContext  mvcContext = _mvcContext();
            IImage_Album imageAlbum = mvcContext.GetContextItem <IImage_Album>();

            return(imageAlbum ?? _imageAlbum);
        }
Пример #8
0
        /// <summary>
        /// Method to get news model
        /// </summary>
        /// <returns>INews_Listing_Page<ListingSearchResultItem> </returns>
        public INews_Listing_Page GetNewsListingPageModel()
        {
            IMvcContext        mvcContext = _mvcContext();
            INews_Listing_Page newsModel  = mvcContext.GetContextItem <INews_Listing_Page>();

            return(newsModel ?? _newsModel);
        }
Пример #9
0
        /// <summary>
        /// Method to get downloads model
        /// </summary>
        /// <returns>IDownloads_Page<ListingSearchResultItem> </returns>
        public IDownloads_Page GetDownloadsListingPageModel()
        {
            IMvcContext     mvcContext     = _mvcContext();
            IDownloads_Page downloadsModel = mvcContext.GetContextItem <IDownloads_Page>();

            return(downloadsModel ?? _downloadsModel);
        }
Пример #10
0
        /// <summary>
        /// Method to get search model
        /// </summary>
        /// <returns>ISearchPage<ListingSearchResultItem> </returns>
        public ISearchPage GetSearchPageModel()
        {
            IMvcContext mvcContext      = _mvcContext();
            ISearchPage searchPageModel = mvcContext.GetContextItem <ISearchPage>();

            return(searchPageModel ?? _searchPageModel);
        }
Пример #11
0
        public IVideo_Album_Without_Filters GetVideoAlbumsModel(out bool ShowFilters)
        {
            IMvcContext mvcContext = _mvcContext();
            IVideo_Album_Without_Filters VideoAlbum = mvcContext.GetContextItem <IVideo_Album_Without_Filters>();

            ShowFilters = mvcContext.GetRenderingParameters <IShowfilters>().Show_Filters;
            return(VideoAlbum ?? _videoAlbum);
        }
Пример #12
0
        /// <summary>
        /// Getting page metadata
        /// </summary>
        /// <returns>Metadata/OG/Twitter,Canonical and hreflang</returns>
        public ISeoViewModel GetSeo()
        {
            IMvcContext mvcContext = _mvcContext();

            _seoViewModel.Pagebase = mvcContext.GetContextItem <I_PageBase>();
            _seoViewModel.SiteRoot = mvcContext.GetRootItem <ISiteRoot>();
            return(_seoViewModel);
        }
Пример #13
0
        public T GetCurrentItem <T>(IMvcContext context = null) where T : class
        {
            if (context == null)
            {
                context = _currentContext;
            }

            return(context.GetContextItem <T>());
        }
Пример #14
0
        /// <summary>
        /// Method to get Events model
        /// </summary>
        /// <returns>IEvents_Listing_Page<ListingSearchResultItem> </returns>
        public IEvents_Listing_Page GetEventsListingPageModel(out string Year)
        {
            Year = string.Empty;
            IMvcContext          mvcContext  = _mvcContext();
            IEvents_Listing_Page eventsModel = mvcContext.GetContextItem <IEvents_Listing_Page>();

            if (mvcContext.ContextItem.TemplateID.Equals(ID.Parse(CommonConstants.EventsYearFolderTemplateID)))
            {
                Year = mvcContext.ContextItem.Name;
            }
            return(eventsModel ?? _eventsModel);
        }
Пример #15
0
        public ActionResult RegisterForm()
        {
            _logger.Debug($"{nameof(RegisterForm)} has been called.");

            var model = new RegistrationPageViewModel
            {
                RegistrationPage = _mvcContext.GetContextItem <IRegistrationPage>(),
                AssetsService    = _assetsService,
                DataSourceId     = _mvcContext.GetDataSourceItem <IEmail>()?.Id ?? Guid.Empty
            };

            return(ExecuteSafe(() => View(model)));
        }
        /// <summary>
        /// Getting left navigation menu from Sitecore content tree based on context item's parent with its childs
        /// Also displays only the items which has the options "Include in Left navigation" selected in sitecore
        /// </summary>
        /// <returns>Left navigation</returns>
        public ILeftNavigation GetLeftNavigation()
        {
            IMvcContext mvcContext = _mvcContext();
            INavigable  rootItem   = mvcContext.GetContextItem <INavigable>();

            //Setting default to context item
            _leftNavigation.ParentNavigationItem  = rootItem;
            _leftNavigation.CurrentNavigationItem = rootItem;
            //Getting current item is Mediacenter based on its template id
            System.Collections.Generic.IEnumerable <Item> mediaCenter = rootItem.ContextItem.Axes.GetAncestors().Where(p => ID.Parse(p.TemplateID.ToGuid()).Equals(ID.Parse(SitecoreSettings.MediaCenterTemplateID)));
            if (mediaCenter.Any())
            {
                //If context item is child of media center item template then have parent has Mediacenter
                _leftNavigation.ParentNavigationItem = mvcContext.SitecoreService.GetItem <INavigable>(mediaCenter.FirstOrDefault().ID.ToGuid());
                //All nested childs will always have CurrentItemNavigation has its Mediacenter immediate child from where its(context item) comes from.
                IEnumerable <Item> currentItem = mediaCenter.FirstOrDefault().Children.Where(p => rootItem.ContextItem.Paths.LongID.Contains(p.ID.ToString())).Select(p => p);
                if (currentItem.Any())
                {
                    _leftNavigation.CurrentNavigationItem = _mvcContext()?.SitecoreService.GetItem <INavigable>(currentItem.FirstOrDefault().ID.ToGuid());
                }
            }
            else
            {
                //Setting Current navigation item to context item
                _leftNavigation.CurrentNavigationItem = rootItem;
            }
            //Getting Parent item based on the following templates (Mediacenter,Generic contentpage and contentpage)
            switch (rootItem)
            {
            case var template when ID.Parse(rootItem.TemplateId).Equals(ID.Parse(SitecoreSettings.MediaCenterTemplateID)):
                _leftNavigation.ParentNavigationItem = _mvcContext()?.SitecoreService.GetItem <INavigable>(rootItem.Id);

                break;

            case var template when rootItem.BaseTemplateId.AsEnumerable().Any(p => p.Equals(SitecoreSettings.GenericContentPageTemplateID)) ||
                ID.Parse(rootItem.TemplateId).Equals(ID.Parse(SitecoreSettings.GenericContentPageTemplateID)):
                _leftNavigation.ParentNavigationItem = _mvcContext()?.SitecoreService.GetItem <INavigable>(rootItem.Parent.Id);

                break;

            case var template when rootItem.BaseTemplateId.AsEnumerable().Any(p => p.Equals(SitecoreSettings.GenericContentRootPageTemplateID)) ||
                ID.Parse(rootItem.TemplateId).Equals(ID.Parse(SitecoreSettings.GenericContentRootPageTemplateID)):
                _leftNavigation.ParentNavigationItem = rootItem;

                break;

            default:
                break;
            }
            return(_leftNavigation);
        }
Пример #17
0
        /// <summary>
        /// Getting Content Page details
        /// </summary>
        /// <returns>Content page </returns>
        public IGeneric_ContentPage GetGenericContentPage(out string date)
        {
            IMvcContext mvcContext = _mvcContext();

            date = String.Empty;
            if (mvcContext.ContextItem.TemplateID.Equals(ID.Parse(SitecoreSettings.NewsPageTemplateID)) ||
                mvcContext.ContextItem.TemplateID.Equals(ID.Parse(SitecoreSettings.EventsPageTemplateID)))
            {
                DateField dt = mvcContext.ContextItem.Fields["Date"];
                date = Sitecore.DateUtil.FormatDateTime(dt.DateTime, EMAAR.Emaarcommunities.Foundation.SitecoreExtensions.Settings.SitecoreSettings.DateFormat, mvcContext.ContextItem.Language.CultureInfo);
            }
            IGeneric_ContentPage generic = mvcContext.GetContextItem <IGeneric_ContentPage>();

            return(generic ?? _generic);
        }
Пример #18
0
        /// <summary>
        /// Getting all amenities  when adding as rendering component
        /// </summary>
        /// <returns>Amenities</returns>
        public IAmenities GetAmenities()
        {
            IMvcContext mvcContext = _mvcContext();
            IAmenities  amenities  = mvcContext.GetDataSourceItem <IAmenities>();

            _amenities.Page_Amenities = null;
            //First check the datasource item if empty then get the details from context template item
            if (amenities == null)
            {
                IGeneric_ContentPage generic_ContentPage = mvcContext.GetContextItem <IGeneric_ContentPage>();
                if (generic_ContentPage?.Amenities?.Count() > 0)
                {
                    _amenities.Page_Amenities = generic_ContentPage.Amenities;
                }
            }
            return(amenities?.Page_Amenities != null ? amenities : _amenities);
        }
Пример #19
0
        /// <summary>
        /// Getting all Faqs  when adding as rendering component
        /// </summary>
        /// <returns>Faqs</returns>
        public IFaqs GetFaqs()
        {
            IMvcContext mvcContext = _mvcContext();
            IFaqs       faqs       = mvcContext.GetDataSourceItem <IFaqs>();

            _faqs.Page_Faqs = null;
            //First check the datasource item if empty then get the details from context template item
            if (faqs == null)
            {
                IGeneric_ContentPage generic_ContentPage = mvcContext.GetContextItem <IGeneric_ContentPage>();
                if (generic_ContentPage?.Faqs?.Count() > 0)
                {
                    _faqs.Page_Faqs = generic_ContentPage.Faqs;
                }
            }
            return(faqs?.Page_Faqs != null ? faqs : _faqs);
        }
Пример #20
0
        ///// <summary>
        ///// Getting all Related pages component asigned in Sitecore   when adding as rendering component
        ///// </summary>
        ///// <returns>Related Pages details</returns>
        public IRelated_Pages RelatedPages()
        {
            IRelated_Pages related_Pages = null;
            IMvcContext    mvcContext    = _mvcContext();

            _related_Pages.Pages = null;
            //First check the datasource item if empty then get the details from context template item
            related_Pages = mvcContext.GetDataSourceItem <IRelated_Pages>();
            if (related_Pages == null)
            {
                IGeneric_ContentPage generic_ContentPage = mvcContext.GetContextItem <IGeneric_ContentPage>();
                if (generic_ContentPage?.Related_Pages?.Count() > 0)
                {
                    _related_Pages.Pages = generic_ContentPage.Related_Pages;
                }
            }
            return(related_Pages?.Pages != null ? related_Pages : _related_Pages);
        }
        public ActionResult About()
        {
            var dataSource = _mvcContext.GetContextItem <PageModel>();

            return(View("~/Areas/basic/Views/Home/About.cshtml", dataSource));
        }
        /// <summary>
        /// This is used to get the Media page with all necessary components(Top 3 News,Events,Downloads,I,age Gallery and Video gallery)
        /// </summary>
        /// <returns>Mediacenter page</returns>
        public IMediacenterViewmodel GetMediacenterPage()
        {
            IMvcContext  mvcContext  = _mvcContext();
            IMediacenter mediacenter = mvcContext.GetContextItem <IMediacenter>();

            _mediacenterViewmodel.Mediacenter                  = mediacenter;
            _mediacenterViewmodel.ImageGalleryItem             = _sitecoreHelper.ImageGalleryItem;
            _mediacenterViewmodel.ImageAlbumItem               = _sitecoreHelper.ImageAlbumItem;
            _mediacenterViewmodel.VideoGalleryItem             = _sitecoreHelper.VideoGalleryItem;
            _mediacenterViewmodel.VideoAlbumWithoutFiltersItem = _sitecoreHelper.VideoAlbumWithoutFilterItem;
            _mediacenterViewmodel.VideoAlbumWithFiltersItem    = _sitecoreHelper.VideoAlbumWithFilterItem;
            _mediacenterViewmodel.VideoItem             = _sitecoreHelper.VideoItem;
            _mediacenterViewmodel.NewsListingPageItem   = _sitecoreHelper.NewsListingPageItem;
            _mediacenterViewmodel.DownloadPageItem      = _sitecoreHelper.DownloadPageItem;
            _mediacenterViewmodel.EventsListingPageItem = _sitecoreHelper.EventsListingPageItem;

            if (_sitecoreHelper.ImageGalleryItem != null)
            {
                //Getting Image Albums from Image Gallery in Media Center
                _mediacenterViewmodel.IsImageAlbum    = false;
                _mediacenterViewmodel.ImageAlbumItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.ImageGalleryItem.ID.ToGuid().ToString(), CommonConstants.ImageAlbumPageTemplateID, false);
            }
            else if (_sitecoreHelper.ImageAlbumItem != null)
            {
                //Getting Image Items from Image Albums in Media Center
                _mediacenterViewmodel.IsImageAlbum    = true;
                _mediacenterViewmodel.ImageAlbumItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.ImageAlbumItem.ID.ToGuid().ToString(), CommonConstants.ImageItemTemplateID, false);
                //Setting this to get the gallery page url for "ViewAll"(If image gallery page missing)
                _mediacenterViewmodel.ImageGalleryItem = _sitecoreHelper.ImageAlbumItem;
            }
            if (_sitecoreHelper.VideoGalleryItem != null)
            {
                //Getting Video Albums from Video Gallery in Media Center
                _mediacenterViewmodel.IsVideoAlbum    = false;
                _mediacenterViewmodel.VideoAlbumItem  = _sitecoreHelper.VideoAlbumWithoutFilterItem != null? _sitecoreHelper.VideoAlbumWithoutFilterItem: _sitecoreHelper.VideoAlbumWithFilterItem;
                _mediacenterViewmodel.VideoAlbumItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.VideoGalleryItem.ID.ToGuid().ToString(), CommonConstants.VideoAlbumWithoutFiltersTemplateID, false);
            }
            else if (_sitecoreHelper.VideoAlbumWithoutFilterItem != null)
            {
                //Getting Video Items from Video Albums without Filter template items in Media Center
                _mediacenterViewmodel.VideoAlbumItem  = _sitecoreHelper.VideoAlbumWithoutFilterItem;
                _mediacenterViewmodel.IsVideoAlbum    = true;
                _mediacenterViewmodel.VideoAlbumItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.VideoAlbumWithoutFilterItem.ID.ToGuid().ToString(), CommonConstants.VideoItemTemplateID, false);
                //Setting this to get the gallery page url for "ViewAll"(If Video gallery page missing)
                _mediacenterViewmodel.VideoGalleryItem = _sitecoreHelper.VideoAlbumWithoutFilterItem;
            }
            else if (_sitecoreHelper.VideoAlbumWithFilterItem != null)
            {
                //Getting Video Items from Video Albums with Filter Template items in Media Center
                _mediacenterViewmodel.VideoAlbumItem  = _sitecoreHelper.VideoAlbumWithFilterItem;
                _mediacenterViewmodel.IsVideoAlbum    = true;
                _mediacenterViewmodel.VideoAlbumItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.VideoAlbumWithFilterItem.ID.ToGuid().ToString(), CommonConstants.VideoItemTemplateID, false);
                //Setting this to get the gallery page url for "ViewAll"(If Video gallery page missing)
                _mediacenterViewmodel.VideoGalleryItem = _sitecoreHelper.VideoAlbumWithFilterItem;
            }

            if (_sitecoreHelper.NewsListingPageItem != null)
            {
                //Getting News from Media Center
                _mediacenterViewmodel.NewsItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.NewsListingPageItem.ID.ToGuid().ToString(), CommonConstants.NewsTemplateID, false);
            }

            if (_sitecoreHelper.DownloadPageItem != null)
            {
                //Getting Downloads from Media Center
                _mediacenterViewmodel.DownloadsItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.DownloadPageItem.ID.ToGuid().ToString(), CommonConstants.DownloadItemTemplateID, false);
            }

            if (_sitecoreHelper.EventsListingPageItem != null)
            {
                //Getting Events from Media Center
                _mediacenterViewmodel.EventsItems = _listingRepository.GetListingModel(0, 3, null, _sitecoreHelper.EventsListingPageItem.ID.ToGuid().ToString(), CommonConstants.EventsTemplateID, false);
            }

            return(_mediacenterViewmodel);
        }
        public ActionResult Detail()
        {
            var vm = _sitecoreService.GetContextItem <ICorePage>();

            return(PartialView(vm));
        }