MOBILE-1355 scorm: Display score in the TOC

main
Dani Palou 2019-10-23 11:05:07 +02:00
parent 44df1d4c2b
commit 1a98e4de66
8 changed files with 18 additions and 1 deletions

View File

@ -869,6 +869,7 @@
"addon.mod_scorm.organizations": "scorm",
"addon.mod_scorm.passed": "scorm",
"addon.mod_scorm.reviewmode": "scorm",
"addon.mod_scorm.score": "scorm",
"addon.mod_scorm.scormstatusnotdownloaded": "local_moodlemobileapp",
"addon.mod_scorm.scormstatusoutdated": "local_moodlemobileapp",
"addon.mod_scorm.suspended": "scorm",
@ -1564,6 +1565,7 @@
"core.login.auth_email": "auth_email/pluginname",
"core.login.authenticating": "local_moodlemobileapp",
"core.login.cancel": "moodle",
"core.login.changepassowrdinstructions": "local_moodlemobileapp",
"core.login.changepassword": "moodle",
"core.login.changepasswordbutton": "local_moodlemobileapp",
"core.login.changepasswordhelp": "local_moodlemobileapp",

View File

@ -100,6 +100,7 @@
<img [src]="sco.image.url" [alt]="sco.image.description" />
<a *ngIf="sco.prereq && sco.launch" (click)="open($event, sco.id)"><core-format-text [text]="sco.title" contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId"></core-format-text></a>
<span *ngIf="!sco.prereq || !sco.launch"><core-format-text [text]="sco.title" contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId"></core-format-text></span>
<span *ngIf="accessInfo && accessInfo.canviewscores && sco.score_raw">({{ 'addon.mod_scorm.score' | translate }}: {{sco.score_raw}})</span>
</p>
</div>
</ion-item>

View File

@ -44,6 +44,7 @@
"organizations": "Organisations",
"passed": "Passed",
"reviewmode": "Review mode",
"score": "Score",
"scormstatusnotdownloaded": "This SCORM package is not downloaded. It will be automatically downloaded when you open it.",
"scormstatusoutdated": "This SCORM package has been modified since the last download. It will be automatically downloaded when you open it.",
"suspended": "Suspended",

View File

@ -45,6 +45,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
nextSco: any; // Next SCO.
src: string; // Iframe src.
errorMessage: string; // Error message.
accessInfo: any; // Access information.
protected siteId: string;
protected mode: string; // Mode to play the SCORM.
@ -239,6 +240,10 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
.then((data) => {
this.userData = data;
}));
// Get access information.
promises.push(this.scormProvider.getAccessInformation(this.scorm.id).then((accessInfo) => {
this.accessInfo = accessInfo;
}));
return Promise.all(promises);
});
@ -394,7 +399,8 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
mode: this.mode,
selected: this.currentSco && this.currentSco.id,
moduleId: this.scorm.coursemodule,
courseId: this.scorm.course
courseId: this.scorm.course,
accessInfo: this.accessInfo
}, { cssClass: 'core-modal-lateral',
showBackdrop: true,
enableBackdropDismiss: true,

View File

@ -26,6 +26,7 @@
<a *ngIf="sco.isvisible" ion-item text-wrap [ngClass]="'core-padding-' + sco.level" [class.core-nav-item-selected]="selected == sco.id" (click)="loadSco(sco)" [attr.disabled]="!sco.prereq || !sco.launch ? true : null" [attr.detail-none]="!sco.prereq || !sco.launch ? true : null">
<img [src]="sco.image.url" [alt]="sco.image.description" />
<core-format-text [text]="sco.title" contextLevel="module" [contextInstanceId]="moduleId" [courseId]="courseId"></core-format-text>
<span *ngIf="accessInfo && accessInfo.canviewscores && sco.score_raw">({{ 'addon.mod_scorm.score' | translate }}: {{sco.score_raw}})</span>
</a>
</ng-container>
</ion-list>

View File

@ -32,12 +32,14 @@ export class AddonModScormTocPage {
selected: number;
moduleId: number;
courseId: number;
accessInfo: any;
constructor(navParams: NavParams, private viewCtrl: ViewController) {
this.toc = navParams.get('toc') || [];
this.attemptToContinue = navParams.get('attemptToContinue');
this.moduleId = navParams.get('moduleId');
this.courseId = navParams.get('courseId');
this.accessInfo = navParams.get('accessInfo');
const mode = navParams.get('mode');
this.selected = navParams.get('selected');

View File

@ -949,6 +949,9 @@ export class AddonModScormProvider {
// Exit var.
sco.exitvar = typeof scoData.exitvar == 'undefined' ? 'cmi.core.exit' : scoData.exitvar;
sco.exitvalue = scoData[sco.exitvar];
// Copy score.
sco.score_raw = scoData.score_raw;
});
return scos;

View File

@ -868,6 +868,7 @@
"addon.mod_scorm.organizations": "Organisations",
"addon.mod_scorm.passed": "Passed",
"addon.mod_scorm.reviewmode": "Review mode",
"addon.mod_scorm.score": "Score",
"addon.mod_scorm.scormstatusnotdownloaded": "This SCORM package is not downloaded. It will be automatically downloaded when you open it.",
"addon.mod_scorm.scormstatusoutdated": "This SCORM package has been modified since the last download. It will be automatically downloaded when you open it.",
"addon.mod_scorm.suspended": "Suspended",