MOBILE-4243 course: Add communication room button to course page
parent
4a89c566aa
commit
03e9bcb736
|
@ -1570,6 +1570,7 @@
|
|||
"core.course.aria:sectionprogress": "local_moodlemobileapp",
|
||||
"core.course.availablespace": "local_moodlemobileapp",
|
||||
"core.course.cannotdeletewhiledownloading": "local_moodlemobileapp",
|
||||
"core.course.communicationroomlink": "course",
|
||||
"core.course.completion_automatic:done": "course",
|
||||
"core.course.completion_automatic:failed": "course",
|
||||
"core.course.completion_automatic:todo": "course",
|
||||
|
|
|
@ -72,6 +72,7 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
|
|||
'4.1': 2022112800,
|
||||
'4.2': 2023042400,
|
||||
'4.3': 2023100900,
|
||||
'4.4': 2024012500, // @TODO correct the final release date.
|
||||
};
|
||||
|
||||
// Possible cache update frequencies.
|
||||
|
|
|
@ -50,9 +50,14 @@
|
|||
[instanceId]="course.id" />
|
||||
|
||||
<!-- Course Index button. -->
|
||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="loaded && displayCourseIndex">
|
||||
<ion-fab-button (click)="openCourseIndex()" [userTour]="courseIndexTour" [attr.aria-label]="'core.course.courseindex' | translate"
|
||||
color="secondary">
|
||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="loaded && (displayCourseIndex || communicationRoomUrl)">
|
||||
<ion-fab-button size="small" *ngIf="communicationRoomUrl" [href]="communicationRoomUrl" core-link capture="false"
|
||||
[attr.aria-label]="'core.course.communicationroomlink' | translate">
|
||||
<ion-icon name="far-comments" aria-hidden="true" />
|
||||
<span class="sr-only">{{'core.course.communicationroomlink' | translate }}</span>
|
||||
</ion-fab-button>
|
||||
<ion-fab-button *ngIf="displayCourseIndex" (click)="openCourseIndex()" [userTour]="courseIndexTour"
|
||||
[attr.aria-label]="'core.course.courseindex' | translate" color="secondary">
|
||||
<ion-icon name="fas-list-ul" aria-hidden="true" />
|
||||
<span class="sr-only">{{'core.course.courseindex' | translate }}</span>
|
||||
</ion-fab-button>
|
||||
|
|
|
@ -117,6 +117,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
|||
viewedModules: Record<number, boolean> = {};
|
||||
completionStatusIncomplete = CoreCourseModuleCompletionStatus.COMPLETION_INCOMPLETE;
|
||||
|
||||
communicationRoomUrl?: string;
|
||||
|
||||
protected selectTabObserver?: CoreEventObserver;
|
||||
protected modViewedObserver?: CoreEventObserver;
|
||||
protected lastCourseFormat?: string;
|
||||
|
@ -197,6 +199,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.displayBlocks = CoreCourseFormatDelegate.displayBlocks(this.course);
|
||||
|
||||
this.hasBlocks = await CoreBlockHelper.hasCourseBlocks(this.course.id);
|
||||
|
||||
this.communicationRoomUrl = await CoreCourseHelper.getCourseCommunicationRoom(this.course);
|
||||
}
|
||||
|
||||
if (changes.sections && this.sections) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"aria:sectionprogress": "Section progress:",
|
||||
"availablespace": "You currently have about {{available}} free space.",
|
||||
"cannotdeletewhiledownloading": "Files cannot be deleted while the activity is being downloaded. Please wait for the download to finish.",
|
||||
"communicationroomlink": "Chat to course participants",
|
||||
"completion_automatic:done": "Done:",
|
||||
"completion_automatic:failed": "Failed:",
|
||||
"completion_automatic:todo": "To do:",
|
||||
|
|
|
@ -2031,6 +2031,29 @@ export class CoreCourseHelperProvider {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get course communication room URL.
|
||||
*
|
||||
* @param course Course.
|
||||
* @returns Promise resolved with the URL.
|
||||
*/
|
||||
async getCourseCommunicationRoom(course: CoreCourseAnyCourseData): Promise<string | undefined> {
|
||||
|
||||
const site = CoreSites.getRequiredCurrentSite();
|
||||
if (!site.isVersionGreaterEqualThan('4.4')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('communicationroomurl' in course) {
|
||||
return course.communicationroomurl;
|
||||
}
|
||||
|
||||
course = await CoreCourses.getCourseByField('id', course.id, site.id);
|
||||
if ('communicationroomurl' in course) {
|
||||
return course.communicationroomurl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const CoreCourseHelper = makeSingleton(CoreCourseHelperProvider);
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
@core_course @app @javascript @lms_from4.4
|
||||
Feature: Use custom communication link in course
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following config values are set as admin:
|
||||
| enablecommunicationsubsystem | 1 |
|
||||
And I am on the "Course 1" "Course" page logged in as "teacher1"
|
||||
And I navigate to "Communication" in current page administration
|
||||
And I select "Custom link" from the "Provider" singleselect
|
||||
And I set the following fields to these values:
|
||||
| communicationroomname | Test URL |
|
||||
| customlinkurl | #wwwroot#/communication/provider/customlink/tests/behat/fixtures/custom_link_test_page.php |
|
||||
And I press "Save changes"
|
||||
|
||||
Scenario: Use communication link
|
||||
Given I entered the course "Course 1" as "student1" in the app
|
||||
And I press "Chat to course participants" in the app
|
||||
And I press "OK" in the app
|
||||
Then the app should have opened a browser tab with url ".*\/communication\/provider\/customlink\/tests\/behat\/fixtures\/custom_link_test_page.php"
|
|
@ -1416,6 +1416,8 @@ export type CoreCourseSearchedData = CoreCourseBasicSearchedData & {
|
|||
inheritedstate: number; // 1 or 0 to use when localstate is set to inherit.
|
||||
}[];
|
||||
courseformatoptions?: CoreCourseFormatOption[]; // Additional options for particular course format.
|
||||
communicationroomname?: string; // @since Moodle 4.4. Communication tool room name.
|
||||
communicationroomurl?: string; // @since Moodle 4.4. Communication tool room URL.
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue