From 398e7c2bf418112559d6d2db736347817b68db27 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 17 Jan 2018 15:09:58 +0100 Subject: [PATCH] MOBILE-2310 calendar: Use course provider in calendar --- src/addon/calendar/pages/event/event.ts | 8 ++++---- src/addon/calendar/providers/helper.ts | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/addon/calendar/pages/event/event.ts b/src/addon/calendar/pages/event/event.ts index a976a1201..2778df277 100644 --- a/src/addon/calendar/pages/event/event.ts +++ b/src/addon/calendar/pages/event/event.ts @@ -21,7 +21,7 @@ import { CoreCoursesProvider } from '../../../../core/courses/providers/courses' import { CoreDomUtilsProvider } from '../../../../providers/utils/dom'; import { CoreSitesProvider } from '../../../../providers/sites'; import { CoreLocalNotificationsProvider } from '../../../../providers/local-notifications'; -//import { CoreCourseProvider } from '../../../core/course/providers/course'; +import { CoreCourseProvider } from '../../../../core/course/providers/course'; import * as moment from 'moment'; /** @@ -48,7 +48,7 @@ export class AddonCalendarEventPage { constructor(private translate: TranslateService, private calendarProvider: AddonCalendarProvider, private navParams: NavParams, private domUtils: CoreDomUtilsProvider, private coursesProvider: CoreCoursesProvider, private calendarHelper: AddonCalendarHelperProvider, private sitesProvider: CoreSitesProvider, - private localNotificationsProvider: CoreLocalNotificationsProvider/*, private courseProvider: CoreCourseProvider*/) { + private localNotificationsProvider: CoreLocalNotificationsProvider, private courseProvider: CoreCourseProvider) { this.eventId = navParams.get('id'); this.notificationsEnabled = localNotificationsProvider.isAvailable(); @@ -95,8 +95,8 @@ export class AddonCalendarEventPage { // Guess event title. let title = this.translate.instant('addon.calendar.type' + event.eventtype); if (event.moduleIcon) { - // @todo: It's a module event, translate the module name to the current language. - let name = "" //this.courseProvider.translateModuleName(event.modulename); + // It's a module event, translate the module name to the current language. + let name = this.courseProvider.translateModuleName(event.modulename); if (name.indexOf('core.mod_') === -1) { event.moduleName = name; } diff --git a/src/addon/calendar/providers/helper.ts b/src/addon/calendar/providers/helper.ts index 54076fcd7..c0b578986 100644 --- a/src/addon/calendar/providers/helper.ts +++ b/src/addon/calendar/providers/helper.ts @@ -15,7 +15,7 @@ import { Injectable } from '@angular/core'; import { CoreLoggerProvider } from '../../../providers/logger'; import { CoreSitesProvider } from '../../../providers/sites'; -//import { CoreCourseProvider } from '../../../core/course/providers/course'; +import { CoreCourseProvider } from '../../../core/course/providers/course'; /** * Service that provides some features regarding lists of courses and categories. @@ -32,7 +32,7 @@ export class AddonCalendarHelperProvider { 'category': 'albums' }; - constructor(logger: CoreLoggerProvider, private sitesProvider: CoreSitesProvider/*, private courseProvider: CoreCourseProvider*/) { + constructor(logger: CoreLoggerProvider, private sitesProvider: CoreSitesProvider, private courseProvider: CoreCourseProvider) { this.logger = logger.getInstance('AddonCalendarHelperProvider'); } @@ -44,8 +44,7 @@ export class AddonCalendarHelperProvider { formatEventData(e: any) { e.icon = this.EVENTICONS[e.eventtype] || false; if (!e.icon) { - // @todo: It's a module event. - //e.icon = this.courseProvider.getModuleIconSrc(e.modulename); + e.icon = this.courseProvider.getModuleIconSrc(e.modulename); e.moduleIcon = e.icon; } };