commit
4f636824e3
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<div *ngIf="scorm && loaded && !scorm.warningMessage">
|
<div *ngIf="scorm && loaded && !scorm.warningMessage">
|
||||||
<!-- Attempts status. -->
|
<!-- Attempts status. -->
|
||||||
<ion-card *ngIf="scorm.displayattemptstatus || Object.keys(scorm.offlineAttempts).length">
|
<ion-card *ngIf="scorm.displayattemptstatus || (scorm.offlineAttempts && scorm.offlineAttempts.length)">
|
||||||
<ion-card-header text-wrap>
|
<ion-card-header text-wrap>
|
||||||
<h2>{{ 'addon.mod_scorm.attempts' | translate }}</h2>
|
<h2>{{ 'addon.mod_scorm.attempts' | translate }}</h2>
|
||||||
</ion-card-header>
|
</ion-card-header>
|
||||||
|
|
|
@ -113,4 +113,15 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa
|
||||||
getCourseFormatComponent(injector: Injector, course: any): any | Promise<any> {
|
getCourseFormatComponent(injector: Injector, course: any): any | Promise<any> {
|
||||||
return CoreCourseFormatSingleActivityComponent;
|
return CoreCourseFormatSingleActivityComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the view should be refreshed when completion changes. If your course format doesn't display
|
||||||
|
* activity completion then you should return false.
|
||||||
|
*
|
||||||
|
* @param {any} course The course.
|
||||||
|
* @return {boolean|Promise<boolean>} Whether course view should be refreshed when an activity completion changes.
|
||||||
|
*/
|
||||||
|
shouldRefreshWhenCompletionChanges(course: any): boolean | Promise<boolean> {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,11 +80,16 @@ export class CoreCourseSectionPage implements OnDestroy {
|
||||||
this.displayEnableDownload = courseFormatDelegate.displayEnableDownload(this.course);
|
this.displayEnableDownload = courseFormatDelegate.displayEnableDownload(this.course);
|
||||||
this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite();
|
this.downloadCourseEnabled = !this.coursesProvider.isDownloadCourseDisabledInSite();
|
||||||
|
|
||||||
|
// Check if the course format requires the view to be refreshed when completion changes.
|
||||||
|
courseFormatDelegate.shouldRefreshWhenCompletionChanges(this.course).then((shouldRefresh) => {
|
||||||
|
if (shouldRefresh) {
|
||||||
this.completionObserver = eventsProvider.on(CoreEventsProvider.COMPLETION_MODULE_VIEWED, (data) => {
|
this.completionObserver = eventsProvider.on(CoreEventsProvider.COMPLETION_MODULE_VIEWED, (data) => {
|
||||||
if (data && data.courseId == this.course.id) {
|
if (data && data.courseId == this.course.id) {
|
||||||
this.refreshAfterCompletionChange();
|
this.refreshAfterCompletionChange();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (this.downloadCourseEnabled) {
|
if (this.downloadCourseEnabled) {
|
||||||
// Listen for changes in course status.
|
// Listen for changes in course status.
|
||||||
|
|
|
@ -157,4 +157,15 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler {
|
||||||
openCourse(navCtrl: NavController, course: any): Promise<any> {
|
openCourse(navCtrl: NavController, course: any): Promise<any> {
|
||||||
return navCtrl.push('CoreCourseSectionPage', { course: course });
|
return navCtrl.push('CoreCourseSectionPage', { course: course });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the view should be refreshed when completion changes. If your course format doesn't display
|
||||||
|
* activity completion then you should return false.
|
||||||
|
*
|
||||||
|
* @param {any} course The course.
|
||||||
|
* @return {boolean|Promise<boolean>} Whether course view should be refreshed when an activity completion changes.
|
||||||
|
*/
|
||||||
|
shouldRefreshWhenCompletionChanges(course: any): boolean | Promise<boolean> {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,15 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler {
|
||||||
* @return {Promise<any>} Promise resolved when the data is invalidated.
|
* @return {Promise<any>} Promise resolved when the data is invalidated.
|
||||||
*/
|
*/
|
||||||
invalidateData?(course: any, sections: any[]): Promise<any>;
|
invalidateData?(course: any, sections: any[]): Promise<any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the view should be refreshed when completion changes. If your course format doesn't display
|
||||||
|
* activity completion then you should return false.
|
||||||
|
*
|
||||||
|
* @param {any} course The course.
|
||||||
|
* @return {boolean|Promise<boolean>} Whether course view should be refreshed when an activity completion changes.
|
||||||
|
*/
|
||||||
|
shouldRefreshWhenCompletionChanges?(course: any): boolean | Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -337,4 +346,15 @@ export class CoreCourseFormatDelegate extends CoreDelegate {
|
||||||
openCourse(navCtrl: NavController, course: any): Promise<any> {
|
openCourse(navCtrl: NavController, course: any): Promise<any> {
|
||||||
return this.executeFunctionOnEnabled(course.format, 'openCourse', [navCtrl, course]);
|
return this.executeFunctionOnEnabled(course.format, 'openCourse', [navCtrl, course]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the view should be refreshed when completion changes. If your course format doesn't display
|
||||||
|
* activity completion then you should return false.
|
||||||
|
*
|
||||||
|
* @param {any} course The course.
|
||||||
|
* @return {Promise<boolean>} Whether course view should be refreshed when an activity completion changes.
|
||||||
|
*/
|
||||||
|
shouldRefreshWhenCompletionChanges(course: any): Promise<boolean> {
|
||||||
|
return Promise.resolve(this.executeFunctionOnEnabled(course.format, 'shouldRefreshWhenCompletionChanges', [course]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,6 +297,8 @@ export class CoreQuestionBaseComponent {
|
||||||
this.question.input.correctClass = 'core-question-correct';
|
this.question.input.correctClass = 'core-question-correct';
|
||||||
} else if (input.classList.contains('partiallycorrect')) {
|
} else if (input.classList.contains('partiallycorrect')) {
|
||||||
this.question.input.correctClass = 'core-question-partiallycorrect';
|
this.question.input.correctClass = 'core-question-partiallycorrect';
|
||||||
|
} else {
|
||||||
|
this.question.input.correctClass = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue