MOBILE-3934 competency: Refactor routes
parent
ee8c9de101
commit
c549e733fb
|
@ -17,7 +17,7 @@ import { CoreBlockHandlerData } from '@features/block/services/block-delegate';
|
||||||
import { CoreBlockOnlyTitleComponent } from '@features/block/components/only-title-block/only-title-block';
|
import { CoreBlockOnlyTitleComponent } from '@features/block/components/only-title-block/only-title-block';
|
||||||
import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler';
|
import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block handler.
|
* Block handler.
|
||||||
|
@ -38,7 +38,7 @@ export class AddonBlockLearningPlansHandlerService extends CoreBlockBaseHandler
|
||||||
title: 'addon.block_learningplans.pluginname',
|
title: 'addon.block_learningplans.pluginname',
|
||||||
class: 'addon-block-learning-plans',
|
class: 'addon-block-learning-plans',
|
||||||
component: CoreBlockOnlyTitleComponent,
|
component: CoreBlockOnlyTitleComponent,
|
||||||
link: ADDON_COMPETENCY_MAIN_PAGE_NAME,
|
link: ADDON_COMPETENCY_LEARNING_PLANS_PAGE,
|
||||||
navOptions: {
|
navOptions: {
|
||||||
preferCurrentTab: false,
|
preferCurrentTab: false,
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { AddonCompetencyCourseCompetenciesPageModule } from './pages/coursecompetencies/coursecompetencies.module';
|
|
||||||
import { AddonCompetencyCourseCompetenciesPage } from './pages/coursecompetencies/coursecompetencies.page';
|
import { AddonCompetencyCourseCompetenciesPage } from './pages/coursecompetencies/coursecompetencies.page';
|
||||||
|
import { AddonCompetencyCourseCompetenciesPageModule } from './pages/coursecompetencies/coursecompetencies.module';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -31,4 +31,4 @@ const routes: Routes = [
|
||||||
AddonCompetencyCourseCompetenciesPageModule,
|
AddonCompetencyCourseCompetenciesPageModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AddonCompetencyCourseLazyModule {}
|
export class AddonCompetencyCourseContentsLazyModule {}
|
|
@ -0,0 +1,72 @@
|
||||||
|
// (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.
|
||||||
|
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
|
import { AddonCompetencyCompetencyPage } from './pages/competency/competency.page';
|
||||||
|
import { AddonCompetencyCompetencySummaryPage } from './pages/competencysummary/competencysummary.page';
|
||||||
|
import { ADDON_COMPETENCY_SUMMARY_PAGE } from './competency.module';
|
||||||
|
import { AddonCompetencyCompetencyPageModule } from './pages/competency/competency.module';
|
||||||
|
import { AddonCompetencyCompetencySummaryPageModule } from './pages/competencysummary/competencysummary.module';
|
||||||
|
import { AddonCompetencyCourseCompetenciesPage } from './pages/coursecompetencies/coursecompetencies.page';
|
||||||
|
import { AddonCompetencyCourseCompetenciesPageModule } from './pages/coursecompetencies/coursecompetencies.module';
|
||||||
|
import { AddonCompetencyCompetenciesPage } from './pages/competencies/competencies.page';
|
||||||
|
import { conditionalRoutes } from '@/app/app-routing.module';
|
||||||
|
import { CoreScreen } from '@services/screen';
|
||||||
|
import { AddonCompetencyCompetenciesPageModule } from './pages/competencies/competencies.module';
|
||||||
|
|
||||||
|
const mobileRoutes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: AddonCompetencyCourseCompetenciesPage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':competencyId',
|
||||||
|
component: AddonCompetencyCompetencyPage,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const tabletRoutes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: AddonCompetencyCompetenciesPage,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: ':competencyId',
|
||||||
|
component: AddonCompetencyCompetencyPage,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
|
||||||
|
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
|
||||||
|
{
|
||||||
|
path: `:competencyId/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
|
||||||
|
component: AddonCompetencyCompetencySummaryPage,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
RouterModule.forChild(routes),
|
||||||
|
AddonCompetencyCourseCompetenciesPageModule,
|
||||||
|
AddonCompetencyCompetenciesPageModule,
|
||||||
|
AddonCompetencyCompetencyPageModule,
|
||||||
|
AddonCompetencyCompetencySummaryPageModule,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class AddonCompetencyCourseDetailsLazyModule {}
|
|
@ -20,11 +20,13 @@ import { CoreScreen } from '@services/screen';
|
||||||
import { CoreSharedModule } from '@/core/shared.module';
|
import { CoreSharedModule } from '@/core/shared.module';
|
||||||
import { AddonCompetencyPlanPage } from './pages/plan/plan';
|
import { AddonCompetencyPlanPage } from './pages/plan/plan';
|
||||||
import { AddonCompetencyPlanListPage } from './pages/planlist/planlist';
|
import { AddonCompetencyPlanListPage } from './pages/planlist/planlist';
|
||||||
import { AddonCompetencyCompetenciesPage } from './pages/competencies/competencies';
|
import { AddonCompetencyCompetencyPage } from './pages/competency/competency.page';
|
||||||
import { AddonCompetencyCompetencyPage } from './pages/competency/competency';
|
import { AddonCompetencyCompetencySummaryPage } from './pages/competencysummary/competencysummary.page';
|
||||||
import { AddonCompetencyCompetencySummaryPage } from './pages/competencysummary/competencysummary';
|
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_SUMMARY_PAGE } from './competency.module';
|
||||||
import { AddonCompetencyCourseCompetenciesPage } from './pages/coursecompetencies/coursecompetencies.page';
|
import { AddonCompetencyCompetencyPageModule } from './pages/competency/competency.module';
|
||||||
import { AddonCompetencyCourseCompetenciesPageModule } from './pages/coursecompetencies/coursecompetencies.module';
|
import { AddonCompetencyCompetencySummaryPageModule } from './pages/competencysummary/competencysummary.module';
|
||||||
|
import { AddonCompetencyCompetenciesPage } from './pages/competencies/competencies.page';
|
||||||
|
import { AddonCompetencyCompetenciesPageModule } from './pages/competencies/competencies.module';
|
||||||
|
|
||||||
const mobileRoutes: Routes = [
|
const mobileRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -33,34 +35,28 @@ const mobileRoutes: Routes = [
|
||||||
component: AddonCompetencyPlanListPage,
|
component: AddonCompetencyPlanListPage,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'competencies',
|
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
|
||||||
component: AddonCompetencyCompetenciesPage,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'competencies/:competencyId',
|
|
||||||
component: AddonCompetencyCompetencyPage,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'course/:courseId',
|
|
||||||
component: AddonCompetencyCourseCompetenciesPage,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'summary/:competencyId',
|
|
||||||
component: AddonCompetencyCompetencySummaryPage,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ':planId',
|
|
||||||
component: AddonCompetencyPlanPage,
|
component: AddonCompetencyPlanPage,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}/:competencyId`,
|
||||||
|
component: AddonCompetencyCompetencyPage,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const tabletRoutes: Routes = [
|
const tabletRoutes: Routes = [
|
||||||
{
|
{
|
||||||
path: 'summary/:competencyId',
|
path: '',
|
||||||
component: AddonCompetencyCompetencySummaryPage,
|
component: AddonCompetencyPlanListPage,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
|
||||||
|
component: AddonCompetencyPlanPage,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'competencies',
|
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
|
||||||
component: AddonCompetencyCompetenciesPage,
|
component: AddonCompetencyCompetenciesPage,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -69,40 +65,28 @@ const tabletRoutes: Routes = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'course/:courseId',
|
|
||||||
component: AddonCompetencyCourseCompetenciesPage,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: AddonCompetencyPlanListPage,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: ':planId',
|
|
||||||
component: AddonCompetencyPlanPage,
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
|
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
|
||||||
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
|
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
|
||||||
|
{
|
||||||
|
path: `:planId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}/:competencyId/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
|
||||||
|
component: AddonCompetencyCompetencySummaryPage,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forChild(routes),
|
RouterModule.forChild(routes),
|
||||||
CoreSharedModule,
|
CoreSharedModule,
|
||||||
AddonCompetencyCourseCompetenciesPageModule,
|
AddonCompetencyCompetenciesPageModule,
|
||||||
|
AddonCompetencyCompetencyPageModule,
|
||||||
|
AddonCompetencyCompetencySummaryPageModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AddonCompetencyPlanPage,
|
AddonCompetencyPlanPage,
|
||||||
AddonCompetencyPlanListPage,
|
AddonCompetencyPlanListPage,
|
||||||
AddonCompetencyCompetenciesPage,
|
|
||||||
AddonCompetencyCompetencyPage,
|
|
||||||
AddonCompetencyCompetencySummaryPage,
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AddonCompetencyLazyModule {}
|
export class AddonCompetencyLearningPlansLazyModule {}
|
|
@ -30,6 +30,8 @@ import { Routes } from '@angular/router';
|
||||||
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
|
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
|
||||||
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||||
import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module';
|
import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module';
|
||||||
|
import { COURSE_PAGE_NAME } from '@features/course/course.module';
|
||||||
|
import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module';
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const ADDON_COMPETENCY_SERVICES: Type<unknown>[] = [
|
export const ADDON_COMPETENCY_SERVICES: Type<unknown>[] = [
|
||||||
|
@ -37,19 +39,29 @@ export const ADDON_COMPETENCY_SERVICES: Type<unknown>[] = [
|
||||||
AddonCompetencyHelperProvider,
|
AddonCompetencyHelperProvider,
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ADDON_COMPETENCY_MAIN_PAGE_NAME = 'competency';
|
export const ADDON_COMPETENCY_LEARNING_PLANS_PAGE = 'learning-plans';
|
||||||
|
export const ADDON_COMPETENCY_COMPETENCIES_PAGE = 'competencies';
|
||||||
|
export const ADDON_COMPETENCY_SUMMARY_PAGE = 'summary';
|
||||||
|
|
||||||
const mainMenuChildrenRoutes: Routes = [
|
const mainMenuChildrenRoutes: Routes = [
|
||||||
{
|
{
|
||||||
path: ADDON_COMPETENCY_MAIN_PAGE_NAME,
|
path: ADDON_COMPETENCY_LEARNING_PLANS_PAGE,
|
||||||
loadChildren: () => import('./competency-lazy.module').then(m => m.AddonCompetencyLazyModule),
|
loadChildren: () => import('./competency-learning-plans-lazy.module').then(m => m.AddonCompetencyLearningPlansLazyModule),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: `${COURSE_PAGE_NAME}/:courseId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
|
||||||
|
loadChildren: () => import('./competency-course-details-lazy.module').then(m => m.AddonCompetencyCourseDetailsLazyModule),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: `${COURSE_PAGE_NAME}/:courseId/${PARTICIPANTS_PAGE_NAME}/:userId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
|
||||||
|
loadChildren: () => import('./competency-course-details-lazy.module').then(m => m.AddonCompetencyCourseDetailsLazyModule),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const courseIndexRoutes: Routes = [
|
const courseIndexRoutes: Routes = [
|
||||||
{
|
{
|
||||||
path: ADDON_COMPETENCY_MAIN_PAGE_NAME,
|
path: ADDON_COMPETENCY_COMPETENCIES_PAGE,
|
||||||
loadChildren: () => import('@addons/competency/competency-course-lazy.module').then(m => m.AddonCompetencyCourseLazyModule),
|
loadChildren: () => import('./competency-course-contents-lazy.module').then(m => m.AddonCompetencyCourseContentsLazyModule),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// (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.
|
||||||
|
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { CoreSharedModule } from '@/core/shared.module';
|
||||||
|
import { AddonCompetencyCompetenciesPage } from './competencies.page';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CoreSharedModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AddonCompetencyCompetenciesPage,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class AddonCompetencyCompetenciesPageModule {}
|
|
@ -19,7 +19,7 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||||
import {
|
import {
|
||||||
AddonCompetencyDataForPlanPageCompetency, AddonCompetencyDataForCourseCompetenciesPageCompetency, AddonCompetency,
|
AddonCompetencyDataForPlanPageCompetency, AddonCompetencyDataForCourseCompetenciesPageCompetency, AddonCompetency,
|
||||||
} from '../../services/competency';
|
} from '../../services/competency';
|
||||||
import { Params, ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute, Params } from '@angular/router';
|
||||||
import { CorePageItemsListManager } from '@classes/page-items-list-manager';
|
import { CorePageItemsListManager } from '@classes/page-items-list-manager';
|
||||||
import { Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
|
@ -51,8 +51,7 @@ export class AddonCompetencyCompetenciesPage implements AfterViewInit, OnDestroy
|
||||||
this.userId = CoreNavigator.getRouteNumberParam('userId', { route });
|
this.userId = CoreNavigator.getRouteNumberParam('userId', { route });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.competencies =
|
this.competencies = new AddonCompetencyListManager(AddonCompetencyCompetenciesPage, this.userId);
|
||||||
new AddonCompetencyListManager(AddonCompetencyCompetenciesPage, this.planId, this.courseId, this.userId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,14 +132,11 @@ type AddonCompetencyDataForPlanPageCompetencyFormatted =
|
||||||
*/
|
*/
|
||||||
class AddonCompetencyListManager extends CorePageItemsListManager<AddonCompetencyDataForPlanPageCompetencyFormatted> {
|
class AddonCompetencyListManager extends CorePageItemsListManager<AddonCompetencyDataForPlanPageCompetencyFormatted> {
|
||||||
|
|
||||||
planId?: number;
|
private userId?: number;
|
||||||
courseId?: number;
|
|
||||||
userId?: number;
|
|
||||||
|
|
||||||
constructor(pageComponent: unknown, planId?: number, courseId?: number, userId?: number) {
|
constructor(pageComponent: unknown, userId?: number) {
|
||||||
super(pageComponent);
|
super(pageComponent);
|
||||||
this.planId = planId;
|
|
||||||
this.courseId = courseId;
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,11 +151,11 @@ class AddonCompetencyListManager extends CorePageItemsListManager<AddonCompetenc
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
protected getItemQueryParams(): Params {
|
protected getItemQueryParams(): Params {
|
||||||
if (this.planId) {
|
if (this.userId) {
|
||||||
return { planId: this.planId };
|
return { userId: this.userId };
|
||||||
} else {
|
|
||||||
return { courseId: this.courseId, userId: this.userId };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
// (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.
|
||||||
|
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { CoreSharedModule } from '@/core/shared.module';
|
||||||
|
import { AddonCompetencyCompetencyPage } from './competency.page';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CoreSharedModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AddonCompetencyCompetencyPage,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class AddonCompetencyCompetencyPageModule {}
|
|
@ -32,7 +32,7 @@ import { CoreNavigator } from '@services/navigator';
|
||||||
import { IonRefresher } from '@ionic/angular';
|
import { IonRefresher } from '@ionic/angular';
|
||||||
import { ContextLevel } from '@/core/constants';
|
import { ContextLevel } from '@/core/constants';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays the competency information.
|
* Page that displays the competency information.
|
||||||
|
@ -183,8 +183,8 @@ export class AddonCompetencyCompetencyPage implements OnInit {
|
||||||
* @param competencyId
|
* @param competencyId
|
||||||
*/
|
*/
|
||||||
openCompetencySummary(competencyId: number): void {
|
openCompetencySummary(competencyId: number): void {
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigate(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + competencyId,
|
`../${competencyId}/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
|
||||||
{
|
{
|
||||||
params: { contextLevel: this.contextLevel, contextInstanceId: this.contextInstanceId },
|
params: { contextLevel: this.contextLevel, contextInstanceId: this.contextInstanceId },
|
||||||
},
|
},
|
|
@ -0,0 +1,28 @@
|
||||||
|
// (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.
|
||||||
|
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { CoreSharedModule } from '@/core/shared.module';
|
||||||
|
import { AddonCompetencyCompetencySummaryPage } from './competencysummary.page';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CoreSharedModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AddonCompetencyCompetencySummaryPage,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class AddonCompetencyCompetencySummaryPageModule {}
|
|
@ -19,7 +19,7 @@ import { IonRefresher } from '@ionic/angular';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays the competency summary.
|
* Page that displays the competency summary.
|
||||||
|
@ -101,8 +101,8 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit {
|
||||||
* @param competencyId
|
* @param competencyId
|
||||||
*/
|
*/
|
||||||
openCompetencySummary(competencyId: number): void {
|
openCompetencySummary(competencyId: number): void {
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigate(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + competencyId,
|
`../../${competencyId}/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
|
||||||
{
|
{
|
||||||
params: { contextLevel: this.contextLevel, contextInstanceId: this.contextInstanceId },
|
params: { contextLevel: this.contextLevel, contextInstanceId: this.contextInstanceId },
|
||||||
},
|
},
|
|
@ -20,7 +20,7 @@ import { IonRefresher } from '@ionic/angular';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { ContextLevel } from '@/core/constants';
|
import { ContextLevel } from '@/core/constants';
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays the list of competencies of a course.
|
* Page that displays the list of competencies of a course.
|
||||||
|
@ -80,12 +80,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit {
|
||||||
* @param competencyId
|
* @param competencyId
|
||||||
*/
|
*/
|
||||||
openCompetency(competencyId: number): void {
|
openCompetency(competencyId: number): void {
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigate('./' + competencyId);
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + competencyId,
|
|
||||||
{
|
|
||||||
params: { courseId: this.courseId, userId: this.userId },
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,11 +89,15 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit {
|
||||||
* @param competencyId
|
* @param competencyId
|
||||||
*/
|
*/
|
||||||
openCompetencySummary(competencyId: number): void {
|
openCompetencySummary(competencyId: number): void {
|
||||||
CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + competencyId, {
|
CoreNavigator.navigateToSitePath(
|
||||||
|
`./${competencyId}/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
|
||||||
|
{
|
||||||
params: {
|
params: {
|
||||||
contextLevel: ContextLevel.COURSE,
|
contextLevel: ContextLevel.COURSE,
|
||||||
contextInstanceId: this.courseId,
|
contextInstanceId: this.courseId,
|
||||||
} });
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,6 @@ import { AddonCompetencyHelper } from '../../services/competency-helper';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreUserProfile } from '@features/user/services/user';
|
import { CoreUserProfile } from '@features/user/services/user';
|
||||||
import { IonRefresher } from '@ionic/angular';
|
import { IonRefresher } from '@ionic/angular';
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays a learning plan.
|
* Page that displays a learning plan.
|
||||||
|
@ -79,10 +78,9 @@ export class AddonCompetencyPlanPage implements OnInit {
|
||||||
* @param competencyId
|
* @param competencyId
|
||||||
*/
|
*/
|
||||||
openCompetency(competencyId: number): void {
|
openCompetency(competencyId: number): void {
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigate('./' + competencyId, {
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + competencyId,
|
params: { userId: this.user?.id },
|
||||||
{ params: { planId: this.planId } },
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, OnDestroy, ViewChild } from '@angular/core';
|
||||||
import { IonRefresher } from '@ionic/angular';
|
import { IonRefresher } from '@ionic/angular';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||||
|
@ -20,6 +20,8 @@ import { AddonCompetencyProvider, AddonCompetencyPlan, AddonCompetency } from '.
|
||||||
import { AddonCompetencyHelper } from '../../services/competency-helper';
|
import { AddonCompetencyHelper } from '../../services/competency-helper';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CorePageItemsListManager } from '@classes/page-items-list-manager';
|
import { CorePageItemsListManager } from '@classes/page-items-list-manager';
|
||||||
|
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '@addons/competency/competency.module';
|
||||||
|
import { Params } from '@angular/router';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays the list of learning plans.
|
* Page that displays the list of learning plans.
|
||||||
|
@ -28,7 +30,7 @@ import { CorePageItemsListManager } from '@classes/page-items-list-manager';
|
||||||
selector: 'page-addon-competency-planlist',
|
selector: 'page-addon-competency-planlist',
|
||||||
templateUrl: 'planlist.html',
|
templateUrl: 'planlist.html',
|
||||||
})
|
})
|
||||||
export class AddonCompetencyPlanListPage implements OnInit, AfterViewInit, OnDestroy {
|
export class AddonCompetencyPlanListPage implements AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
@ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent;
|
@ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent;
|
||||||
|
|
||||||
|
@ -36,14 +38,9 @@ export class AddonCompetencyPlanListPage implements OnInit, AfterViewInit, OnDes
|
||||||
plans: AddonCompetencyPlanListManager;
|
plans: AddonCompetencyPlanListManager;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.plans = new AddonCompetencyPlanListManager(AddonCompetencyPlanListPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.userId = CoreNavigator.getRouteNumberParam('userId');
|
this.userId = CoreNavigator.getRouteNumberParam('userId');
|
||||||
|
|
||||||
|
this.plans = new AddonCompetencyPlanListManager(AddonCompetencyPlanListPage, this.userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,15 +115,30 @@ type AddonCompetencyPlanFormatted = AddonCompetencyPlan & {
|
||||||
*/
|
*/
|
||||||
class AddonCompetencyPlanListManager extends CorePageItemsListManager<AddonCompetencyPlanFormatted> {
|
class AddonCompetencyPlanListManager extends CorePageItemsListManager<AddonCompetencyPlanFormatted> {
|
||||||
|
|
||||||
constructor(pageComponent: unknown) {
|
private userId?: number;
|
||||||
|
|
||||||
|
constructor(pageComponent: unknown, userId?: number) {
|
||||||
super(pageComponent);
|
super(pageComponent);
|
||||||
|
|
||||||
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
protected getItemPath(plan: AddonCompetencyPlanFormatted): string {
|
protected getItemPath(plan: AddonCompetencyPlanFormatted): string {
|
||||||
return String(plan.id);
|
return `${plan.id}/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
protected getItemQueryParams(): Params {
|
||||||
|
if (this.userId) {
|
||||||
|
return { userId: this.userId };
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
||||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||||
|
import { COURSE_PAGE_NAME } from '@features/course/course.module';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonCompetency } from '../competency';
|
import { AddonCompetency } from '../competency';
|
||||||
|
@ -37,17 +38,29 @@ export class AddonCompetencyCompetencyLinkHandlerService extends CoreContentLink
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
action: (siteId: string): void => {
|
action: (siteId: string): void => {
|
||||||
const pageParams = {
|
if (courseId) {
|
||||||
planId: params.planid,
|
|
||||||
courseId: courseId,
|
|
||||||
userId: params.userid,
|
|
||||||
};
|
|
||||||
|
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + params.competencyid,
|
`${COURSE_PAGE_NAME}/${courseId}/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
|
||||||
{ params: pageParams, siteId },
|
{
|
||||||
|
params: { userId: params.userid },
|
||||||
|
siteId,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.planid) {
|
||||||
|
CoreNavigator.navigateToSitePath(
|
||||||
|
`${ADDON_COMPETENCY_LEARNING_PLANS_PAGE}/competencies/${params.planid}`,
|
||||||
|
{
|
||||||
|
params: { userId: params.userid },
|
||||||
|
siteId,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { CoreCourseUserAdminOrNavOptionIndexed } from '@features/courses/service
|
||||||
import { CoreEnrolledCourseDataWithExtraInfoAndOptions } from '@features/courses/services/courses-helper';
|
import { CoreEnrolledCourseDataWithExtraInfoAndOptions } from '@features/courses/services/courses-helper';
|
||||||
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
|
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
|
||||||
import { ContextLevel } from '@/core/constants';
|
import { ContextLevel } from '@/core/constants';
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '@addons/competency/competency.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Course nav handler.
|
* Course nav handler.
|
||||||
|
@ -75,7 +75,7 @@ export class AddonCompetencyCourseOptionHandlerService implements CoreCourseOpti
|
||||||
return {
|
return {
|
||||||
title: 'addon.competency.competencies',
|
title: 'addon.competency.competencies',
|
||||||
class: 'addon-competency-course-handler',
|
class: 'addon-competency-course-handler',
|
||||||
page: ADDON_COMPETENCY_MAIN_PAGE_NAME,
|
page: ADDON_COMPETENCY_COMPETENCIES_PAGE,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
||||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||||
|
@ -36,7 +36,7 @@ export class AddonCompetencyPlanLinkHandlerService extends CoreContentLinksHandl
|
||||||
return [{
|
return [{
|
||||||
action: (siteId: string): void => {
|
action: (siteId: string): void => {
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/' + params.id,
|
`${ADDON_COMPETENCY_LEARNING_PLANS_PAGE}/${params.id}`,
|
||||||
{ siteId },
|
{ siteId },
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
||||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||||
|
@ -36,7 +36,7 @@ export class AddonCompetencyPlansLinkHandlerService extends CoreContentLinksHand
|
||||||
return [{
|
return [{
|
||||||
action: (siteId: string): void => {
|
action: (siteId: string): void => {
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME,
|
ADDON_COMPETENCY_LEARNING_PLANS_PAGE,
|
||||||
{ params: { userId: params.userid }, siteId },
|
{ params: { userId: params.userid }, siteId },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { COURSE_PAGE_NAME } from '@features/course/course.module';
|
||||||
import { CorePushNotificationsClickHandler } from '@features/pushnotifications/services/push-delegate';
|
import { CorePushNotificationsClickHandler } from '@features/pushnotifications/services/push-delegate';
|
||||||
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications';
|
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
|
@ -56,7 +57,7 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat
|
||||||
|
|
||||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlan(planId, notification.site));
|
await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlan(planId, notification.site));
|
||||||
|
|
||||||
await CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME + '/' + planId, {
|
await CoreNavigator.navigateToSitePath(`${ADDON_COMPETENCY_LEARNING_PLANS_PAGE}/${planId}`, {
|
||||||
siteId: notification.site,
|
siteId: notification.site,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,10 +72,12 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat
|
||||||
const userId = Number(contextUrlParams.userid);
|
const userId = Number(contextUrlParams.userid);
|
||||||
|
|
||||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateCompetencyInPlan(planId, competencyId, notification.site));
|
await CoreUtils.ignoreErrors(AddonCompetency.invalidateCompetencyInPlan(planId, competencyId, notification.site));
|
||||||
|
|
||||||
|
if (courseId) {
|
||||||
await CoreNavigator.navigateToSitePath(
|
await CoreNavigator.navigateToSitePath(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + competencyId,
|
`${COURSE_PAGE_NAME}/${courseId}/${ADDON_COMPETENCY_COMPETENCIES_PAGE}/${competencyId}`,
|
||||||
{
|
{
|
||||||
params: { planId, courseId, userId },
|
params: { userId },
|
||||||
siteId: notification.site,
|
siteId: notification.site,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -82,12 +85,25 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (planId) {
|
||||||
|
await CoreNavigator.navigateToSitePath(
|
||||||
|
`${ADDON_COMPETENCY_LEARNING_PLANS_PAGE}/competencies/${planId}/${competencyId}`,
|
||||||
|
{
|
||||||
|
params: { userId },
|
||||||
|
siteId: notification.site,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Open the list of plans.
|
// Open the list of plans.
|
||||||
const userId = Number(contextUrlParams.userid);
|
const userId = Number(contextUrlParams.userid);
|
||||||
|
|
||||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlans(userId, notification.site));
|
await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlans(userId, notification.site));
|
||||||
|
|
||||||
await CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME, {
|
await CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_LEARNING_PLANS_PAGE, {
|
||||||
params: { userId },
|
params: { userId },
|
||||||
siteId: notification.site,
|
siteId: notification.site,
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
|
||||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||||
|
@ -33,14 +33,12 @@ export class AddonCompetencyUserCompetencyLinkHandlerService extends CoreContent
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
|
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
action: (siteId: string): void => {
|
action: (siteId: string): void => {
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + params.id,
|
`${ADDON_COMPETENCY_COMPETENCIES_PAGE}/${params.id}/${ADDON_COMPETENCY_SUMMARY_PAGE}`,
|
||||||
{ siteId },
|
{ siteId },
|
||||||
);
|
);
|
||||||
|
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,12 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module';
|
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { COURSE_PAGE_NAME } from '@features/course/course.module';
|
||||||
import { CoreUserProfile } from '@features/user/services/user';
|
import { CoreUserProfile } from '@features/user/services/user';
|
||||||
import { CoreUserProfileHandler, CoreUserDelegateService, CoreUserProfileHandlerData } from '@features/user/services/user-delegate';
|
import { CoreUserProfileHandler, CoreUserDelegateService, CoreUserProfileHandlerData } from '@features/user/services/user-delegate';
|
||||||
|
import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module';
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonCompetency } from '../competency';
|
import { AddonCompetency } from '../competency';
|
||||||
|
@ -69,12 +71,8 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
CoreNavigator.navigateToSitePath(
|
CoreNavigator.navigateToSitePath(
|
||||||
ADDON_COMPETENCY_MAIN_PAGE_NAME + '/course/' + courseId,
|
[COURSE_PAGE_NAME, courseId, PARTICIPANTS_PAGE_NAME, user.id, ADDON_COMPETENCY_COMPETENCIES_PAGE].join('/'),
|
||||||
{
|
|
||||||
params: { userId: user.id },
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,7 +83,7 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler
|
||||||
action: (event, user): void => {
|
action: (event, user): void => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME, {
|
CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_LEARNING_PLANS_PAGE, {
|
||||||
params: { userId: user.id },
|
params: { userId: user.id },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue