Merge pull request #1469 from crazyserver/MOBILE-2487

MOBILE-2487 workshop: Show phase plan instead of selector
main
Juan Leyva 2018-08-22 14:46:15 +01:00 committed by GitHub
commit 7c437c8c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 202 additions and 197 deletions

View File

@ -70,14 +70,14 @@
<ion-row align-items-center> <ion-row align-items-center>
<ion-col *ngIf="search.page > 0"> <ion-col *ngIf="search.page > 0">
<button ion-button block outline icon-start (click)="searchEntries(search.page - 1)"> <button ion-button block outline icon-start (click)="searchEntries(search.page - 1)">
<ion-icon name="arrow-back"></ion-icon> <ion-icon name="arrow-back" md="ios-arrow-back"></ion-icon>
{{ 'core.previous' | translate }} {{ 'core.previous' | translate }}
</button> </button>
</ion-col> </ion-col>
<ion-col *ngIf="hasNextPage"> <ion-col *ngIf="hasNextPage">
<button ion-button block icon-end (click)="searchEntries(search.page + 1)"> <button ion-button block icon-end (click)="searchEntries(search.page + 1)">
{{ 'core.next' | translate }} {{ 'core.next' | translate }}
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward" md="ios-arrow-forward"></ion-icon>
</button> </button>
</ion-col> </ion-col>
</ion-row> </ion-row>

View File

@ -38,14 +38,14 @@
<ion-row align-items-center> <ion-row align-items-center>
<ion-col *ngIf="previousId"> <ion-col *ngIf="previousId">
<button ion-button block outline icon-start (click)="gotoEntry(previousId)"> <button ion-button block outline icon-start (click)="gotoEntry(previousId)">
<ion-icon name="arrow-back"></ion-icon> <ion-icon name="arrow-back" md="ios-arrow-back"></ion-icon>
{{ 'core.previous' | translate }} {{ 'core.previous' | translate }}
</button> </button>
</ion-col> </ion-col>
<ion-col *ngIf="nextId"> <ion-col *ngIf="nextId">
<button ion-button block icon-end (click)="gotoEntry(nextId)"> <button ion-button block icon-end (click)="gotoEntry(nextId)">
{{ 'core.next' | translate }} {{ 'core.next' | translate }}
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward" md="ios-arrow-forward"></ion-icon>
</button> </button>
</ion-col> </ion-col>
</ion-row> </ion-row>

View File

@ -12,23 +12,14 @@
<!-- Content. --> <!-- Content. -->
<core-loading [hideUntil]="loaded" class="core-loading-center"> <core-loading [hideUntil]="loaded" class="core-loading-center">
<core-course-module-description *ngIf="description && selectedPhase == workshopPhases.PHASE_SETUP" [description]="description" [component]="component" [componentId]="componentId"></core-course-module-description> <core-course-module-description *ngIf="description" [description]="description" [component]="component" [componentId]="componentId"></core-course-module-description>
<ion-card class="with-borders" *ngIf="phases"> <ion-card class="with-borders" *ngIf="phases">
<a ion-item (click)="selectPhase()" detail-none> <a ion-item (click)="viewPhaseInfo()">
<h2 stacked text-wrap>{{ phases[selectedPhase].title }}</h2> <h2 stacked text-wrap>{{ phases[workshop.phase].title }}</h2>
<p text-wrap *ngIf="phases[selectedPhase].code == workshop.phase">{{ 'addon.mod_workshop.userplancurrentphase' | translate }}</p>
<ion-icon item-end name="arrow-dropdown"></ion-icon>
</a> </a>
<a ion-item text-wrap *ngIf="phases[selectedPhase].switchUrl" [href]="phases[selectedPhase].switchUrl" detail-none> <ng-container *ngIf="phases && phases[workshop.phase] && phases[workshop.phase].tasks && phases[workshop.phase].tasks.length">
<ion-icon item-start name="swap"></ion-icon> <a ion-item text-wrap *ngFor="let task of phases[workshop.phase].tasks" (click)="runTask(task)" detail-none>
{{ 'addon.mod_workshop.switchphase' + selectedPhase | translate }}
<ion-icon item-end name="open"></ion-icon>
</a>
</ion-card>
<ion-card class="with-borders" *ngIf="phases && phases[selectedPhase] && phases[selectedPhase].tasks && phases[selectedPhase].tasks.length">
<a ion-item text-wrap *ngFor="let task of phases[selectedPhase].tasks" [class.item-dimmed]="selectedPhase != workshop.phase" (click)="runTask(task)" detail-none>
<ion-icon item-start name="radio-button-off" *ngIf="task.completed == null"></ion-icon> <ion-icon item-start name="radio-button-off" *ngIf="task.completed == null"></ion-icon>
<ion-icon item-start name="close-circle" color="danger" *ngIf="task.completed == ''"></ion-icon> <ion-icon item-start name="close-circle" color="danger" *ngIf="task.completed == ''"></ion-icon>
<ion-icon item-start name="information-circle" color="info" *ngIf="task.completed == 'info'"></ion-icon> <ion-icon item-start name="information-circle" color="info" *ngIf="task.completed == 'info'"></ion-icon>
@ -36,8 +27,9 @@
<h2>{{task.title}}</h2> <h2>{{task.title}}</h2>
<p *ngIf="task.details"><core-format-text [text]="task.details"></core-format-text></p> <p *ngIf="task.details"><core-format-text [text]="task.details"></core-format-text></p>
<ion-icon item-end *ngIf="task.link && !task.support" name="open"></ion-icon> <ion-icon item-end *ngIf="task.link && task.code != 'submit'" name="open"></ion-icon>
</a> </a>
</ng-container>
</ion-card> </ion-card>
<!-- Has something offline. --> <!-- Has something offline. -->
@ -46,72 +38,9 @@
{{ 'core.hasdatatosync' | translate: {$a: moduleName} }} {{ 'core.hasdatatosync' | translate: {$a: moduleName} }}
</div> </div>
<div *ngIf="access && workshop && workshop.phase >= selectedPhase"> <div *ngIf="access && workshop && workshop.phase >= workshopPhases.PHASE_SUBMISSION">
<!-- SUBMISSION PHASE -->
<ng-container *ngIf="selectedPhase == workshopPhases.PHASE_SUBMISSION">
<ion-card *ngIf="workshop.instructauthors">
<ion-item text-wrap>
<h2>{{ 'addon.mod_workshop.areainstructauthors' | translate }}</h2>
<core-format-text fullOnClick="true" [component]="component" [componentId]="workshop.cmid" [text]="workshop.instructauthors"></core-format-text>
</ion-item>
</ion-card>
<ion-card class="with-borders" *ngIf="canSubmit">
<ion-item text-wrap *ngIf="!submission">
<h2>{{ 'addon.mod_workshop.yoursubmission' | translate }}</h2>
<p>{{ 'addon.mod_workshop.noyoursubmission' | translate }}</p>
</ion-item>
<ng-container *ngIf="submission">
<addon-mod-workshop-submission [submission]="submission" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access"></addon-mod-workshop-submission>
</ng-container>
</ion-card>
<!-- Show only on current phase -->
<ng-container *ngIf="workshop.phase == selectedPhase">
<ion-item text-wrap *ngIf="canSubmit && ((access.creatingsubmissionallowed && !submission) || (access.modifyingsubmissionallowed && submission))">
<button ion-button icon-start block *ngIf="access.creatingsubmissionallowed && !submission" (click)="runTaskByCode('submit')">
<ion-icon name="add"></ion-icon>
{{ 'addon.mod_workshop.createsubmission' | translate }}
</button>
<button ion-button icon-start block *ngIf="access.modifyingsubmissionallowed && submission" (click)="runTaskByCode('submit')">
<ion-icon name="create"></ion-icon>
{{ 'addon.mod_workshop.editsubmission' | translate }}
</button>
</ion-item>
</ng-container>
</ng-container>
<!-- ASSESSMENT PHASE -->
<ng-container *ngIf="selectedPhase == workshopPhases.PHASE_ASSESSMENT">
<ion-card *ngIf="workshop.instructreviewers">
<ion-item text-wrap>
<h2>{{ 'addon.mod_workshop.areainstructreviewers' | translate }}</h2>
<core-format-text fullOnClick="true" [component]="component" [componentId]="workshop.cmid" [text]="workshop.instructreviewers"></core-format-text>
</ion-item>
</ion-card>
<ion-card class="with-borders" *ngIf="canAssess && assessments && assessments.length">
<ion-item text-wrap>
<h2>{{ 'addon.mod_workshop.assignedassessments' | translate }}</h2>
</ion-item>
<ng-container *ngFor="let assessment of assessments">
<addon-mod-workshop-submission [submission]="assessment.submission" [assessment]="assessment" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access" summary="true"></addon-mod-workshop-submission>
</ng-container>
</ion-card >
</ng-container>
<ion-card class="with-borders" *ngIf="!access.canviewallsubmissions && selectedPhase == workshop.phase && (canSubmit || canAssess) && selectedPhase == workshopPhases.PHASE_EVALUATION">
<a ion-item text-wrap *ngIf="submission" (click)="switchPhase(workshopPhases.PHASE_SUBMISSION)" detail-push>
<h2>{{ 'addon.mod_workshop.yoursubmission' | translate }}</h2>
</a>
<a ion-item text-wrap *ngIf="canAssess" (click)="switchPhase(workshopPhases.PHASE_ASSESSMENT)" detail-push>
<h2>{{ 'addon.mod_workshop.assignedassessments' | translate }}</h2>
</a>
</ion-card>
<!-- CLOSED PHASE --> <!-- CLOSED PHASE -->
<ng-container *ngIf="selectedPhase == workshopPhases.PHASE_CLOSED"> <ng-container *ngIf="workshop.phase >= workshopPhases.PHASE_CLOSED">
<ion-card *ngIf="workshop.conclusion"> <ion-card *ngIf="workshop.conclusion">
<ion-item text-wrap> <ion-item text-wrap>
<h2>{{ 'addon.mod_workshop.conclusion' | translate }}</h2> <h2>{{ 'addon.mod_workshop.conclusion' | translate }}</h2>
@ -123,34 +52,91 @@
<ion-item-divider color="light" text-wrap> <ion-item-divider color="light" text-wrap>
<h2>{{ 'addon.mod_workshop.yourgrades' | translate }}</h2> <h2>{{ 'addon.mod_workshop.yourgrades' | translate }}</h2>
</ion-item-divider> </ion-item-divider>
<a ion-item text-wrap *ngIf="userGrades.submissionlongstrgrade" (click)="switchPhase(workshopPhases.PHASE_SUBMISSION)" detail-push> <ion-item text-wrap *ngIf="userGrades.submissionlongstrgrade">
<h2>{{ 'addon.mod_workshop.submissiongrade' | translate }}</h2> <h2>{{ 'addon.mod_workshop.submissiongrade' | translate }}</h2>
<core-format-text [text]="userGrades.submissionlongstrgrade"></core-format-text> <core-format-text [text]="userGrades.submissionlongstrgrade"></core-format-text>
</a> </ion-item>
<a ion-item text-wrap *ngIf="userGrades.assessmentlongstrgrade" (click)="switchPhase(workshopPhases.PHASE_ASSESSMENT)" detail-push> <ion-item text-wrap *ngIf="userGrades.assessmentlongstrgrade">
<h2>{{ 'addon.mod_workshop.gradinggrade' | translate }}</h2> <h2>{{ 'addon.mod_workshop.gradinggrade' | translate }}</h2>
<core-format-text [text]="userGrades.assessmentlongstrgrade"></core-format-text> <core-format-text [text]="userGrades.assessmentlongstrgrade"></core-format-text>
</a> </ion-item>
</ion-card>
</ng-container>
<!-- SUBMISSION PHASE -->
<ion-card *ngIf="workshop.phase == workshopPhases.PHASE_SUBMISSION && workshop.instructauthors">
<ion-item text-wrap>
<h2>{{ 'addon.mod_workshop.areainstructauthors' | translate }}</h2>
<core-format-text fullOnClick="true" [component]="component" [componentId]="workshop.cmid" [text]="workshop.instructauthors"></core-format-text>
</ion-item>
</ion-card> </ion-card>
<ion-card class="with-borders" *ngIf="publishedSubmissions && publishedSubmissions.length"> <ion-card *ngIf="canSubmit">
<ion-item text-wrap> <ion-item text-wrap *ngIf="!submission">
<h2>{{ 'addon.mod_workshop.publishedsubmissions' | translate }}</h2> <h2>{{ 'addon.mod_workshop.yoursubmission' | translate }}</h2>
<p>{{ 'addon.mod_workshop.noyoursubmission' | translate }}</p>
</ion-item> </ion-item>
<ng-container *ngIf="submission">
<ion-item-divider color="light" text-wrap>
<h2>{{ 'addon.mod_workshop.yoursubmission' | translate }}</h2>
</ion-item-divider>
<addon-mod-workshop-submission [submission]="submission" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access"></addon-mod-workshop-submission>
</ng-container>
</ion-card>
<!-- Show only on current phase -->
<ng-container *ngIf="workshop.phase == workshopPhases.PHASE_SUBMISSION">
<ion-item text-wrap *ngIf="canSubmit && ((access.creatingsubmissionallowed && !submission) || (access.modifyingsubmissionallowed && submission))">
<button ion-button icon-start block *ngIf="access.creatingsubmissionallowed && !submission" (click)="gotoSubmit()">
<ion-icon name="add"></ion-icon>
{{ 'addon.mod_workshop.createsubmission' | translate }}
</button>
<button ion-button icon-start block *ngIf="access.modifyingsubmissionallowed && submission" (click)="gotoSubmit()">
<ion-icon name="create"></ion-icon>
{{ 'addon.mod_workshop.editsubmission' | translate }}
</button>
</ion-item>
</ng-container>
<ng-container *ngIf="workshop.phase >= workshopPhases.PHASE_CLOSED">
<ion-card class="with-borders" *ngIf="publishedSubmissions && publishedSubmissions.length">
<ion-item-divider color="light" text-wrap>
<h2>{{ 'addon.mod_workshop.publishedsubmissions' | translate }}</h2>
</ion-item-divider>
<ng-container *ngFor="let submission of publishedSubmissions"> <ng-container *ngFor="let submission of publishedSubmissions">
<addon-mod-workshop-submission [submission]="submission" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access" summary="true"></addon-mod-workshop-submission> <addon-mod-workshop-submission [submission]="submission" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access" summary="true"></addon-mod-workshop-submission>
</ng-container> </ng-container>
</ion-card> </ion-card>
</ng-container> </ng-container>
<!-- ASSESSMENT PHASE -->
<ng-container *ngIf="workshop.phase >= workshopPhases.PHASE_ASSESSMENT">
<ion-card *ngIf="workshop.phase == workshopPhases.PHASE_ASSESSMENT && workshop.instructreviewers">
<ion-item text-wrap>
<h2>{{ 'addon.mod_workshop.areainstructreviewers' | translate }}</h2>
<core-format-text fullOnClick="true" [component]="component" [componentId]="workshop.cmid" [text]="workshop.instructreviewers"></core-format-text>
</ion-item>
</ion-card>
<ion-card class="with-borders" *ngIf="canAssess && assessments && assessments.length">
<ion-item-divider color="light" text-wrap>
<h2>{{ 'addon.mod_workshop.assignedassessments' | translate }}</h2>
</ion-item-divider>
<ng-container *ngFor="let assessment of assessments">
<addon-mod-workshop-submission [submission]="assessment.submission" [assessment]="assessment" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access" summary="true"></addon-mod-workshop-submission>
</ng-container>
</ion-card >
</ng-container>
<!-- MULTIPLE PHASES SUBMISSION OR GREATER only teachers --> <!-- MULTIPLE PHASES SUBMISSION OR GREATER only teachers -->
<ion-card class="with-borders" *ngIf="workshop.phase == selectedPhase && access.canviewallsubmissions && selectedPhase >= workshopPhases.PHASE_SUBMISSION && grades && grades.length"> <ion-card class="with-borders" *ngIf="access.canviewallsubmissions && workshop.phase >= workshopPhases.PHASE_SUBMISSION && grades && grades.length">
<ion-item text-wrap *ngIf="selectedPhase == workshopPhases.PHASE_SUBMISSION"> <ion-item-divider color="light" text-wrap *ngIf="workshop.phase == workshopPhases.PHASE_SUBMISSION">
<h2>{{ 'addon.mod_workshop.submissionsreport' | translate }}</h2> <h2>{{ 'addon.mod_workshop.submissionsreport' | translate }}</h2>
</ion-item> </ion-item-divider>
<ion-item text-wrap *ngIf="selectedPhase > workshopPhases.PHASE_SUBMISSION"> <ion-item-divider color="light" text-wrap *ngIf="workshop.phase > workshopPhases.PHASE_SUBMISSION">
<h2>{{ 'addon.mod_workshop.gradesreport' | translate }}</h2> <h2>{{ 'addon.mod_workshop.gradesreport' | translate }}</h2>
</ion-item> </ion-item-divider>
<ion-item text-wrap *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)"> <ion-item text-wrap *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)">
<ion-label id="addon-workshop-groupslabel" *ngIf="groupInfo.separateGroups">{{ 'core.groupsseparate' | translate }}</ion-label> <ion-label id="addon-workshop-groupslabel" *ngIf="groupInfo.separateGroups">{{ 'core.groupsseparate' | translate }}</ion-label>
<ion-label id="addon-workshop-groupslabel" *ngIf="groupInfo.visibleGroups">{{ 'core.groupsvisible' | translate }}</ion-label> <ion-label id="addon-workshop-groupslabel" *ngIf="groupInfo.visibleGroups">{{ 'core.groupsvisible' | translate }}</ion-label>
@ -166,15 +152,15 @@
<ion-grid *ngIf="page > 0 || hasNextPage"> <ion-grid *ngIf="page > 0 || hasNextPage">
<ion-row align-items-center> <ion-row align-items-center>
<ion-col *ngIf="page > 0"> <ion-col *ngIf="page > 0">
<button ion-button block outline icon-start (click)="gotoSubmissionsPage(page - 1)">> <button ion-button block outline icon-start (click)="gotoSubmissionsPage(page - 1)">
<ion-icon name="arrow-back"></ion-icon> <ion-icon name="arrow-back" md="ios-arrow-back"></ion-icon>
{{ 'core.previous' | translate }} {{ 'core.previous' | translate }}
</button> </button>
</ion-col> </ion-col>
<ion-col *ngIf="hasNextPage"> <ion-col *ngIf="hasNextPage">
<button ion-button block icon-end (click)="gotoSubmissionsPage(page + 1)"> <button ion-button block icon-end (click)="gotoSubmissionsPage(page + 1)">
{{ 'core.next' | translate }} {{ 'core.next' | translate }}
<ion-icon name="arrow-forward"></ion-icon> <ion-icon name="arrow-forward" md="ios-arrow-forward"></ion-icon>
</button> </button>
</ion-col> </ion-col>
</ion-row> </ion-row>

View File

@ -41,7 +41,6 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
assessments: any; assessments: any;
userGrades: any; userGrades: any;
publishedSubmissions: any; publishedSubmissions: any;
selectedPhase: number;
submission: any; submission: any;
groupInfo: CoreGroupInfo = { groupInfo: CoreGroupInfo = {
groups: [], groups: [],
@ -61,9 +60,6 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
}; };
protected offlineSubmissions = []; protected offlineSubmissions = [];
protected supportedTasks = { // Add here native supported tasks.
submit: true
};
protected obsSubmissionChanged: any; protected obsSubmissionChanged: any;
protected obsAssessmentSaved: any; protected obsAssessmentSaved: any;
protected appResumeSubscription: any; protected appResumeSubscription: any;
@ -189,8 +185,6 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
return this.workshopProvider.getWorkshop(this.courseId, this.module.id).then((workshop) => { return this.workshopProvider.getWorkshop(this.courseId, this.module.id).then((workshop) => {
this.workshop = workshop; this.workshop = workshop;
this.selectedPhase = workshop.phase;
this.description = workshop.intro || workshop.description; this.description = workshop.intro || workshop.description;
this.dataRetrieved.emit(workshop); this.dataRetrieved.emit(workshop);
@ -225,21 +219,12 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
}).then((phases) => { }).then((phases) => {
this.phases = phases; this.phases = phases;
// Treat phases. phases[this.workshop.phase].tasks.forEach((task) => {
for (const x in phases) {
phases[x].tasks.forEach((task) => {
if (!task.link && (task.code == 'examples' || task.code == 'prepareexamples')) { if (!task.link && (task.code == 'examples' || task.code == 'prepareexamples')) {
// Add links to manage examples. // Add links to manage examples.
task.link = this.externalUrl; task.link = this.externalUrl;
} else if (task.link && typeof this.supportedTasks[task.code] !== 'undefined') {
task.support = true;
} }
}); });
const action = phases[x].actions.find((action) => {
return action.url && action.type == 'switchphase';
});
phases[x].switchUrl = action ? action.url : '';
}
// Check if there are info stored in offline. // Check if there are info stored in offline.
return this.workshopOffline.hasWorkshopOfflineData(this.workshop.id).then((hasOffline) => { return this.workshopOffline.hasWorkshopOfflineData(this.workshop.id).then((hasOffline) => {
@ -295,8 +280,18 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
* @param {any} task Task to be done. * @param {any} task Task to be done.
*/ */
runTask(task: any): void { runTask(task: any): void {
if (task.support) { if (task.code == 'submit') {
if (task.code == 'submit' && this.canSubmit && ((this.access.creatingsubmissionallowed && !this.submission) || this.gotoSubmit();
} else if (task.link) {
this.utils.openInBrowser(task.link);
}
}
/**
* Go to submit page.
*/
gotoSubmit(): void {
if (this.canSubmit && ((this.access.creatingsubmissionallowed && !this.submission) ||
(this.access.modifyingsubmissionallowed && this.submission))) { (this.access.modifyingsubmissionallowed && this.submission))) {
const params = { const params = {
module: this.module, module: this.module,
@ -307,35 +302,20 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
this.navCtrl.push('AddonModWorkshopEditSubmissionPage', params); this.navCtrl.push('AddonModWorkshopEditSubmissionPage', params);
} }
} else if (task.link) {
this.utils.openInBrowser(task.link);
}
} }
/** /**
* Run task link on current phase. * View Phase info.
*
* @param {string} taskCode Code related to the task to run.
*/ */
runTaskByCode(taskCode: string): void { viewPhaseInfo(): void {
const task = this.workshopHelper.getTask(this.phases[this.workshop.phase].tasks, taskCode);
return task ? this.runTask(task) : null;
}
/**
* Select Phase to be shown.
*/
selectPhase(): void {
if (this.phases) { if (this.phases) {
const modal = this.modalCtrl.create('AddonModWorkshopPhaseSelectorPage', { const modal = this.modalCtrl.create('AddonModWorkshopPhaseInfoPage', {
phases: this.utils.objectToArray(this.phases), phases: this.utils.objectToArray(this.phases),
selected: this.selectedPhase, workshopPhase: this.workshop.phase,
workshopPhase: this.workshop.phase externalUrl: this.externalUrl
}); });
modal.onDidDismiss((phase) => { modal.onDidDismiss((goSubmit) => {
// Add data to search object. goSubmit && this.gotoSubmit();
typeof phase != 'undefined' && this.switchPhase(phase);
}); });
modal.present(); modal.present();
} }
@ -442,16 +422,6 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
return Promise.all(promises); return Promise.all(promises);
} }
/**
* Switch shown phase.
*
* @param {number} phase Selected phase.
*/
switchPhase(phase: number): void {
this.selectedPhase = phase;
this.page = 0;
}
/** /**
* Performs the sync of the activity. * Performs the sync of the activity.
* *

View File

@ -34,7 +34,9 @@
<core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file> <core-local-file *ngIf="attachment.name" [file]="attachment"></core-local-file>
</ion-item> </ion-item>
<ion-item text-wrap *ngIf="viewDetails && submission.feedbackauthor"> <ion-item text-wrap *ngIf="viewDetails && submission.feedbackauthor">
<img [src]="evaluateByProfile && evaluateByProfile.profileimageurl" core-external-content core-user-link [courseId]="courseId" [userId]="evaluateByProfile && evaluateByProfile.id" [alt]="'core.pictureof' | translate:{$a: evaluateByProfile && evaluateByProfile.fullname}" role="presentation" onError="this.src='assets/img/user-avatar.png'"/> <ion-avatar item-start *ngIf="evaluateByProfile">
<img [src]="evaluateByProfile.profileimageurl" core-external-content core-user-link [courseId]="courseId" [userId]="evaluateByProfile.id" [alt]="'core.pictureof' | translate:{$a: evaluateByProfile.fullname}" role="presentation" onError="this.src='assets/img/user-avatar.png'">
</ion-avatar>
<h2 *ngIf="evaluateByProfile && evaluateByProfile.fullname">{{ 'addon.mod_workshop.feedbackby' | translate : {$a: evaluateByProfile.fullname} }}</h2> <h2 *ngIf="evaluateByProfile && evaluateByProfile.fullname">{{ 'addon.mod_workshop.feedbackby' | translate : {$a: evaluateByProfile.fullname} }}</h2>
<core-format-text [text]="submission.feedbackauthor"></core-format-text> <core-format-text [text]="submission.feedbackauthor"></core-format-text>

View File

@ -35,7 +35,6 @@
"publishsubmission_help": "Published submissions are available to the others when the workshop is closed.", "publishsubmission_help": "Published submissions are available to the others when the workshop is closed.",
"reassess": "Re-assess", "reassess": "Re-assess",
"receivedgrades": "Grades received", "receivedgrades": "Grades received",
"selectphase": "Select phase",
"submissionattachment": "Attachment", "submissionattachment": "Attachment",
"submissioncontent": "Submission content", "submissioncontent": "Submission content",
"submissiondeleteconfirm": "Are you sure you want to delete the following submission?", "submissiondeleteconfirm": "Are you sure you want to delete the following submission?",
@ -50,6 +49,7 @@
"switchphase30": "Switch to the assessment phase", "switchphase30": "Switch to the assessment phase",
"switchphase40": "Switch to the evaluation phase", "switchphase40": "Switch to the evaluation phase",
"switchphase50": "Close workshop", "switchphase50": "Close workshop",
"userplan": "Workshop planner",
"userplancurrentphase": "Current phase", "userplancurrentphase": "Current phase",
"warningassessmentmodified": "The submission was modified on the site.", "warningassessmentmodified": "The submission was modified on the site.",
"warningsubmissionmodified": "The assessment was modified on the site.", "warningsubmissionmodified": "The assessment was modified on the site.",

View File

@ -1,6 +1,6 @@
<ion-header> <ion-header>
<ion-navbar core-back-button> <ion-navbar core-back-button>
<ion-title>{{ 'addon.mod_workshop.selectphase' | translate }}</ion-title> <ion-title>{{ 'addon.mod_workshop.userplan' | translate }}</ion-title>
<ion-buttons end> <ion-buttons end>
<button ion-button icon-only (click)="closeModal()" [attr.aria-label]="'core.close' | translate"> <button ion-button icon-only (click)="closeModal()" [attr.aria-label]="'core.close' | translate">
<ion-icon name="close"></ion-icon> <ion-icon name="close"></ion-icon>
@ -9,17 +9,27 @@
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content> <ion-content>
<ion-list radio-group [(ngModel)]="selected" (ionChange)="switchPhase()"> <ion-list>
<ng-container *ngFor="let phase of phases"> <ng-container *ngFor="let phase of phases">
<ion-item *ngIf="workshopPhase >= phase.code || phase.tasks.length || phase.switchUrl"> <ion-item-divider color="light" [class.core-workshop-phase-selected]="workshopPhase == phase.code">
<ion-label>{{ phase.title }} <h2>{{ phase.title }}</h2>
<p text-wrap *ngIf="workshopPhase == phase.code">{{ 'addon.mod_workshop.userplancurrentphase' | translate }}</p> <p text-wrap *ngIf="workshopPhase == phase.code">{{ 'addon.mod_workshop.userplancurrentphase' | translate }}</p>
</ion-label> </ion-item-divider>
<ion-radio [value]="phase.code"></ion-radio> <a ion-item text-wrap *ngIf="phase.switchUrl" [href]="phase.switchUrl" detail-none>
</ion-item> <ion-icon item-start name="swap"></ion-icon>
<ion-item *ngIf="!(workshopPhase >= phase.code || phase.tasks.length || phase.switchUrl)"> {{ 'addon.mod_workshop.switchphase' + phase.code | translate }}
{{ phase.title }} <ion-icon item-end name="open"></ion-icon>
</ion-item> </a>
<a ion-item text-wrap *ngFor="let task of phase.tasks" [class.item-dimmed]="phase.code != workshopPhase" (click)="runTask(task)" detail-none>
<ion-icon item-start name="radio-button-off" *ngIf="task.completed == null"></ion-icon>
<ion-icon item-start name="close-circle" color="danger" *ngIf="task.completed == ''"></ion-icon>
<ion-icon item-start name="information-circle" color="info" *ngIf="task.completed == 'info'"></ion-icon>
<ion-icon item-start name="checkmark-circle" color="success" *ngIf="task.completed == '1'"></ion-icon>
<h2 text-wrap>{{task.title}}</h2>
<p *ngIf="task.details"><core-format-text [text]="task.details"></core-format-text></p>
<ion-icon item-end *ngIf="task.link && task.code != 'submit'" name="open"></ion-icon>
</a>
</ng-container> </ng-container>
</ion-list> </ion-list>
</ion-content> </ion-content>

View File

@ -16,18 +16,18 @@ import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModWorkshopPhaseSelectorPage } from './phase'; import { AddonModWorkshopPhaseInfoPage } from './phase';
import { CoreCompileHtmlComponentModule } from '@core/compile/components/compile-html/compile-html.module'; import { CoreCompileHtmlComponentModule } from '@core/compile/components/compile-html/compile-html.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
AddonModWorkshopPhaseSelectorPage, AddonModWorkshopPhaseInfoPage,
], ],
imports: [ imports: [
CoreDirectivesModule, CoreDirectivesModule,
CoreCompileHtmlComponentModule, CoreCompileHtmlComponentModule,
IonicPageModule.forChild(AddonModWorkshopPhaseSelectorPage), IonicPageModule.forChild(AddonModWorkshopPhaseInfoPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],
}) })
export class AddonModWorkshopPhaseSelectorPageModule {} export class AddonModWorkshopPhaseInfoPageModule {}

View File

@ -0,0 +1,22 @@
page-addon-mod-workshop-phase-info {
.core-workshop-phase-selected {
background-color: $white;
@include ltr() {
border-left: 5px solid $core-splitview-selected;
}
@include rtl() {
border-right: 5px solid $core-splitview-selected;
}
&.item-md {
@include padding(null, null, null, $item-md-padding-start - 5px);
}
&.item-ios {
@include padding(null, null, null, $item-ios-padding-start - 5px);
}
&.item-wp {
@include padding(null, null, null, $item-wp-padding-start - 5px);
}
}
}

View File

@ -14,26 +14,38 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavParams, ViewController } from 'ionic-angular'; import { IonicPage, NavParams, ViewController } from 'ionic-angular';
import { CoreUtilsProvider } from '@providers/utils/utils';
/** /**
* Page that displays the phase selector modal. * Page that displays the phase info modal.
*/ */
@IonicPage({ segment: 'addon-mod-workshop-phase-selector' }) @IonicPage({ segment: 'addon-mod-workshop-phase-info' })
@Component({ @Component({
selector: 'page-addon-mod-workshop-phase-selector', selector: 'page-addon-mod-workshop-phase-info',
templateUrl: 'phase.html', templateUrl: 'phase.html',
}) })
export class AddonModWorkshopPhaseSelectorPage { export class AddonModWorkshopPhaseInfoPage {
selected: number;
phases: any; phases: any;
workshopPhase: number; workshopPhase: number;
protected original: number;
constructor(params: NavParams, private viewCtrl: ViewController) { constructor(params: NavParams, private viewCtrl: ViewController, private utils: CoreUtilsProvider) {
this.selected = params.get('selected');
this.original = this.selected;
this.phases = params.get('phases'); this.phases = params.get('phases');
this.workshopPhase = params.get('workshopPhase'); this.workshopPhase = params.get('workshopPhase');
const externalUrl = params.get('externalUrl');
// Treat phases.
for (const x in this.phases) {
this.phases[x].tasks.forEach((task) => {
if (!task.link && (task.code == 'examples' || task.code == 'prepareexamples')) {
// Add links to manage examples.
task.link = externalUrl;
}
});
const action = this.phases[x].actions.find((action) => {
return action.url && action.type == 'switchphase';
});
this.phases[x].switchUrl = action ? action.url : '';
}
} }
/** /**
@ -44,13 +56,16 @@ export class AddonModWorkshopPhaseSelectorPage {
} }
/** /**
* Select phase. * Open task.
*
* @param {any} task Task to be done.
*/ */
switchPhase(): void { runTask(task: any): void {
// This is a quick hack to avoid the first switch phase call done just when opening the modal. if (task.code == 'submit') {
if (this.original != this.selected) { // This will close the modal and go to the submit.
this.viewCtrl.dismiss(this.selected); this.viewCtrl.dismiss(true);
} else if (task.link) {
this.utils.openInBrowser(task.link);
} }
this.original = null;
} }
} }