2020-12-10 10:45:27 +00:00
|
|
|
// (C) Copyright 2015 Moodle Pty Ltd.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2021-03-09 15:52:56 +00:00
|
|
|
import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
|
|
|
|
import { Routes } from '@angular/router';
|
2022-11-25 22:06:44 +00:00
|
|
|
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
|
2023-01-25 10:08:36 +00:00
|
|
|
import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module';
|
2021-03-09 15:52:56 +00:00
|
|
|
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
|
|
|
|
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
|
|
|
import { CoreUserDelegate } from '@features/user/services/user-delegate';
|
2022-11-25 22:06:44 +00:00
|
|
|
import { AddonCourseCompletionStatusLinkHandler } from './services/handlers/completionstatus-link';
|
2021-03-09 15:52:56 +00:00
|
|
|
import { AddonCourseCompletionCourseOptionHandler } from './services/handlers/course-option';
|
|
|
|
import { AddonCourseCompletionUserHandler } from './services/handlers/user';
|
|
|
|
|
2024-02-28 15:48:05 +00:00
|
|
|
/**
|
|
|
|
* Get course completion services.
|
|
|
|
*
|
|
|
|
* @returns Course completion services.
|
|
|
|
*/
|
|
|
|
export async function getCourseCompletionServices(): Promise<Type<unknown>[]> {
|
|
|
|
const { AddonCourseCompletionProvider } = await import('@addons/coursecompletion/services/coursecompletion');
|
|
|
|
|
|
|
|
return [
|
|
|
|
AddonCourseCompletionProvider,
|
|
|
|
];
|
|
|
|
}
|
2021-03-09 15:52:56 +00:00
|
|
|
|
|
|
|
const routes: Routes = [
|
|
|
|
{
|
|
|
|
path: 'coursecompletion',
|
2024-10-29 10:25:35 +00:00
|
|
|
loadChildren: () => import('./coursecompletion-lazy.module'),
|
2021-03-09 15:52:56 +00:00
|
|
|
},
|
|
|
|
];
|
2020-12-10 10:45:27 +00:00
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [
|
2021-03-09 15:52:56 +00:00
|
|
|
CoreMainMenuTabRoutingModule.forChild(routes),
|
|
|
|
CoreCourseIndexRoutingModule.forChild({ children: routes }),
|
2020-12-10 10:45:27 +00:00
|
|
|
],
|
|
|
|
providers: [
|
2021-03-09 15:52:56 +00:00
|
|
|
{
|
|
|
|
provide: APP_INITIALIZER,
|
|
|
|
multi: true,
|
2021-08-12 12:03:13 +00:00
|
|
|
useValue: () => {
|
2021-03-09 15:52:56 +00:00
|
|
|
CoreUserDelegate.registerHandler(AddonCourseCompletionUserHandler.instance);
|
|
|
|
CoreCourseOptionsDelegate.registerHandler(AddonCourseCompletionCourseOptionHandler.instance);
|
2022-11-25 22:06:44 +00:00
|
|
|
CoreContentLinksDelegate.registerHandler(AddonCourseCompletionStatusLinkHandler.instance);
|
2021-03-09 15:52:56 +00:00
|
|
|
},
|
|
|
|
},
|
2020-12-10 10:45:27 +00:00
|
|
|
],
|
|
|
|
})
|
2021-03-09 15:52:56 +00:00
|
|
|
export class AddonCourseCompletionModule {}
|