MOBILE-2310 calendar: Use course provider in calendar

main
Dani Palou 2018-01-17 15:09:58 +01:00
parent 04085d5929
commit 398e7c2bf4
2 changed files with 7 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;
}
};