diff --git a/src/addons/mod/assign/components/index/addon-mod-assign-index.html b/src/addons/mod/assign/components/index/addon-mod-assign-index.html index 2c09b70b1..d5aef9734 100644 --- a/src/addons/mod/assign/components/index/addon-mod-assign-index.html +++ b/src/addons/mod/assign/components/index/addon-mod-assign-index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()"> @@ -127,6 +127,5 @@ - + diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.html b/src/addons/mod/bigbluebuttonbn/components/index/index.html index fc7415313..f3047f77a 100644 --- a/src/addons/mod/bigbluebuttonbn/components/index/index.html +++ b/src/addons/mod/bigbluebuttonbn/components/index/index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" (completionChanged)="onCompletionChange()"> @@ -114,7 +114,7 @@ - + diff --git a/src/addons/mod/book/components/index/addon-mod-book-index.html b/src/addons/mod/book/components/index/addon-mod-book-index.html index 3a1b9b960..8018382c7 100644 --- a/src/addons/mod/book/components/index/addon-mod-book-index.html +++ b/src/addons/mod/book/components/index/addon-mod-book-index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" (completionChanged)="onCompletionChange()"> @@ -41,7 +41,7 @@ - + diff --git a/src/addons/mod/chat/components/index/addon-mod-chat-index.html b/src/addons/mod/chat/components/index/addon-mod-chat-index.html index c55d7e8c7..42ffedbd5 100644 --- a/src/addons/mod/chat/components/index/addon-mod-chat-index.html +++ b/src/addons/mod/chat/components/index/addon-mod-chat-index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" (completionChanged)="onCompletionChange()"> @@ -31,7 +31,7 @@ - + diff --git a/src/addons/mod/choice/components/index/addon-mod-choice-index.html b/src/addons/mod/choice/components/index/addon-mod-choice-index.html index dbbb13b50..2dcdcf85c 100644 --- a/src/addons/mod/choice/components/index/addon-mod-choice-index.html +++ b/src/addons/mod/choice/components/index/addon-mod-choice-index.html @@ -10,7 +10,7 @@
+ [courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()"> @@ -146,7 +146,7 @@
- + diff --git a/src/addons/mod/data/components/index/addon-mod-data-index.html b/src/addons/mod/data/components/index/addon-mod-data-index.html index 3289a134c..bcd05f929 100644 --- a/src/addons/mod/data/components/index/addon-mod-data-index.html +++ b/src/addons/mod/data/components/index/addon-mod-data-index.html @@ -22,7 +22,7 @@ + [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings" (completionChanged)="onCompletionChange()"> @@ -120,8 +120,7 @@ - + diff --git a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html index f74b6c412..38fab03e8 100644 --- a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html +++ b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()"> @@ -52,7 +52,7 @@ - + diff --git a/src/addons/mod/folder/components/index/addon-mod-folder-index.html b/src/addons/mod/folder/components/index/addon-mod-folder-index.html index e4c02d9d6..9b5ac6cad 100644 --- a/src/addons/mod/folder/components/index/addon-mod-folder-index.html +++ b/src/addons/mod/folder/components/index/addon-mod-folder-index.html @@ -32,6 +32,6 @@ - diff --git a/src/addons/mod/forum/components/index/index.html b/src/addons/mod/forum/components/index/index.html index e49167d13..c5e3e54f1 100644 --- a/src/addons/mod/forum/components/index/index.html +++ b/src/addons/mod/forum/components/index/index.html @@ -14,7 +14,8 @@ + [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings" + (completionChanged)="onCompletionChange()"> {{descriptionNote}} @@ -114,8 +115,7 @@
- + diff --git a/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html b/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html index d391f6172..b32270973 100644 --- a/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html +++ b/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html @@ -27,7 +27,8 @@ + [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline || hasOfflineRatings" + (completionChanged)="onCompletionChange()"> @@ -72,8 +73,7 @@ - + diff --git a/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html b/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html index 0ef0f7b2d..f12d47baf 100644 --- a/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html +++ b/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html @@ -20,7 +20,7 @@ + [courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()"> @@ -68,6 +68,5 @@ - + diff --git a/src/addons/mod/imscp/components/index/addon-mod-imscp-index.html b/src/addons/mod/imscp/components/index/addon-mod-imscp-index.html index 9d025fe8d..c8916bc9b 100644 --- a/src/addons/mod/imscp/components/index/addon-mod-imscp-index.html +++ b/src/addons/mod/imscp/components/index/addon-mod-imscp-index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" (completionChanged)="onCompletionChange()"> @@ -38,7 +38,7 @@ - + diff --git a/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html b/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html index c3ca38e97..ea987e830 100644 --- a/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html +++ b/src/addons/mod/lesson/components/index/addon-mod-lesson-index.html @@ -14,7 +14,7 @@ + [courseId]="courseId" [hasDataToSync]="hasOffline" (completionChanged)="onCompletionChange()"> @@ -214,7 +214,7 @@ - + diff --git a/src/addons/mod/lti/components/index/addon-mod-lti-index.html b/src/addons/mod/lti/components/index/addon-mod-lti-index.html index 1ab132e1e..1a9fb4164 100644 --- a/src/addons/mod/lti/components/index/addon-mod-lti-index.html +++ b/src/addons/mod/lti/components/index/addon-mod-lti-index.html @@ -10,7 +10,7 @@ + [componentId]="componentId" [courseId]="courseId" (completionChanged)="onCompletionChange()">
@@ -21,7 +21,7 @@
- + diff --git a/src/addons/mod/page/components/index/addon-mod-page-index.html b/src/addons/mod/page/components/index/addon-mod-page-index.html index a080af3e6..0e92db006 100644 --- a/src/addons/mod/page/components/index/addon-mod-page-index.html +++ b/src/addons/mod/page/components/index/addon-mod-page-index.html @@ -10,7 +10,7 @@ + [componentId]="componentId" [courseId]="courseId" (completionChanged)="onCompletionChange()"> @@ -32,6 +32,5 @@ - + diff --git a/src/addons/mod/quiz/components/index/addon-mod-quiz-index.html b/src/addons/mod/quiz/components/index/addon-mod-quiz-index.html index 897861bcd..a8b1b7988 100644 --- a/src/addons/mod/quiz/components/index/addon-mod-quiz-index.html +++ b/src/addons/mod/quiz/components/index/addon-mod-quiz-index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" [hasDataToSync]="buttonText && hasOffline" (completionChanged)="onCompletionChange()"> @@ -213,7 +213,7 @@ - + diff --git a/src/addons/mod/resource/components/index/addon-mod-resource-index.html b/src/addons/mod/resource/components/index/addon-mod-resource-index.html index bcac791b8..9ce2df420 100644 --- a/src/addons/mod/resource/components/index/addon-mod-resource-index.html +++ b/src/addons/mod/resource/components/index/addon-mod-resource-index.html @@ -10,7 +10,7 @@ + [component]="component" [componentId]="componentId" (completionChanged)="onCompletionChange()"> @@ -98,7 +98,7 @@ {{ 'core.openwith' | translate }} - + diff --git a/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html b/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html index fb33799bb..5d3f06b43 100644 --- a/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html +++ b/src/addons/mod/scorm/components/index/addon-mod-scorm-index.html @@ -10,7 +10,7 @@ + [courseId]="courseId" [hasDataToSync]="!errorMessage && hasOffline" (completionChanged)="onCompletionChange()"> @@ -221,7 +221,7 @@ - + diff --git a/src/addons/mod/survey/components/index/addon-mod-survey-index.html b/src/addons/mod/survey/components/index/addon-mod-survey-index.html index 8c20281fe..b4370e1f6 100644 --- a/src/addons/mod/survey/components/index/addon-mod-survey-index.html +++ b/src/addons/mod/survey/components/index/addon-mod-survey-index.html @@ -10,7 +10,8 @@ + [component]="component" [componentId]="componentId" [courseId]="courseId" [hasDataToSync]="hasOffline" + (completionChanged)="onCompletionChange()"> @@ -130,7 +131,7 @@ - + diff --git a/src/addons/mod/url/components/index/addon-mod-url-index.html b/src/addons/mod/url/components/index/addon-mod-url-index.html index 0b115989f..085321c3f 100644 --- a/src/addons/mod/url/components/index/addon-mod-url-index.html +++ b/src/addons/mod/url/components/index/addon-mod-url-index.html @@ -10,7 +10,7 @@ + [componentId]="componentId" [courseId]="courseId" (completionChanged)="onCompletionChange()">
@@ -44,7 +44,7 @@ {{ 'addon.mod_url.accessurl' | translate }}
- + diff --git a/src/addons/mod/wiki/components/index/addon-mod-wiki-index.html b/src/addons/mod/wiki/components/index/addon-mod-wiki-index.html index 2b9a9d2e0..cfe144af2 100644 --- a/src/addons/mod/wiki/components/index/addon-mod-wiki-index.html +++ b/src/addons/mod/wiki/components/index/addon-mod-wiki-index.html @@ -31,7 +31,7 @@ + [courseId]="courseId" (completionChanged)="onCompletionChange()">
@@ -71,8 +71,7 @@
- + diff --git a/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html b/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html index 15e6f16dd..e36cc1c0f 100644 --- a/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html +++ b/src/addons/mod/workshop/components/index/addon-mod-workshop-index.html @@ -9,7 +9,7 @@ - + @@ -235,7 +235,7 @@ - + diff --git a/src/core/features/course/components/module-info/core-course-module-info.html b/src/core/features/course/components/module-info/core-course-module-info.html index a4e77744e..6078a0650 100644 --- a/src/core/features/course/components/module-info/core-course-module-info.html +++ b/src/core/features/course/components/module-info/core-course-module-info.html @@ -23,10 +23,12 @@ - + + [showCompletionConditions]="true" [showManualCompletion]="showManualCompletion && module.uservisible" + (completionChanged)="completionChanged.emit($event)"> diff --git a/src/core/features/course/components/module-info/module-info.ts b/src/core/features/course/components/module-info/module-info.ts index bd1fe0780..e66bc55e1 100644 --- a/src/core/features/course/components/module-info/module-info.ts +++ b/src/core/features/course/components/module-info/module-info.ts @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, Input, OnInit } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { CoreCourse } from '@features/course/services/course'; -import { CoreCourseModuleData } from '@features/course/services/course-helper'; +import { CoreCourseModuleCompletionData, CoreCourseModuleData } from '@features/course/services/course-helper'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreSites } from '@services/sites'; @@ -48,6 +48,9 @@ export class CoreCourseModuleInfoComponent implements OnInit { @Input() hasDataToSync = false; // If the activity has any data to be synced. + @Input() showManualCompletion = true; // Whether to show manual completion, true by default. + @Output() completionChanged = new EventEmitter(); // Notify when completion changes. + modicon = ''; showCompletion = false; // Whether to show completion. moduleNameTranslated = ''; diff --git a/src/core/features/course/components/module-navigation/core-course-module-navigation.html b/src/core/features/course/components/module-navigation/core-course-module-navigation.html index 3beaf4af2..6b092bfb8 100644 --- a/src/core/features/course/components/module-navigation/core-course-module-navigation.html +++ b/src/core/features/course/components/module-navigation/core-course-module-navigation.html @@ -6,13 +6,6 @@ - - - - - diff --git a/src/core/features/course/components/module-navigation/module-navigation.ts b/src/core/features/course/components/module-navigation/module-navigation.ts index af20ac47e..132e8c27a 100644 --- a/src/core/features/course/components/module-navigation/module-navigation.ts +++ b/src/core/features/course/components/module-navigation/module-navigation.ts @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { CoreCourse, CoreCourseProvider, CoreCourseWSSection } from '@features/course/services/course'; -import { CoreCourseModuleCompletionData, CoreCourseModuleData } from '@features/course/services/course-helper'; +import { CoreCourseModuleData } from '@features/course/services/course-helper'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { IonContent } from '@ionic/angular'; import { CoreNavigationOptions, CoreNavigator } from '@services/navigator'; @@ -27,7 +27,7 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events'; * Component to show a button to go to the next resource/activity. * * Example usage: - * + * */ @Component({ selector: 'core-course-module-navigation', @@ -37,21 +37,17 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events'; export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { @Input() courseId!: number; // Course ID. - @Input() currentModule!: CoreCourseModuleData; // Current module. - @Input() showManualCompletion = true; // Whether to show manual completion, true by default. - - @Output() completionChanged = new EventEmitter(); // Notify when completion changes. + @Input() currentModuleId!: number; // Current module Id. nextModule?: CoreCourseModuleData; previousModule?: CoreCourseModuleData; nextModuleSection?: CoreCourseWSSection; previousModuleSection?: CoreCourseWSSection; loaded = false; - showCompletion = false; // Whether to show completion. protected completionObserver: CoreEventObserver; - constructor(el: ElementRef, protected ionContent: IonContent) { + constructor(protected ionContent: IonContent) { const siteId = CoreSites.getCurrentSiteId(); this.completionObserver = CoreEvents.on(CoreEvents.COMPLETION_MODULE_VIEWED, async (data) => { @@ -70,8 +66,6 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { * @inheritdoc */ async ngOnInit(): Promise { - this.showCompletion = CoreSites.getRequiredCurrentSite().isVersionGreaterEqualThan('3.11'); - try { await this.setNextAndPreviousModules(CoreSitesReadingStrategy.PREFER_CACHE); } finally { @@ -104,7 +98,6 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { } const preSets = CoreSites.getReadingStrategyPreSets(readingStrategy); - const currentModuleId = this.currentModule.id; const sections = await CoreCourse.getSections(this.courseId, false, true, preSets); @@ -117,7 +110,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { return false; } - currentModuleIndex = section.modules.findIndex((module: CoreCourseModuleData) => module.id == currentModuleId); + currentModuleIndex = section.modules.findIndex((module: CoreCourseModuleData) => module.id == this.currentModuleId); return currentModuleIndex >= 0; }); diff --git a/src/core/features/course/pages/module-preview/module-preview.html b/src/core/features/course/pages/module-preview/module-preview.html index ee720ffd2..1ff4dfa65 100644 --- a/src/core/features/course/pages/module-preview/module-preview.html +++ b/src/core/features/course/pages/module-preview/module-preview.html @@ -24,7 +24,8 @@ + [componentId]="module.id" [expandDescription]="true" [showAvailabilityInfo]="true" (completionChanged)="onCompletionChange()" + [showManualCompletion]="showManualCompletion">
@@ -44,6 +45,6 @@ - + + diff --git a/src/core/features/siteplugins/components/module-index/core-siteplugins-module-index.html b/src/core/features/siteplugins/components/module-index/core-siteplugins-module-index.html index b47edea6c..287220e84 100644 --- a/src/core/features/siteplugins/components/module-index/core-siteplugins-module-index.html +++ b/src/core/features/siteplugins/components/module-index/core-siteplugins-module-index.html @@ -14,5 +14,5 @@ (onLoadingContent)="contentLoading()"> - +