forked from EVOgeek/Vmeda.Online
		
	
						commit
						2c8850b669
					
				| @ -657,6 +657,7 @@ | |||||||
|   "addon.mod_forum.posttoforum": "forum", |   "addon.mod_forum.posttoforum": "forum", | ||||||
|   "addon.mod_forum.posttomygroups": "forum", |   "addon.mod_forum.posttomygroups": "forum", | ||||||
|   "addon.mod_forum.privatereply": "forum", |   "addon.mod_forum.privatereply": "forum", | ||||||
|  |   "addon.mod_forum.qandanotify": "forum", | ||||||
|   "addon.mod_forum.re": "forum", |   "addon.mod_forum.re": "forum", | ||||||
|   "addon.mod_forum.refreshposts": "local_moodlemobileapp", |   "addon.mod_forum.refreshposts": "local_moodlemobileapp", | ||||||
|   "addon.mod_forum.removefromfavourites": "forum", |   "addon.mod_forum.removefromfavourites": "forum", | ||||||
|  | |||||||
| @ -127,6 +127,11 @@ | |||||||
|                 <ion-label>{{ 'addon.mod_assign.'+summary.warnofungroupedusers | translate }}</ion-label> |                 <ion-label>{{ 'addon.mod_assign.'+summary.warnofungroupedusers | translate }}</ion-label> | ||||||
|             </ion-item> |             </ion-item> | ||||||
|         </ion-card> |         </ion-card> | ||||||
|  | 
 | ||||||
|  |         <div collapsible-footer *ngIf="!showLoading" slot="fixed"> | ||||||
|  |             <core-course-module-navigation [courseId]="courseId" [currentModuleId]="module.id"> | ||||||
|  |             </core-course-module-navigation> | ||||||
|  |         </div> | ||||||
|     </ng-container> |     </ng-container> | ||||||
| 
 | 
 | ||||||
|     <!-- If it's a student, display his submission. --> |     <!-- If it's a student, display his submission. --> | ||||||
|  | |||||||
| @ -31,12 +31,20 @@ | |||||||
|             </ion-item> |             </ion-item> | ||||||
|         </ion-card> |         </ion-card> | ||||||
| 
 | 
 | ||||||
|  |         <!-- Q&A message. --> | ||||||
|  |         <ion-card class="core-info-card" *ngIf="showQAMessage"> | ||||||
|  |             <ion-item> | ||||||
|  |                 <ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon> | ||||||
|  |                 <ion-label>{{ 'addon.mod_forum.qandanotify' | translate }}</ion-label> | ||||||
|  |             </ion-item> | ||||||
|  |         </ion-card> | ||||||
|  | 
 | ||||||
|         <ng-container *ngIf="forum"> |         <ng-container *ngIf="forum"> | ||||||
|             <core-empty-box *ngIf="!discussions || discussions.empty" icon="far-comments" |             <core-empty-box *ngIf="!discussions || !discussions.hasDiscussions" icon="far-comments" | ||||||
|                 [message]="'addon.mod_forum.forumnodiscussionsyet' | translate"> |                 [message]="'addon.mod_forum.forumnodiscussionsyet' | translate"> | ||||||
|             </core-empty-box> |             </core-empty-box> | ||||||
| 
 | 
 | ||||||
|             <div *ngIf="discussions && !discussions.empty && sortingAvailable && selectedSortOrder" class="ion-text-wrap"> |             <div *ngIf="discussions?.hasDiscussions && sortingAvailable && selectedSortOrder" class="ion-text-wrap"> | ||||||
|                 <core-combobox [modalOptions]="sortOrderSelectorModalOptions" listboxId="addon-mod-forum-sort-selector" |                 <core-combobox [modalOptions]="sortOrderSelectorModalOptions" listboxId="addon-mod-forum-sort-selector" | ||||||
|                     [label]="('core.sort' | translate)" (onChange)="setSortOrder($event)" [selection]="selectedSortOrder.label | translate" |                     [label]="('core.sort' | translate)" (onChange)="setSortOrder($event)" [selection]="selectedSortOrder.label | translate" | ||||||
|                     interface="modal"> |                     interface="modal"> | ||||||
|  | |||||||
| @ -85,6 +85,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom | |||||||
|     sortOrders: AddonModForumSortOrder[] = []; |     sortOrders: AddonModForumSortOrder[] = []; | ||||||
|     canPin = false; |     canPin = false; | ||||||
|     hasOfflineRatings = false; |     hasOfflineRatings = false; | ||||||
|  |     showQAMessage = false; | ||||||
|     sortOrderSelectorModalOptions: ModalOptions = { |     sortOrderSelectorModalOptions: ModalOptions = { | ||||||
|         component: AddonModForumSortOrderSelectorComponent, |         component: AddonModForumSortOrderSelectorComponent, | ||||||
|     }; |     }; | ||||||
| @ -345,8 +346,9 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         const forum = this.forum; |         const forum = this.forum; | ||||||
|  |         const showDueDateMessage = !CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('3.11'); | ||||||
|         this.description = forum.intro || this.description; |         this.description = forum.intro || this.description; | ||||||
|         this.availabilityMessage = AddonModForumHelper.getAvailabilityMessage(forum); |         this.availabilityMessage = AddonModForumHelper.getAvailabilityMessage(forum, showDueDateMessage); | ||||||
|         this.descriptionNote = Translate.instant('addon.mod_forum.numdiscussions', { |         this.descriptionNote = Translate.instant('addon.mod_forum.numdiscussions', { | ||||||
|             numdiscussions: forum.numdiscussions, |             numdiscussions: forum.numdiscussions, | ||||||
|         }); |         }); | ||||||
| @ -403,6 +405,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom | |||||||
|                     const cutoffDateReached = AddonModForumHelper.isCutoffDateReached(forum) |                     const cutoffDateReached = AddonModForumHelper.isCutoffDateReached(forum) | ||||||
|                                     && !accessInfo.cancanoverridecutoff; |                                     && !accessInfo.cancanoverridecutoff; | ||||||
|                     this.canAddDiscussion = !!forum.cancreatediscussions && !cutoffDateReached; |                     this.canAddDiscussion = !!forum.cancreatediscussions && !cutoffDateReached; | ||||||
|  |                     this.showQAMessage = forum.type === 'qanda' && !accessInfo.canviewqandawithoutposting; | ||||||
| 
 | 
 | ||||||
|                     return; |                     return; | ||||||
|                 }), |                 }), | ||||||
| @ -702,4 +705,16 @@ class AddonModForumDiscussionsManager extends CoreListItemsManager<AddonModForum | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Check whether there is any discussion in the items. | ||||||
|  |      * | ||||||
|  |      * @return Whether there is a discussion. | ||||||
|  |      */ | ||||||
|  |     get hasDiscussions(): boolean { | ||||||
|  |         const source = this.getSource(); | ||||||
|  |         const items = source.getItems(); | ||||||
|  | 
 | ||||||
|  |         return items !== null && items.some(item => !source.isNewDiscussionForm(item)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -49,6 +49,7 @@ | |||||||
|     "posttoforum": "Post to forum", |     "posttoforum": "Post to forum", | ||||||
|     "posttomygroups": "Post a copy to all groups", |     "posttomygroups": "Post a copy to all groups", | ||||||
|     "privatereply": "Reply privately", |     "privatereply": "Reply privately", | ||||||
|  |     "qandanotify": "This is a question and answer forum. In order to see other responses to these questions, you must first post your answer", | ||||||
|     "re": "Re:", |     "re": "Re:", | ||||||
|     "refreshposts": "Refresh posts", |     "refreshposts": "Refresh posts", | ||||||
|     "removefromfavourites": "Unstar this discussion", |     "removefromfavourites": "Unstar this discussion", | ||||||
|  | |||||||
| @ -84,6 +84,14 @@ | |||||||
|             </ion-item> |             </ion-item> | ||||||
|         </ion-card> |         </ion-card> | ||||||
| 
 | 
 | ||||||
|  |         <!-- Q&A message. --> | ||||||
|  |         <ion-card class="core-info-card" *ngIf="showQAMessage"> | ||||||
|  |             <ion-item> | ||||||
|  |                 <ion-icon name="fas-info-circle" slot="start" aria-hidden="true"></ion-icon> | ||||||
|  |                 <ion-label>{{ 'addon.mod_forum.qandanotify' | translate }}</ion-label> | ||||||
|  |             </ion-item> | ||||||
|  |         </ion-card> | ||||||
|  | 
 | ||||||
|         <div *ngIf="startingPost" class="ion-margin-bottom"> |         <div *ngIf="startingPost" class="ion-margin-bottom"> | ||||||
|             <addon-mod-forum-post [post]="startingPost" [discussion]="discussion" [courseId]="courseId" [highlight]="true" |             <addon-mod-forum-post [post]="startingPost" [discussion]="discussion" [courseId]="courseId" [highlight]="true" | ||||||
|                 [discussionId]="discussionId" [component]="component" [componentId]="cmId" [formData]="formData" |                 [discussionId]="discussionId" [component]="component" [componentId]="cmId" [formData]="formData" | ||||||
|  | |||||||
| @ -105,6 +105,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes | |||||||
|     cmId?: number; |     cmId?: number; | ||||||
|     canPin = false; |     canPin = false; | ||||||
|     availabilityMessage: string | null = null; |     availabilityMessage: string | null = null; | ||||||
|  |     showQAMessage = false; | ||||||
|     leavingPage = false; |     leavingPage = false; | ||||||
| 
 | 
 | ||||||
|     protected forumId?: number; |     protected forumId?: number; | ||||||
| @ -493,6 +494,11 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes | |||||||
|                                 }); |                                 }); | ||||||
|                             } |                             } | ||||||
| 
 | 
 | ||||||
|  |                             // Show Q&A message if user hasn't posted.
 | ||||||
|  |                             const currentUserId = CoreSites.getCurrentSiteUserId(); | ||||||
|  |                             this.showQAMessage = forum.type === 'qanda' && !accessInfo.canviewqandawithoutposting && | ||||||
|  |                                 !posts.some(post => post.author.id === currentUserId); | ||||||
|  | 
 | ||||||
|                             return; |                             return; | ||||||
|                         }), |                         }), | ||||||
|                 ); |                 ); | ||||||
|  | |||||||
| @ -278,24 +278,27 @@ export class AddonModForumHelperProvider { | |||||||
|      * Returns the availability message of the given forum. |      * Returns the availability message of the given forum. | ||||||
|      * |      * | ||||||
|      * @param forum Forum instance. |      * @param forum Forum instance. | ||||||
|  |      * @param getDueDateMessage Whether to get due date message. If false, only cutoff date message will be returned. | ||||||
|      * @return Message or null if the forum has no cut-off or due date. |      * @return Message or null if the forum has no cut-off or due date. | ||||||
|      */ |      */ | ||||||
|     getAvailabilityMessage(forum: AddonModForumData): string | null { |     getAvailabilityMessage(forum: AddonModForumData, getDueDateMessage = true): string | null { | ||||||
|         if (this.isCutoffDateReached(forum)) { |         if (this.isCutoffDateReached(forum)) { | ||||||
|             return Translate.instant('addon.mod_forum.cutoffdatereached'); |             return Translate.instant('addon.mod_forum.cutoffdatereached'); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         if (getDueDateMessage) { | ||||||
|             if (this.isDueDateReached(forum)) { |             if (this.isDueDateReached(forum)) { | ||||||
|                 const dueDate = CoreTimeUtils.userDate(forum.duedate * 1000); |                 const dueDate = CoreTimeUtils.userDate(forum.duedate * 1000); | ||||||
| 
 | 
 | ||||||
|                 return Translate.instant('addon.mod_forum.thisforumisdue', { $a: dueDate }); |                 return Translate.instant('addon.mod_forum.thisforumisdue', { $a: dueDate }); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|         if ((forum.duedate ?? 0) > 0) { |             if (forum.duedate && forum.duedate > 0) { | ||||||
|             const dueDate = CoreTimeUtils.userDate(forum.duedate! * 1000); |                 const dueDate = CoreTimeUtils.userDate(forum.duedate * 1000); | ||||||
| 
 | 
 | ||||||
|                 return Translate.instant('addon.mod_forum.thisforumhasduedate', { $a: dueDate }); |                 return Translate.instant('addon.mod_forum.thisforumhasduedate', { $a: dueDate }); | ||||||
|             } |             } | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -65,7 +65,7 @@ | |||||||
|             </ng-container> |             </ng-container> | ||||||
|         </ion-list> |         </ion-list> | ||||||
| 
 | 
 | ||||||
|         <core-empty-box *ngIf="(!entries || entries.empty) && (!isSearch || hasSearched)" icon="fas-list" |         <core-empty-box *ngIf="(!entries || !entries.hasEntries) && (!isSearch || hasSearched)" icon="fas-list" | ||||||
|             [message]="'addon.mod_glossary.noentriesfound' | translate"> |             [message]="'addon.mod_glossary.noentriesfound' | translate"> | ||||||
|         </core-empty-box> |         </core-empty-box> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -472,4 +472,13 @@ class AddonModGlossaryEntriesManager extends CoreListItemsManager<AddonModGlossa | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Check whether there is any entry in the items. | ||||||
|  |      * | ||||||
|  |      * @return Whether there is an entry. | ||||||
|  |      */ | ||||||
|  |     get hasEntries(): boolean { | ||||||
|  |         return this.getSource().onlineEntries.length > 0 || this.getSource().offlineEntries.length > 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -34,7 +34,7 @@ | |||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|     <!-- Availability info space. --> |     <!-- Availability info space. --> | ||||||
|     <div class="core-module-availabilityinfo core-module-info-box-section" *ngIf="showAvailabilityInfo"> |     <div class="core-module-availabilityinfo core-module-info-box-section" *ngIf="showAvailabilityInfo && module.availabilityinfo"> | ||||||
|         <ion-icon name="fas-lock" [attr.aria-label]="'core.restricted' | translate"></ion-icon> |         <ion-icon name="fas-lock" [attr.aria-label]="'core.restricted' | translate"></ion-icon> | ||||||
|         <core-format-text [text]="module.availabilityinfo" contextLevel="module" [contextInstanceId]="module.id" [courseId]="module.course"> |         <core-format-text [text]="module.availabilityinfo" contextLevel="module" [contextInstanceId]="module.id" [courseId]="module.course"> | ||||||
|         </core-format-text> |         </core-format-text> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user