forked from EVOgeek/Vmeda.Online
		
	
		
			
				
	
	
		
			169 lines
		
	
	
		
			8.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			169 lines
		
	
	
		
			8.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!-- Buttons to add to the header. -->
 | |
| <core-navbar-buttons slot="end">
 | |
|     <ion-button fill="clear" (click)="openModuleSummary()" aria-haspopup="true" [attr.aria-label]="'core.info' | translate">
 | |
|         <ion-icon name="fas-info-circle" slot="icon-only" aria-hidden="true"></ion-icon>
 | |
|     </ion-button>
 | |
| </core-navbar-buttons>
 | |
| 
 | |
| <!-- Content. -->
 | |
| <core-loading [hideUntil]="!showLoading">
 | |
| 
 | |
|     <!-- Activity info. -->
 | |
|     <core-course-module-info [module]="module" [description]="description" [component]="component" [componentId]="componentId"
 | |
|         [courseId]="courseId" [hasDataToSync]="hasOffline">
 | |
|     </core-course-module-info>
 | |
| 
 | |
|     <!-- Activity availability messages -->
 | |
|     <ion-card class="core-info-card" *ngIf="choiceNotOpenYet">
 | |
|         <ion-item>
 | |
|             <ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon>
 | |
|             <ion-label>
 | |
|                 <p *ngIf="options.length">{{ 'addon.mod_choice.previewonly' | translate:{$a: openTimeReadable} }}</p>
 | |
|                 <p *ngIf="!options.length">{{ 'addon.mod_choice.notopenyet' | translate:{$a: openTimeReadable} }}</p>
 | |
|             </ion-label>
 | |
|         </ion-item>
 | |
|     </ion-card>
 | |
| 
 | |
|     <ion-card class="core-info-card" *ngIf="choiceClosed">
 | |
|         <ion-item>
 | |
|             <ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon>
 | |
|             <ion-label>
 | |
|                 <p *ngIf="options.length">
 | |
|                     {{ 'addon.mod_choice.yourselection' | translate }}
 | |
|                     <core-format-text [text]="options[0].text" contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId">
 | |
|                     </core-format-text>
 | |
|                 </p>
 | |
|                 <p>{{ 'addon.mod_choice.expired' | translate:{$a: closeTimeReadable} }}</p>
 | |
|             </ion-label>
 | |
|         </ion-item>
 | |
|     </ion-card>
 | |
| 
 | |
|     <!-- Inform what will happen with the choices. -->
 | |
|     <ion-card class="core-info-card" *ngIf="canEdit && publishInfo && options.length">
 | |
|         <ion-item>
 | |
|             <ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon>
 | |
|             <ion-label>{{ publishInfo | translate }}</ion-label>
 | |
|         </ion-item>
 | |
|     </ion-card>
 | |
| 
 | |
|     <!-- Choice options -->
 | |
|     <ion-card *ngIf="options.length && choice">
 | |
|         <ng-container *ngIf="choice.allowmultiple">
 | |
|             <ion-item class="ion-text-wrap" *ngFor="let option of options">
 | |
|                 <ion-label>
 | |
|                     <ng-container *ngTemplateOutlet="optionLabelTemplate; context: {option: option}"></ng-container>
 | |
|                 </ion-label>
 | |
|                 <ion-checkbox slot="end" [(ngModel)]="option.checked" [disabled]="option.disabled || !canEdit"></ion-checkbox>
 | |
|             </ion-item>
 | |
|         </ng-container>
 | |
|         <ion-radio-group *ngIf="!choice.allowmultiple" [(ngModel)]="selectedOption.id">
 | |
|             <ion-item class="ion-text-wrap" *ngFor="let option of options">
 | |
|                 <ion-label>
 | |
|                     <ng-container *ngTemplateOutlet="optionLabelTemplate; context: {option: option}"></ng-container>
 | |
|                 </ion-label>
 | |
|                 <ion-radio slot="end" [value]="option.id" [disabled]="option.disabled || !canEdit"></ion-radio>
 | |
|             </ion-item>
 | |
|         </ion-radio-group>
 | |
|     </ion-card>
 | |
| 
 | |
|     <!-- Choice results -->
 | |
|     <div *ngIf="canSeeResults && choice">
 | |
|         <ion-item-divider>
 | |
|             <ion-label>
 | |
|                 <h2>{{ 'addon.mod_choice.responses' | translate }}</h2>
 | |
|             </ion-label>
 | |
|         </ion-item-divider>
 | |
|         <ion-grid class="ion-no-padding">
 | |
|             <ion-row>
 | |
|                 <ion-col size="12" size-lg="5">
 | |
|                     <ion-item class="ion-text-wrap core-warning-item" *ngIf="hasOffline">
 | |
|                         <ion-icon slot="start" name="fas-exclamation-triangle" color="warning" aria-hidden="true"></ion-icon>
 | |
|                         <ion-label>{{ 'addon.mod_choice.resultsnotsynced' | translate }}</ion-label>
 | |
|                     </ion-item>
 | |
|                     <ion-item>
 | |
|                         <ion-label>
 | |
|                             <core-chart type="pie" [data]="data" [labels]="labels" height="300" contextLevel="module"
 | |
|                                 [contextInstanceId]="module.id" [courseId]="courseId">
 | |
|                             </core-chart>
 | |
|                         </ion-label>
 | |
|                     </ion-item>
 | |
|                 </ion-col>
 | |
|                 <ion-col *ngIf="choice.publish && results" size="12" size-lg="7">
 | |
|                     <ion-item-group *ngFor="let result of results">
 | |
|                         <ion-item [button]="result.numberofuser > 0" class="divider ion-text-wrap" (click)="toggle(result)"
 | |
|                             [attr.aria-label]="(result.expanded ? 'core.collapse' : 'core.expand') | translate" detail="false">
 | |
|                             <ion-icon [name]="result.numberofuser > 0 ? 'fas-chevron-right' : ''" flip-rtl slot="start" aria-hidden="true"
 | |
|                                 class="expandable-status-icon" [class.expandable-status-icon-expanded]="result.expanded">
 | |
|                             </ion-icon>
 | |
|                             <ion-label>
 | |
|                                 <h3 class="item-heading">
 | |
|                                     <core-format-text [text]="result.text" contextLevel="module" [contextInstanceId]="module.id"
 | |
|                                         [courseId]="courseId">
 | |
|                                     </core-format-text>
 | |
|                                 </h3>
 | |
|                                 <p>
 | |
|                                     {{ 'addon.mod_choice.numberofuser' | translate }}: {{ result.numberofuser }}
 | |
|                                     ({{ 'core.percentagenumber' | translate: {$a: result.percentageamountfixed} }})
 | |
|                                 </p>
 | |
|                                 <p *ngIf="choice.limitanswers && choice.showavailable">
 | |
|                                     {{ 'addon.mod_choice.limita' | translate:{$a: result.maxanswer} }}
 | |
|                                 </p>
 | |
|                             </ion-label>
 | |
|                         </ion-item>
 | |
|                         <ng-container *ngIf="result.expanded">
 | |
|                             <ion-item *ngFor="let user of result.userresponses" core-user-link [courseId]="courseId" [userId]="user.userid"
 | |
|                                 [attr.aria-label]="user.fullname" class="ion-text-wrap">
 | |
|                                 <core-user-avatar [user]="user" slot="start" [courseId]="courseId"></core-user-avatar>
 | |
|                                 <ion-label>
 | |
|                                     <p>{{user.fullname}}</p>
 | |
|                                 </ion-label>
 | |
|                             </ion-item>
 | |
|                         </ng-container>
 | |
|                     </ion-item-group>
 | |
|                 </ion-col>
 | |
|             </ion-row>
 | |
|         </ion-grid>
 | |
|     </div>
 | |
| 
 | |
|     <ion-card class="core-info-card" *ngIf="!canSeeResults && !choiceNotOpenYet">
 | |
|         <ion-item>
 | |
|             <ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon>
 | |
|             <ion-label>
 | |
|                 <p>{{ 'addon.mod_choice.noresultsviewable' | translate }}</p>
 | |
|             </ion-label>
 | |
|         </ion-item>
 | |
|     </ion-card>
 | |
| 
 | |
| 
 | |
|     <div collapsible-footer *ngIf="!showLoading" slot="fixed">
 | |
|         <div class="list-item-limited-width adaptable-buttons-row" *ngIf="options.length && choice && (canEdit || canDelete)">
 | |
|             <ion-button *ngIf="canDelete" expand="block" fill="outline" (click)="delete()" class="ion-margin ion-text-wrap">
 | |
|                 {{ 'addon.mod_choice.removemychoice' | translate }}
 | |
|             </ion-button>
 | |
|             <ion-button *ngIf="canEdit" expand="block" (click)="save()" [disabled]="!canSave()" class="ion-margin ion-text-wrap">
 | |
|                 {{ 'addon.mod_choice.savemychoice' | translate }}
 | |
|             </ion-button>
 | |
|         </div>
 | |
| 
 | |
|         <core-course-module-navigation [courseId]="courseId" [currentModule]="module" (completionChanged)="onCompletionChange()">
 | |
|         </core-course-module-navigation>
 | |
|     </div>
 | |
| </core-loading>
 | |
| 
 | |
| 
 | |
| 
 | |
| <!-- Template to render a choice option label. -->
 | |
| <ng-template #optionLabelTemplate let-option="option">
 | |
|     <p>
 | |
|         <core-format-text [text]="option.text" contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId">
 | |
|         </core-format-text>
 | |
|         <span *ngIf="choice!.limitanswers && option.countanswers >= option.maxanswers">
 | |
|             {{ 'addon.mod_choice.full' | translate }}
 | |
|         </span>
 | |
|     </p>
 | |
|     <ng-container *ngIf="choice!.limitanswers && choice!.showavailable">
 | |
|         <p>{{ 'addon.mod_choice.responsesa' | translate:{$a: option.countanswers} }}</p>
 | |
|         <p>{{ 'addon.mod_choice.limita' | translate:{$a: option.maxanswers} }}</p>
 | |
|     </ng-container>
 | |
| </ng-template>
 |