MOBILE-2421 choice: Show how results will be published
parent
f602bafec3
commit
98e980c742
|
@ -32,6 +32,12 @@
|
||||||
<ion-icon name="warning"></ion-icon> {{ 'core.hasdatatosync' | translate:{$a: moduleName} }}
|
<ion-icon name="warning"></ion-icon> {{ 'core.hasdatatosync' | translate:{$a: moduleName} }}
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
||||||
|
<!-- Inform what will happen with the choices. -->
|
||||||
|
<div *ngIf="canEdit && publishInfo && options && options.length" class="core-info-card" icon-start>
|
||||||
|
<ion-icon name="information"></ion-icon>
|
||||||
|
{{ publishInfo | translate }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Choice options -->
|
<!-- Choice options -->
|
||||||
<ion-card *ngIf="options && options.length">
|
<ion-card *ngIf="options && options.length">
|
||||||
<ng-container *ngIf="choice.allowmultiple">
|
<ng-container *ngIf="choice.allowmultiple">
|
||||||
|
|
|
@ -42,6 +42,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
data = [];
|
data = [];
|
||||||
labels = [];
|
labels = [];
|
||||||
results = [];
|
results = [];
|
||||||
|
publishInfo: string; // Message explaining the user what will happen with his choices.
|
||||||
|
|
||||||
protected userId: number;
|
protected userId: number;
|
||||||
protected syncEventName = AddonModChoiceSyncProvider.AUTO_SYNCED;
|
protected syncEventName = AddonModChoiceSyncProvider.AUTO_SYNCED;
|
||||||
|
@ -238,6 +239,36 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
this.canEdit = isOpen && (this.choice.allowupdate || !hasAnswered);
|
this.canEdit = isOpen && (this.choice.allowupdate || !hasAnswered);
|
||||||
this.canDelete = isOpen && this.choice.allowupdate && hasAnswered;
|
this.canDelete = isOpen && this.choice.allowupdate && hasAnswered;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
|
if (this.canEdit) {
|
||||||
|
|
||||||
|
// Calculate the publish info message.
|
||||||
|
switch (this.choice.showresults) {
|
||||||
|
case AddonModChoiceProvider.RESULTS_NOT:
|
||||||
|
this.publishInfo = 'addon.mod_choice.publishinfonever';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AddonModChoiceProvider.RESULTS_AFTER_ANSWER:
|
||||||
|
if (this.choice.publish == AddonModChoiceProvider.PUBLISH_ANONYMOUS) {
|
||||||
|
this.publishInfo = 'addon.mod_choice.publishinfoanonafter';
|
||||||
|
} else {
|
||||||
|
this.publishInfo = 'addon.mod_choice.publishinfofullafter';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AddonModChoiceProvider.RESULTS_AFTER_CLOSE:
|
||||||
|
if (this.choice.publish == AddonModChoiceProvider.PUBLISH_ANONYMOUS) {
|
||||||
|
this.publishInfo = 'addon.mod_choice.publishinfoanonclose';
|
||||||
|
} else {
|
||||||
|
this.publishInfo = 'addon.mod_choice.publishinfofullclose';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// No need to inform the user since it's obvious that the results are being published.
|
||||||
|
this.publishInfo = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
"numberofuser": "Number of responses",
|
"numberofuser": "Number of responses",
|
||||||
"numberofuserinpercentage": "Percentage of responses",
|
"numberofuserinpercentage": "Percentage of responses",
|
||||||
"previewonly": "This is just a preview of the available options for this activity. You will not be able to submit your choice until {{$a}}.",
|
"previewonly": "This is just a preview of the available options for this activity. You will not be able to submit your choice until {{$a}}.",
|
||||||
|
"publishinfoanonafter": "Anonymous results will be published after you answer.",
|
||||||
|
"publishinfoanonclose": "Anonymous results will be published after the activity is closed.",
|
||||||
|
"publishinfofullafter": "Full results, showing everyone's choices, will be published after you answer.",
|
||||||
|
"publishinfofullclose": "Full results, showing everyone's choices, will be published after the activity is closed.",
|
||||||
|
"publishinfonever": "The results of this activity will not be published after you answer.",
|
||||||
"removemychoice": "Remove my choice",
|
"removemychoice": "Remove my choice",
|
||||||
"responses": "Responses",
|
"responses": "Responses",
|
||||||
"responsesresultgraphdescription": "{{number}}% of the users chose the option: {{text}}.",
|
"responsesresultgraphdescription": "{{number}}% of the users chose the option: {{text}}.",
|
||||||
|
|
|
@ -31,6 +31,9 @@ export class AddonModChoiceProvider {
|
||||||
static RESULTS_AFTER_CLOSE = 2;
|
static RESULTS_AFTER_CLOSE = 2;
|
||||||
static RESULTS_ALWAYS = 3;
|
static RESULTS_ALWAYS = 3;
|
||||||
|
|
||||||
|
static PUBLISH_ANONYMOUS = false;
|
||||||
|
static PUBLISH_NAMES = true;
|
||||||
|
|
||||||
protected ROOT_CACHE_KEY = 'mmaModChoice:';
|
protected ROOT_CACHE_KEY = 'mmaModChoice:';
|
||||||
|
|
||||||
constructor(private sitesProvider: CoreSitesProvider, private appProvider: CoreAppProvider,
|
constructor(private sitesProvider: CoreSitesProvider, private appProvider: CoreAppProvider,
|
||||||
|
|
Loading…
Reference in New Issue