MOBILE-2310 calendar: Use course provider in calendar
parent
04085d5929
commit
398e7c2bf4
|
@ -21,7 +21,7 @@ import { CoreCoursesProvider } from '../../../../core/courses/providers/courses'
|
||||||
import { CoreDomUtilsProvider } from '../../../../providers/utils/dom';
|
import { CoreDomUtilsProvider } from '../../../../providers/utils/dom';
|
||||||
import { CoreSitesProvider } from '../../../../providers/sites';
|
import { CoreSitesProvider } from '../../../../providers/sites';
|
||||||
import { CoreLocalNotificationsProvider } from '../../../../providers/local-notifications';
|
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';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ export class AddonCalendarEventPage {
|
||||||
constructor(private translate: TranslateService, private calendarProvider: AddonCalendarProvider, private navParams: NavParams,
|
constructor(private translate: TranslateService, private calendarProvider: AddonCalendarProvider, private navParams: NavParams,
|
||||||
private domUtils: CoreDomUtilsProvider, private coursesProvider: CoreCoursesProvider,
|
private domUtils: CoreDomUtilsProvider, private coursesProvider: CoreCoursesProvider,
|
||||||
private calendarHelper: AddonCalendarHelperProvider, private sitesProvider: CoreSitesProvider,
|
private calendarHelper: AddonCalendarHelperProvider, private sitesProvider: CoreSitesProvider,
|
||||||
private localNotificationsProvider: CoreLocalNotificationsProvider/*, private courseProvider: CoreCourseProvider*/) {
|
private localNotificationsProvider: CoreLocalNotificationsProvider, private courseProvider: CoreCourseProvider) {
|
||||||
|
|
||||||
this.eventId = navParams.get('id');
|
this.eventId = navParams.get('id');
|
||||||
this.notificationsEnabled = localNotificationsProvider.isAvailable();
|
this.notificationsEnabled = localNotificationsProvider.isAvailable();
|
||||||
|
@ -95,8 +95,8 @@ export class AddonCalendarEventPage {
|
||||||
// Guess event title.
|
// Guess event title.
|
||||||
let title = this.translate.instant('addon.calendar.type' + event.eventtype);
|
let title = this.translate.instant('addon.calendar.type' + event.eventtype);
|
||||||
if (event.moduleIcon) {
|
if (event.moduleIcon) {
|
||||||
// @todo: It's a module event, translate the module name to the current language.
|
// It's a module event, translate the module name to the current language.
|
||||||
let name = "" //this.courseProvider.translateModuleName(event.modulename);
|
let name = this.courseProvider.translateModuleName(event.modulename);
|
||||||
if (name.indexOf('core.mod_') === -1) {
|
if (name.indexOf('core.mod_') === -1) {
|
||||||
event.moduleName = name;
|
event.moduleName = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreLoggerProvider } from '../../../providers/logger';
|
import { CoreLoggerProvider } from '../../../providers/logger';
|
||||||
import { CoreSitesProvider } from '../../../providers/sites';
|
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.
|
* Service that provides some features regarding lists of courses and categories.
|
||||||
|
@ -32,7 +32,7 @@ export class AddonCalendarHelperProvider {
|
||||||
'category': 'albums'
|
'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');
|
this.logger = logger.getInstance('AddonCalendarHelperProvider');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,7 @@ export class AddonCalendarHelperProvider {
|
||||||
formatEventData(e: any) {
|
formatEventData(e: any) {
|
||||||
e.icon = this.EVENTICONS[e.eventtype] || false;
|
e.icon = this.EVENTICONS[e.eventtype] || false;
|
||||||
if (!e.icon) {
|
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;
|
e.moduleIcon = e.icon;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue