forked from EVOgeek/Vmeda.Online
		
	MOBILE-3642 course: Add main activity index template page
This commit is contained in:
		
							parent
							
								
									6006fed4b5
								
							
						
					
					
						commit
						d18faba0c3
					
				| @ -14,7 +14,7 @@ | |||||||
|     </ion-toolbar> |     </ion-toolbar> | ||||||
| </ion-header> | </ion-header> | ||||||
| <ion-content> | <ion-content> | ||||||
|     <ion-refresher slot="fixed" [disabled]="!assignComponent?.loaded" (ionRefresh)="assignComponent?.doRefresh($event)"> |     <ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event)"> | ||||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> |         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||||
|     </ion-refresher> |     </ion-refresher> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -12,11 +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 { Component, OnInit, ViewChild } from '@angular/core'; | import { Component, ViewChild } from '@angular/core'; | ||||||
| import { CoreCourseWSModule } from '@features/course/services/course'; | import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; | ||||||
| import { CoreNavigator } from '@services/navigator'; |  | ||||||
| import { AddonModAssignIndexComponent } from '../../components/index/index'; | import { AddonModAssignIndexComponent } from '../../components/index/index'; | ||||||
| import { AddonModAssignAssign } from '../../services/assign'; |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Page that displays an assign. |  * Page that displays an assign. | ||||||
| @ -25,44 +23,8 @@ import { AddonModAssignAssign } from '../../services/assign'; | |||||||
|     selector: 'page-addon-mod-assign-index', |     selector: 'page-addon-mod-assign-index', | ||||||
|     templateUrl: 'index.html', |     templateUrl: 'index.html', | ||||||
| }) | }) | ||||||
| export class AddonModAssignIndexPage implements OnInit { | export class AddonModAssignIndexPage extends CoreCourseModuleMainActivityPage<AddonModAssignIndexComponent> { | ||||||
| 
 | 
 | ||||||
|     @ViewChild(AddonModAssignIndexComponent) assignComponent?: AddonModAssignIndexComponent; |     @ViewChild(AddonModAssignIndexComponent) activityComponent?: AddonModAssignIndexComponent; | ||||||
| 
 |  | ||||||
|     title?: string; |  | ||||||
|     module?: CoreCourseWSModule; |  | ||||||
|     courseId?: number; |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Component being initialized. |  | ||||||
|      */ |  | ||||||
|     ngOnInit(): void { |  | ||||||
|         this.module = CoreNavigator.getRouteParam('module'); |  | ||||||
|         this.courseId = CoreNavigator.getRouteNumberParam('courseId'); |  | ||||||
|         this.title = this.module?.name; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Update some data based on the assign instance. |  | ||||||
|      * |  | ||||||
|      * @param assign Assign instance. |  | ||||||
|      */ |  | ||||||
|     updateData(assign: AddonModAssignAssign): void { |  | ||||||
|         this.title = assign.name || this.title; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * User entered the page. |  | ||||||
|      */ |  | ||||||
|     ionViewDidEnter(): void { |  | ||||||
|         this.assignComponent?.ionViewDidEnter(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * User left the page. |  | ||||||
|      */ |  | ||||||
|     ionViewDidLeave(): void { |  | ||||||
|         this.assignComponent?.ionViewDidLeave(); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -14,15 +14,25 @@ | |||||||
| 
 | 
 | ||||||
| import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||||||
| import { RouterModule, Routes } from '@angular/router'; | import { RouterModule, Routes } from '@angular/router'; | ||||||
|  | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
|  | import { AddonModBookComponentsModule } from './components/components.module'; | ||||||
|  | import { AddonModBookIndexPage } from './pages/index/index.page'; | ||||||
| 
 | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|         path: ':courseId/:cmId', |         path: ':courseId/:cmId', | ||||||
|         loadChildren: () => import('./pages/index/index.module').then( m => m.AddonModBookIndexPageModule), |         component: AddonModBookIndexPage, | ||||||
|     }, |     }, | ||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| @NgModule({ | @NgModule({ | ||||||
|     imports: [RouterModule.forChild(routes)], |     imports: [ | ||||||
|  |         RouterModule.forChild(routes), | ||||||
|  |         CoreSharedModule, | ||||||
|  |         AddonModBookComponentsModule, | ||||||
|  |     ], | ||||||
|  |     declarations: [ | ||||||
|  |         AddonModBookIndexPage, | ||||||
|  |     ], | ||||||
| }) | }) | ||||||
| export class AddonModBookLazyModule {} | export class AddonModBookLazyModule {} | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ | |||||||
|     </ion-toolbar> |     </ion-toolbar> | ||||||
| </ion-header> | </ion-header> | ||||||
| <ion-content> | <ion-content> | ||||||
|     <ion-refresher slot="fixed" [disabled]="!bookComponent?.loaded" (ionRefresh)="bookComponent?.doRefresh($event)"> |     <ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event)"> | ||||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> |         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||||
|     </ion-refresher> |     </ion-refresher> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,40 +0,0 @@ | |||||||
| // (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 { CoreSharedModule } from '@/core/shared.module'; |  | ||||||
| import { AddonModBookComponentsModule } from '../../components/components.module'; |  | ||||||
| import { AddonModBookIndexPage } from './index'; |  | ||||||
| 
 |  | ||||||
| const routes: Routes = [ |  | ||||||
|     { |  | ||||||
|         path: '', |  | ||||||
|         component: AddonModBookIndexPage, |  | ||||||
|     }, |  | ||||||
| ]; |  | ||||||
| 
 |  | ||||||
| @NgModule({ |  | ||||||
|     imports: [ |  | ||||||
|         RouterModule.forChild(routes), |  | ||||||
|         CoreSharedModule, |  | ||||||
|         AddonModBookComponentsModule, |  | ||||||
|     ], |  | ||||||
|     declarations: [ |  | ||||||
|         AddonModBookIndexPage, |  | ||||||
|     ], |  | ||||||
|     exports: [RouterModule], |  | ||||||
| }) |  | ||||||
| export class AddonModBookIndexPageModule {} |  | ||||||
| @ -13,10 +13,9 @@ | |||||||
| // limitations under the License.
 | // limitations under the License.
 | ||||||
| 
 | 
 | ||||||
| import { Component, OnInit, ViewChild } from '@angular/core'; | import { Component, OnInit, ViewChild } from '@angular/core'; | ||||||
| import { CoreCourseWSModule } from '@features/course/services/course'; | import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; | ||||||
| import { CoreNavigator } from '@services/navigator'; | import { CoreNavigator } from '@services/navigator'; | ||||||
| import { AddonModBookIndexComponent } from '../../components/index/index'; | import { AddonModBookIndexComponent } from '../../components/index/index'; | ||||||
| import { AddonModBookBookWSData } from '../../services/book'; |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Page that displays a book. |  * Page that displays a book. | ||||||
| @ -25,33 +24,18 @@ import { AddonModBookBookWSData } from '../../services/book'; | |||||||
|     selector: 'page-addon-mod-book-index', |     selector: 'page-addon-mod-book-index', | ||||||
|     templateUrl: 'index.html', |     templateUrl: 'index.html', | ||||||
| }) | }) | ||||||
| export class AddonModBookIndexPage implements OnInit { | export class AddonModBookIndexPage extends CoreCourseModuleMainActivityPage<AddonModBookIndexComponent> implements OnInit { | ||||||
| 
 | 
 | ||||||
|     @ViewChild(AddonModBookIndexComponent) bookComponent?: AddonModBookIndexComponent; |     @ViewChild(AddonModBookIndexComponent) activityComponent?: AddonModBookIndexComponent; | ||||||
| 
 | 
 | ||||||
|     title?: string; |  | ||||||
|     module?: CoreCourseWSModule; |  | ||||||
|     courseId?: number; |  | ||||||
|     chapterId?: number; |     chapterId?: number; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * Component being initialized. |      * Component being initialized. | ||||||
|      */ |      */ | ||||||
|     ngOnInit(): void { |     ngOnInit(): void { | ||||||
|         this.module = CoreNavigator.getRouteParam('module'); |         super.ngOnInit(); | ||||||
|         this.courseId = CoreNavigator.getRouteNumberParam('courseId'); |  | ||||||
|         this.chapterId = CoreNavigator.getRouteNumberParam('chapterId'); |         this.chapterId = CoreNavigator.getRouteNumberParam('chapterId'); | ||||||
|         this.title = this.module?.name; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Update some data based on the book instance. |  | ||||||
|      * |  | ||||||
|      * @param book Book instance. |  | ||||||
|      */ |  | ||||||
|     updateData(book: AddonModBookBookWSData): void { |  | ||||||
|         this.title = book.name || this.title; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| @ -20,7 +20,7 @@ import { CoreScreen } from '@services/screen'; | |||||||
| import { CoreSharedModule } from '@/core/shared.module'; | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
| 
 | 
 | ||||||
| import { AddonModForumComponentsModule } from './components/components.module'; | import { AddonModForumComponentsModule } from './components/components.module'; | ||||||
| import { AddonModForumIndexPage } from './pages/index'; | import { AddonModForumIndexPage } from './pages/index/index.page'; | ||||||
| 
 | 
 | ||||||
| const mobileRoutes: Routes = [ | const mobileRoutes: Routes = [ | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ | |||||||
|             <ion-back-button [attr.aria-label]="'core.back' | translate"></ion-back-button> |             <ion-back-button [attr.aria-label]="'core.back' | translate"></ion-back-button> | ||||||
|         </ion-buttons> |         </ion-buttons> | ||||||
|         <ion-title> |         <ion-title> | ||||||
|             <core-format-text [text]="title" contextLevel="module" [contextInstanceId]="module?.id" [courseId]="courseId"> |             <core-format-text [text]="title" contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId"> | ||||||
|             </core-format-text> |             </core-format-text> | ||||||
|         </ion-title> |         </ion-title> | ||||||
|         <ion-buttons slot="end"> |         <ion-buttons slot="end"> | ||||||
|  | |||||||
							
								
								
									
										28
									
								
								src/addons/mod/forum/pages/index/index.page.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/addons/mod/forum/pages/index/index.page.ts
									
									
									
									
									
										Normal file
									
								
							| @ -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 { Component, ViewChild } from '@angular/core'; | ||||||
|  | 
 | ||||||
|  | import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; | ||||||
|  | import { AddonModForumIndexComponent } from '../../components/index'; | ||||||
|  | 
 | ||||||
|  | @Component({ | ||||||
|  |     selector: 'page-addon-mod-forum-index', | ||||||
|  |     templateUrl: 'index.html', | ||||||
|  | }) | ||||||
|  | export class AddonModForumIndexPage extends CoreCourseModuleMainActivityPage<AddonModForumIndexComponent> { | ||||||
|  | 
 | ||||||
|  |     @ViewChild(AddonModForumIndexComponent) activityComponent?: AddonModForumIndexComponent; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -15,7 +15,7 @@ | |||||||
| import { Component, Input } from '@angular/core'; | import { Component, Input } from '@angular/core'; | ||||||
| 
 | 
 | ||||||
| import { ModalController } from '@singletons'; | import { ModalController } from '@singletons'; | ||||||
| import { AddonModLessonPlayerPage } from '../../pages/player/player'; | import { AddonModLessonPlayerPage } from '../../pages/player/player.page'; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Modal that renders the lesson menu and media file. |  * Modal that renders the lesson menu and media file. | ||||||
|  | |||||||
| @ -15,10 +15,15 @@ | |||||||
| import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||||||
| import { RouterModule, Routes } from '@angular/router'; | import { RouterModule, Routes } from '@angular/router'; | ||||||
| 
 | 
 | ||||||
|  | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
|  | import { AddonModLessonComponentsModule } from './components/components.module'; | ||||||
|  | 
 | ||||||
|  | import { AddonModLessonIndexPage } from './pages/index/index.page'; | ||||||
|  | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|         path: ':courseId/:cmId', |         path: ':courseId/:cmId', | ||||||
|         loadChildren: () => import('./pages/index/index.module').then( m => m.AddonModLessonIndexPageModule), |         component: AddonModLessonIndexPage, | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|         path: 'player/:courseId/:lessonId', |         path: 'player/:courseId/:lessonId', | ||||||
| @ -31,6 +36,13 @@ const routes: Routes = [ | |||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| @NgModule({ | @NgModule({ | ||||||
|     imports: [RouterModule.forChild(routes)], |     imports: [ | ||||||
|  |         RouterModule.forChild(routes), | ||||||
|  |         CoreSharedModule, | ||||||
|  |         AddonModLessonComponentsModule, | ||||||
|  |     ], | ||||||
|  |     declarations: [ | ||||||
|  |         AddonModLessonIndexPage, | ||||||
|  |     ], | ||||||
| }) | }) | ||||||
| export class AddonModLessonLazyModule {} | export class AddonModLessonLazyModule {} | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ | |||||||
|     </ion-toolbar> |     </ion-toolbar> | ||||||
| </ion-header> | </ion-header> | ||||||
| <ion-content> | <ion-content> | ||||||
|     <ion-refresher slot="fixed" [disabled]="!lessonComponent?.loaded" (ionRefresh)="lessonComponent?.doRefresh($event)"> |     <ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event)"> | ||||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> |         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||||
|     </ion-refresher> |     </ion-refresher> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,40 +0,0 @@ | |||||||
| // (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 { CoreSharedModule } from '@/core/shared.module'; |  | ||||||
| import { AddonModLessonComponentsModule } from '../../components/components.module'; |  | ||||||
| import { AddonModLessonIndexPage } from './index'; |  | ||||||
| 
 |  | ||||||
| const routes: Routes = [ |  | ||||||
|     { |  | ||||||
|         path: '', |  | ||||||
|         component: AddonModLessonIndexPage, |  | ||||||
|     }, |  | ||||||
| ]; |  | ||||||
| 
 |  | ||||||
| @NgModule({ |  | ||||||
|     imports: [ |  | ||||||
|         RouterModule.forChild(routes), |  | ||||||
|         CoreSharedModule, |  | ||||||
|         AddonModLessonComponentsModule, |  | ||||||
|     ], |  | ||||||
|     declarations: [ |  | ||||||
|         AddonModLessonIndexPage, |  | ||||||
|     ], |  | ||||||
|     exports: [RouterModule], |  | ||||||
| }) |  | ||||||
| export class AddonModLessonIndexPageModule {} |  | ||||||
| @ -13,11 +13,9 @@ | |||||||
| // limitations under the License.
 | // limitations under the License.
 | ||||||
| 
 | 
 | ||||||
| import { Component, OnInit, ViewChild } from '@angular/core'; | import { Component, OnInit, ViewChild } from '@angular/core'; | ||||||
| 
 | import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; | ||||||
| import { CoreCourseWSModule } from '@features/course/services/course'; |  | ||||||
| import { CoreNavigator } from '@services/navigator'; | import { CoreNavigator } from '@services/navigator'; | ||||||
| import { AddonModLessonIndexComponent } from '../../components/index/index'; | import { AddonModLessonIndexComponent } from '../../components/index/index'; | ||||||
| import { AddonModLessonLessonWSData } from '../../services/lesson'; |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Page that displays the lesson entry page. |  * Page that displays the lesson entry page. | ||||||
| @ -26,13 +24,10 @@ import { AddonModLessonLessonWSData } from '../../services/lesson'; | |||||||
|     selector: 'page-addon-mod-lesson-index', |     selector: 'page-addon-mod-lesson-index', | ||||||
|     templateUrl: 'index.html', |     templateUrl: 'index.html', | ||||||
| }) | }) | ||||||
| export class AddonModLessonIndexPage implements OnInit { | export class AddonModLessonIndexPage extends CoreCourseModuleMainActivityPage<AddonModLessonIndexComponent> implements OnInit { | ||||||
| 
 | 
 | ||||||
|     @ViewChild(AddonModLessonIndexComponent) lessonComponent?: AddonModLessonIndexComponent; |     @ViewChild(AddonModLessonIndexComponent) activityComponent?: AddonModLessonIndexComponent; | ||||||
| 
 | 
 | ||||||
|     title?: string; |  | ||||||
|     module?: CoreCourseWSModule; |  | ||||||
|     courseId?: number; |  | ||||||
|     group?: number; // The group to display.
 |     group?: number; // The group to display.
 | ||||||
|     action?: string; // The "action" to display first.
 |     action?: string; // The "action" to display first.
 | ||||||
| 
 | 
 | ||||||
| @ -40,34 +35,9 @@ export class AddonModLessonIndexPage implements OnInit { | |||||||
|      * Component being initialized. |      * Component being initialized. | ||||||
|      */ |      */ | ||||||
|     ngOnInit(): void { |     ngOnInit(): void { | ||||||
|         this.module = CoreNavigator.getRouteParam('module'); |         super.ngOnInit(); | ||||||
|         this.courseId = CoreNavigator.getRouteNumberParam('courseId'); |  | ||||||
|         this.group = CoreNavigator.getRouteNumberParam('group'); |         this.group = CoreNavigator.getRouteNumberParam('group'); | ||||||
|         this.action = CoreNavigator.getRouteParam('action'); |         this.action = CoreNavigator.getRouteParam('action'); | ||||||
|         this.title = this.module?.name; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Update some data based on the lesson instance. |  | ||||||
|      * |  | ||||||
|      * @param lesson Lesson instance. |  | ||||||
|      */ |  | ||||||
|     updateData(lesson: AddonModLessonLessonWSData): void { |  | ||||||
|         this.title = lesson.name || this.title; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * User entered the page. |  | ||||||
|      */ |  | ||||||
|     ionViewDidEnter(): void { |  | ||||||
|         this.lessonComponent?.ionViewDidEnter(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * User left the page. |  | ||||||
|      */ |  | ||||||
|     ionViewDidLeave(): void { |  | ||||||
|         this.lessonComponent?.ionViewDidLeave(); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| @ -16,7 +16,7 @@ import { NgModule } from '@angular/core'; | |||||||
| import { RouterModule, Routes } from '@angular/router'; | import { RouterModule, Routes } from '@angular/router'; | ||||||
| 
 | 
 | ||||||
| import { CoreSharedModule } from '@/core/shared.module'; | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
| import { AddonModLessonPlayerPage } from './player'; | import { AddonModLessonPlayerPage } from './player.page'; | ||||||
| import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; | import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; | ||||||
| import { CanLeaveGuard } from '@guards/can-leave'; | import { CanLeaveGuard } from '@guards/can-leave'; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ import { NgModule } from '@angular/core'; | |||||||
| import { RouterModule, Routes } from '@angular/router'; | import { RouterModule, Routes } from '@angular/router'; | ||||||
| 
 | 
 | ||||||
| import { CoreSharedModule } from '@/core/shared.module'; | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
| import { AddonModLessonUserRetakePage } from './user-retake'; | import { AddonModLessonUserRetakePage } from './user-retake.page'; | ||||||
| 
 | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -15,14 +15,25 @@ | |||||||
| import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||||||
| import { RouterModule, Routes } from '@angular/router'; | import { RouterModule, Routes } from '@angular/router'; | ||||||
| 
 | 
 | ||||||
|  | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
|  | import { AddonModPageComponentsModule } from './components/components.module'; | ||||||
|  | import { AddonModPageIndexPage } from './pages/index/index.page'; | ||||||
|  | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|         path: ':courseId/:cmId', |         path: ':courseId/:cmId', | ||||||
|         loadChildren: () => import('./pages/index/index.module').then( m => m.AddonModPageIndexPageModule), |         component: AddonModPageIndexPage, | ||||||
|     }, |     }, | ||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| @NgModule({ | @NgModule({ | ||||||
|     imports: [RouterModule.forChild(routes)], |     imports: [ | ||||||
|  |         RouterModule.forChild(routes), | ||||||
|  |         CoreSharedModule, | ||||||
|  |         AddonModPageComponentsModule, | ||||||
|  |     ], | ||||||
|  |     declarations: [ | ||||||
|  |         AddonModPageIndexPage, | ||||||
|  |     ], | ||||||
| }) | }) | ||||||
| export class AddonModPageLazyModule {} | export class AddonModPageLazyModule {} | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ | |||||||
|     </ion-toolbar> |     </ion-toolbar> | ||||||
| </ion-header> | </ion-header> | ||||||
| <ion-content> | <ion-content> | ||||||
|     <ion-refresher slot="fixed" [disabled]="!pageComponent?.loaded" (ionRefresh)="pageComponent?.doRefresh($event)"> |     <ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event)"> | ||||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> |         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||||
|     </ion-refresher> |     </ion-refresher> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,40 +0,0 @@ | |||||||
| // (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 { CoreSharedModule } from '@/core/shared.module'; |  | ||||||
| import { AddonModPageComponentsModule } from '../../components/components.module'; |  | ||||||
| import { AddonModPageIndexPage } from './index'; |  | ||||||
| 
 |  | ||||||
| const routes: Routes = [ |  | ||||||
|     { |  | ||||||
|         path: '', |  | ||||||
|         component: AddonModPageIndexPage, |  | ||||||
|     }, |  | ||||||
| ]; |  | ||||||
| 
 |  | ||||||
| @NgModule({ |  | ||||||
|     imports: [ |  | ||||||
|         RouterModule.forChild(routes), |  | ||||||
|         CoreSharedModule, |  | ||||||
|         AddonModPageComponentsModule, |  | ||||||
|     ], |  | ||||||
|     declarations: [ |  | ||||||
|         AddonModPageIndexPage, |  | ||||||
|     ], |  | ||||||
|     exports: [RouterModule], |  | ||||||
| }) |  | ||||||
| export class AddonModPageIndexPageModule {} |  | ||||||
							
								
								
									
										30
									
								
								src/addons/mod/page/pages/index/index.page.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/addons/mod/page/pages/index/index.page.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | // (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 { Component, ViewChild } from '@angular/core'; | ||||||
|  | import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; | ||||||
|  | import { AddonModPageIndexComponent } from '../../components/index/index'; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Page that displays a page. | ||||||
|  |  */ | ||||||
|  | @Component({ | ||||||
|  |     selector: 'page-addon-mod-page-index', | ||||||
|  |     templateUrl: 'index.html', | ||||||
|  | }) | ||||||
|  | export class AddonModPageIndexPage extends CoreCourseModuleMainActivityPage<AddonModPageIndexComponent> { | ||||||
|  | 
 | ||||||
|  |     @ViewChild(AddonModPageIndexComponent) activityComponent?: AddonModPageIndexComponent; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -1,54 +0,0 @@ | |||||||
| // (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 { Component, OnInit, ViewChild } from '@angular/core'; |  | ||||||
| import { CoreCourseWSModule } from '@features/course/services/course'; |  | ||||||
| import { CoreNavigator } from '@services/navigator'; |  | ||||||
| import { AddonModPageIndexComponent } from '../../components/index/index'; |  | ||||||
| import { AddonModPagePage } from '../../services/page'; |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * Page that displays a page. |  | ||||||
|  */ |  | ||||||
| @Component({ |  | ||||||
|     selector: 'page-addon-mod-page-index', |  | ||||||
|     templateUrl: 'index.html', |  | ||||||
| }) |  | ||||||
| export class AddonModPageIndexPage implements OnInit { |  | ||||||
| 
 |  | ||||||
|     @ViewChild(AddonModPageIndexComponent) pageComponent?: AddonModPageIndexComponent; |  | ||||||
| 
 |  | ||||||
|     title?: string; |  | ||||||
|     module?: CoreCourseWSModule; |  | ||||||
|     courseId?: number; |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Component being initialized. |  | ||||||
|      */ |  | ||||||
|     ngOnInit(): void { |  | ||||||
|         this.module = CoreNavigator.getRouteParam('module'); |  | ||||||
|         this.courseId = CoreNavigator.getRouteNumberParam('courseId'); |  | ||||||
|         this.title = this.module?.name; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Update some data based on the page instance. |  | ||||||
|      * |  | ||||||
|      * @param page Page instance. |  | ||||||
|      */ |  | ||||||
|     updateData(page: CoreCourseWSModule | AddonModPagePage): void { |  | ||||||
|         this.title = 'name' in page ? page.name : this.title; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
| @ -16,7 +16,7 @@ import { NgModule } from '@angular/core'; | |||||||
| import { RouterModule, Routes } from '@angular/router'; | import { RouterModule, Routes } from '@angular/router'; | ||||||
| 
 | 
 | ||||||
| import { CoreSharedModule } from '@/core/shared.module'; | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
| import { AddonModQuizAttemptPage } from './attempt'; | import { AddonModQuizAttemptPage } from './attempt.page'; | ||||||
| 
 | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ | |||||||
|     </ion-toolbar> |     </ion-toolbar> | ||||||
| </ion-header> | </ion-header> | ||||||
| <ion-content> | <ion-content> | ||||||
|     <ion-refresher slot="fixed" [disabled]="!quizComponent?.loaded" (ionRefresh)="quizComponent?.doRefresh($event)"> |     <ion-refresher slot="fixed" [disabled]="!activityComponent?.loaded" (ionRefresh)="activityComponent?.doRefresh($event)"> | ||||||
|         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> |         <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content> | ||||||
|     </ion-refresher> |     </ion-refresher> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,40 +0,0 @@ | |||||||
| // (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 { CoreSharedModule } from '@/core/shared.module'; |  | ||||||
| import { AddonModQuizComponentsModule } from '../../components/components.module'; |  | ||||||
| import { AddonModQuizIndexPage } from './index'; |  | ||||||
| 
 |  | ||||||
| const routes: Routes = [ |  | ||||||
|     { |  | ||||||
|         path: '', |  | ||||||
|         component: AddonModQuizIndexPage, |  | ||||||
|     }, |  | ||||||
| ]; |  | ||||||
| 
 |  | ||||||
| @NgModule({ |  | ||||||
|     imports: [ |  | ||||||
|         RouterModule.forChild(routes), |  | ||||||
|         CoreSharedModule, |  | ||||||
|         AddonModQuizComponentsModule, |  | ||||||
|     ], |  | ||||||
|     declarations: [ |  | ||||||
|         AddonModQuizIndexPage, |  | ||||||
|     ], |  | ||||||
|     exports: [RouterModule], |  | ||||||
| }) |  | ||||||
| export class AddonModQuizIndexPageModule {} |  | ||||||
							
								
								
									
										30
									
								
								src/addons/mod/quiz/pages/index/index.page.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/addons/mod/quiz/pages/index/index.page.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | // (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 { Component, ViewChild } from '@angular/core'; | ||||||
|  | import { CoreCourseModuleMainActivityPage } from '@features/course/classes/main-activity-page'; | ||||||
|  | import { AddonModQuizIndexComponent } from '../../components/index/index'; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Page that displays the quiz entry page. | ||||||
|  |  */ | ||||||
|  | @Component({ | ||||||
|  |     selector: 'page-addon-mod-quiz-index', | ||||||
|  |     templateUrl: 'index.html', | ||||||
|  | }) | ||||||
|  | export class AddonModQuizIndexPage extends CoreCourseModuleMainActivityPage<AddonModQuizIndexComponent> { | ||||||
|  | 
 | ||||||
|  |     @ViewChild(AddonModQuizIndexComponent) activityComponent?: AddonModQuizIndexComponent; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -1,69 +0,0 @@ | |||||||
| // (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 { Component, OnInit, ViewChild } from '@angular/core'; |  | ||||||
| 
 |  | ||||||
| import { CoreCourseWSModule } from '@features/course/services/course'; |  | ||||||
| import { CoreNavigator } from '@services/navigator'; |  | ||||||
| import { AddonModQuizIndexComponent } from '../../components/index'; |  | ||||||
| import { AddonModQuizQuizWSData } from '../../services/quiz'; |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * Page that displays the quiz entry page. |  | ||||||
|  */ |  | ||||||
| @Component({ |  | ||||||
|     selector: 'page-addon-mod-quiz-index', |  | ||||||
|     templateUrl: 'index.html', |  | ||||||
| }) |  | ||||||
| export class AddonModQuizIndexPage implements OnInit { |  | ||||||
| 
 |  | ||||||
|     @ViewChild(AddonModQuizIndexComponent) quizComponent?: AddonModQuizIndexComponent; |  | ||||||
| 
 |  | ||||||
|     title?: string; |  | ||||||
|     module?: CoreCourseWSModule; |  | ||||||
|     courseId?: number; |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Component being initialized. |  | ||||||
|      */ |  | ||||||
|     ngOnInit(): void { |  | ||||||
|         this.module = CoreNavigator.getRouteParam('module'); |  | ||||||
|         this.courseId = CoreNavigator.getRouteNumberParam('courseId'); |  | ||||||
|         this.title = this.module?.name; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Update some data based on the quiz instance. |  | ||||||
|      * |  | ||||||
|      * @param quiz Quiz instance. |  | ||||||
|      */ |  | ||||||
|     updateData(quiz: AddonModQuizQuizWSData): void { |  | ||||||
|         this.title = quiz.name || this.title; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * User entered the page. |  | ||||||
|      */ |  | ||||||
|     ionViewDidEnter(): void { |  | ||||||
|         this.quizComponent?.ionViewDidEnter(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * User left the page. |  | ||||||
|      */ |  | ||||||
|     ionViewDidLeave(): void { |  | ||||||
|         this.quizComponent?.ionViewDidLeave(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
| @ -18,7 +18,7 @@ import { RouterModule, Routes } from '@angular/router'; | |||||||
| 
 | 
 | ||||||
| import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; | import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; | ||||||
| import { CanLeaveGuard } from '@guards/can-leave'; | import { CanLeaveGuard } from '@guards/can-leave'; | ||||||
| import { AddonModQuizPlayerPage } from './player'; | import { AddonModQuizPlayerPage } from './player.page'; | ||||||
| 
 | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -17,7 +17,7 @@ import { RouterModule, Routes } from '@angular/router'; | |||||||
| 
 | 
 | ||||||
| import { CoreSharedModule } from '@/core/shared.module'; | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
| import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; | import { CoreQuestionComponentsModule } from '@features/question/components/components.module'; | ||||||
| import { AddonModQuizReviewPage } from './review'; | import { AddonModQuizReviewPage } from './review.page'; | ||||||
| 
 | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -15,10 +15,15 @@ | |||||||
| import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||||||
| import { RouterModule, Routes } from '@angular/router'; | import { RouterModule, Routes } from '@angular/router'; | ||||||
| 
 | 
 | ||||||
|  | import { CoreSharedModule } from '@/core/shared.module'; | ||||||
|  | import { AddonModQuizComponentsModule } from './components/components.module'; | ||||||
|  | 
 | ||||||
|  | import { AddonModQuizIndexPage } from './pages/index/index.page'; | ||||||
|  | 
 | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|     { |     { | ||||||
|         path: ':courseId/:cmId', |         path: ':courseId/:cmId', | ||||||
|         loadChildren: () => import('./pages/index/index.module').then( m => m.AddonModQuizIndexPageModule), |         component: AddonModQuizIndexPage, | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|         path: ':courseId/:cmId/player', |         path: ':courseId/:cmId/player', | ||||||
| @ -35,6 +40,13 @@ const routes: Routes = [ | |||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| @NgModule({ | @NgModule({ | ||||||
|     imports: [RouterModule.forChild(routes)], |     imports: [ | ||||||
|  |         RouterModule.forChild(routes), | ||||||
|  |         CoreSharedModule, | ||||||
|  |         AddonModQuizComponentsModule, | ||||||
|  |     ], | ||||||
|  |     declarations: [ | ||||||
|  |         AddonModQuizIndexPage, | ||||||
|  |     ], | ||||||
| }) | }) | ||||||
| export class AddonModQuizLazyModule {} | export class AddonModQuizLazyModule {} | ||||||
|  | |||||||
| @ -13,23 +13,28 @@ | |||||||
| // limitations under the License.
 | // limitations under the License.
 | ||||||
| 
 | 
 | ||||||
| import { Component, OnInit } from '@angular/core'; | import { Component, OnInit } from '@angular/core'; | ||||||
| 
 |  | ||||||
| import { AddonModForumData } from '@addons/mod/forum/services/forum'; |  | ||||||
| import { CoreCourseAnyModuleData } from '@features/course/services/course'; |  | ||||||
| import { CoreNavigator } from '@services/navigator'; | import { CoreNavigator } from '@services/navigator'; | ||||||
|  | import { CoreCourseAnyModuleData } from '../services/course'; | ||||||
|  | import { CoreCourseModuleMainResourceComponent } from './main-resource-component'; | ||||||
| 
 | 
 | ||||||
|  | /** | ||||||
|  | /** | ||||||
|  |  * Template class to easily create CoreCourseModuleMainComponent of resources (or activities without syncing). | ||||||
|  |  */ | ||||||
| @Component({ | @Component({ | ||||||
|     selector: 'page-addon-mod-forum-index', |     template: '', | ||||||
|     templateUrl: 'index.html', |  | ||||||
| }) | }) | ||||||
| export class AddonModForumIndexPage implements OnInit { | export class CoreCourseModuleMainActivityPage<ActivityType extends CoreCourseModuleMainResourceComponent> implements OnInit { | ||||||
|  | 
 | ||||||
|  |     activityComponent?: ActivityType; | ||||||
| 
 | 
 | ||||||
|     title!: string; |     title!: string; | ||||||
|     module!: CoreCourseAnyModuleData; |     module!: CoreCourseAnyModuleData; | ||||||
|     courseId!: number; |     courseId!: number; | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * Component being initialized. | ||||||
|      */ |      */ | ||||||
|     ngOnInit(): void { |     ngOnInit(): void { | ||||||
|         this.module = CoreNavigator.getRouteParam<CoreCourseAnyModuleData>('module')!; |         this.module = CoreNavigator.getRouteParam<CoreCourseAnyModuleData>('module')!; | ||||||
| @ -38,12 +43,26 @@ export class AddonModForumIndexPage implements OnInit { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Update some data based on the forum instance. |      * Update some data based on the activity instance. | ||||||
|      * |      * | ||||||
|      * @param forum Forum instance. |      * @param activity Activity instance. | ||||||
|      */ |      */ | ||||||
|     updateData(forum: AddonModForumData): void { |     updateData(activity: { name: string}): void { | ||||||
|         this.title = forum.name || this.title; |         this.title = activity.name || this.title; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * User entered the page. | ||||||
|  |      */ | ||||||
|  |     ionViewDidEnter(): void { | ||||||
|  |         this.activityComponent?.ionViewDidEnter(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * User left the page. | ||||||
|  |      */ | ||||||
|  |     ionViewDidLeave(): void { | ||||||
|  |         this.activityComponent?.ionViewDidLeave(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user