From 0d41e7206cdda2630f022b62ce883003738db57b Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 8 Oct 2019 11:30:20 +0200 Subject: [PATCH] MOBILE-2491 filter: Prefetch filters --- .../providers/course-option-handler.ts | 15 +++++- .../mod/assign/providers/prefetch-handler.ts | 27 +++++++--- .../mod/book/providers/prefetch-handler.ts | 15 ++++-- .../mod/chat/providers/prefetch-handler.ts | 4 +- .../mod/choice/providers/prefetch-handler.ts | 18 +++++-- .../mod/data/providers/prefetch-handler.ts | 21 +++++--- .../feedback/providers/prefetch-handler.ts | 18 +++++-- .../mod/folder/providers/prefetch-handler.ts | 15 ++++-- .../mod/forum/providers/prefetch-handler.ts | 4 +- .../glossary/providers/prefetch-handler.ts | 4 +- .../mod/imscp/providers/prefetch-handler.ts | 15 ++++-- .../mod/label/providers/prefetch-handler.ts | 15 ++++-- .../mod/lesson/providers/prefetch-handler.ts | 19 +++++-- .../mod/page/providers/prefetch-handler.ts | 15 ++++-- .../mod/quiz/providers/prefetch-handler.ts | 22 ++++++--- .../resource/providers/prefetch-handler.ts | 15 ++++-- .../mod/scorm/providers/prefetch-handler.ts | 19 +++++-- .../mod/survey/providers/prefetch-handler.ts | 18 +++++-- .../mod/wiki/providers/prefetch-handler.ts | 22 ++++++--- .../workshop/providers/prefetch-handler.ts | 4 +- .../classes/activity-prefetch-handler.ts | 3 +- .../course/classes/module-prefetch-handler.ts | 12 +++-- .../classes/resource-prefetch-handler.ts | 2 + src/core/course/providers/helper.ts | 35 +++++++++---- src/core/filter/providers/helper.ts | 1 + .../handlers/module-prefetch-handler.ts | 20 ++++++-- src/core/siteplugins/providers/helper.ts | 49 +++++++++++++------ 27 files changed, 313 insertions(+), 114 deletions(-) diff --git a/src/addon/competency/providers/course-option-handler.ts b/src/addon/competency/providers/course-option-handler.ts index 32a6fd51d..c38c2fd2a 100644 --- a/src/addon/competency/providers/course-option-handler.ts +++ b/src/addon/competency/providers/course-option-handler.ts @@ -17,6 +17,7 @@ import { CoreCourseOptionsHandler, CoreCourseOptionsHandlerData } from '@core/co import { CoreCourseProvider } from '@core/course/providers/course'; import { AddonCompetencyCourseComponent } from '../components/course/course'; import { AddonCompetencyProvider } from '../providers/competency'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Course nav handler. @@ -26,7 +27,7 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand name = 'AddonCompetency'; priority = 300; - constructor(private competencyProvider: AddonCompetencyProvider) {} + constructor(private competencyProvider: AddonCompetencyProvider, protected filterHelper: CoreFilterHelperProvider) {} /** * Whether or not the handler is enabled ona site level. @@ -110,6 +111,18 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand promises.push(this.competencyProvider.getCompetencySummary(competency.competency.id, undefined, undefined, true)); + + if (competency.coursemodules) { + competency.coursemodules.forEach((module) => { + promises.push(this.filterHelper.getFilters('module', module.id, {courseId: course.id})); + }); + } + + if (competency.plans) { + competency.plans.forEach((plan) => { + promises.push(this.filterHelper.getFilters('user', plan.userid)); + }); + } }); } diff --git a/src/addon/mod/assign/providers/prefetch-handler.ts b/src/addon/mod/assign/providers/prefetch-handler.ts index 67d1fdfbf..9552032af 100644 --- a/src/addon/mod/assign/providers/prefetch-handler.ts +++ b/src/addon/mod/assign/providers/prefetch-handler.ts @@ -31,6 +31,7 @@ import { AddonModAssignHelperProvider, AddonModAssignSubmissionFormatted } from import { AddonModAssignSyncProvider } from './assign-sync'; import { AddonModAssignFeedbackDelegate } from './feedback-delegate'; import { AddonModAssignSubmissionDelegate } from './submission-delegate'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch assigns. @@ -42,16 +43,26 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan component = AddonModAssignProvider.COMPONENT; updatesNames = /^configuration$|^.*files$|^submissions$|^grades$|^gradeitems$|^outcomes$|^comments$/; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected assignProvider: AddonModAssignProvider, - protected textUtils: CoreTextUtilsProvider, protected feedbackDelegate: AddonModAssignFeedbackDelegate, - protected submissionDelegate: AddonModAssignSubmissionDelegate, protected courseHelper: CoreCourseHelperProvider, - protected groupsProvider: CoreGroupsProvider, protected gradesHelper: CoreGradesHelperProvider, - protected userProvider: CoreUserProvider, protected assignHelper: AddonModAssignHelperProvider, + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected assignProvider: AddonModAssignProvider, + protected textUtils: CoreTextUtilsProvider, + protected feedbackDelegate: AddonModAssignFeedbackDelegate, + protected submissionDelegate: AddonModAssignSubmissionDelegate, + protected courseHelper: CoreCourseHelperProvider, + protected groupsProvider: CoreGroupsProvider, + protected gradesHelper: CoreGradesHelperProvider, + protected userProvider: CoreUserProvider, + protected assignHelper: AddonModAssignHelperProvider, protected syncProvider: AddonModAssignSyncProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/book/providers/prefetch-handler.ts b/src/addon/mod/book/providers/prefetch-handler.ts index 8a852e4f3..22c6bf8bb 100644 --- a/src/addon/mod/book/providers/prefetch-handler.ts +++ b/src/addon/mod/book/providers/prefetch-handler.ts @@ -22,6 +22,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/resource-prefetch-handler'; import { AddonModBookProvider } from './book'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch books. @@ -33,11 +34,17 @@ export class AddonModBookPrefetchHandler extends CoreCourseResourcePrefetchHandl component = AddonModBookProvider.COMPONENT; updatesNames = /^configuration$|^.*files$|^entries$/; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected bookProvider: AddonModBookProvider) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected bookProvider: AddonModBookProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/chat/providers/prefetch-handler.ts b/src/addon/mod/chat/providers/prefetch-handler.ts index 1e7d12ff1..556d34982 100644 --- a/src/addon/mod/chat/providers/prefetch-handler.ts +++ b/src/addon/mod/chat/providers/prefetch-handler.ts @@ -24,6 +24,7 @@ import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/activity-prefetch-handler'; import { CoreUserProvider } from '@core/user/providers/user'; import { AddonModChatProvider, AddonModChatChat } from './chat'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch chats. @@ -41,11 +42,12 @@ export class AddonModChatPrefetchHandler extends CoreCourseActivityPrefetchHandl filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, private groupsProvider: CoreGroupsProvider, private userProvider: CoreUserProvider, private chatProvider: AddonModChatProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/choice/providers/prefetch-handler.ts b/src/addon/mod/choice/providers/prefetch-handler.ts index b5757d410..cbe113b6a 100644 --- a/src/addon/mod/choice/providers/prefetch-handler.ts +++ b/src/addon/mod/choice/providers/prefetch-handler.ts @@ -24,6 +24,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/acti import { CoreUserProvider } from '@core/user/providers/user'; import { AddonModChoiceSyncProvider } from './sync'; import { AddonModChoiceProvider } from './choice'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch choices. @@ -37,12 +38,19 @@ export class AddonModChoicePrefetchHandler extends CoreCourseActivityPrefetchHan protected syncProvider: AddonModChoiceSyncProvider; // It will be injected later to prevent circular dependencies. - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected choiceProvider: AddonModChoiceProvider, - protected userProvider: CoreUserProvider, protected injector: Injector) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected choiceProvider: AddonModChoiceProvider, + protected userProvider: CoreUserProvider, + protected injector: Injector) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/data/providers/prefetch-handler.ts b/src/addon/mod/data/providers/prefetch-handler.ts index f44165df2..631599d5b 100644 --- a/src/addon/mod/data/providers/prefetch-handler.ts +++ b/src/addon/mod/data/providers/prefetch-handler.ts @@ -27,6 +27,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/acti import { AddonModDataProvider, AddonModDataEntry } from './data'; import { AddonModDataSyncProvider } from './sync'; import { AddonModDataHelperProvider } from './helper'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch databases. @@ -38,14 +39,22 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl component = AddonModDataProvider.COMPONENT; updatesNames = /^configuration$|^.*files$|^entries$|^gradeitems$|^outcomes$|^comments$|^ratings/; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected dataProvider: AddonModDataProvider, - protected timeUtils: CoreTimeUtilsProvider, protected dataHelper: AddonModDataHelperProvider, - protected groupsProvider: CoreGroupsProvider, protected commentsProvider: CoreCommentsProvider, + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected dataProvider: AddonModDataProvider, + protected timeUtils: CoreTimeUtilsProvider, + protected dataHelper: AddonModDataHelperProvider, + protected groupsProvider: CoreGroupsProvider, + protected commentsProvider: CoreCommentsProvider, protected syncProvider: AddonModDataSyncProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/feedback/providers/prefetch-handler.ts b/src/addon/mod/feedback/providers/prefetch-handler.ts index d4c7edfcf..2aed13f52 100644 --- a/src/addon/mod/feedback/providers/prefetch-handler.ts +++ b/src/addon/mod/feedback/providers/prefetch-handler.ts @@ -26,6 +26,7 @@ import { AddonModFeedbackHelperProvider } from './helper'; import { CoreTimeUtilsProvider } from '@providers/utils/time'; import { CoreGroupsProvider } from '@providers/groups'; import { AddonModFeedbackSyncProvider } from './sync'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch feedbacks. @@ -39,14 +40,21 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH protected syncProvider: AddonModFeedbackSyncProvider; // It will be injected later to prevent circular dependencies. - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected feedbackProvider: AddonModFeedbackProvider, + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected feedbackProvider: AddonModFeedbackProvider, protected feedbackHelper: AddonModFeedbackHelperProvider, - protected timeUtils: CoreTimeUtilsProvider, protected groupsProvider: CoreGroupsProvider, + protected timeUtils: CoreTimeUtilsProvider, + protected groupsProvider: CoreGroupsProvider, protected injector: Injector) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/folder/providers/prefetch-handler.ts b/src/addon/mod/folder/providers/prefetch-handler.ts index 9e0f226d0..3ad1f329e 100644 --- a/src/addon/mod/folder/providers/prefetch-handler.ts +++ b/src/addon/mod/folder/providers/prefetch-handler.ts @@ -22,6 +22,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/resource-prefetch-handler'; import { AddonModFolderProvider } from './folder'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch folders. @@ -32,11 +33,17 @@ export class AddonModFolderPrefetchHandler extends CoreCourseResourcePrefetchHan modName = 'folder'; component = AddonModFolderProvider.COMPONENT; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected folderProvider: AddonModFolderProvider) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected folderProvider: AddonModFolderProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/forum/providers/prefetch-handler.ts b/src/addon/mod/forum/providers/prefetch-handler.ts index a8cf9d540..f9ab412c2 100644 --- a/src/addon/mod/forum/providers/prefetch-handler.ts +++ b/src/addon/mod/forum/providers/prefetch-handler.ts @@ -25,6 +25,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/acti import { CoreGroupsProvider } from '@providers/groups'; import { AddonModForumProvider } from './forum'; import { AddonModForumSyncProvider } from './sync'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch forums. @@ -43,12 +44,13 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, private userProvider: CoreUserProvider, private groupsProvider: CoreGroupsProvider, private forumProvider: AddonModForumProvider, private syncProvider: AddonModForumSyncProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/glossary/providers/prefetch-handler.ts b/src/addon/mod/glossary/providers/prefetch-handler.ts index 2ce18b053..b087762ac 100644 --- a/src/addon/mod/glossary/providers/prefetch-handler.ts +++ b/src/addon/mod/glossary/providers/prefetch-handler.ts @@ -23,6 +23,7 @@ import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/activity-prefetch-handler'; import { AddonModGlossaryProvider } from './glossary'; import { AddonModGlossarySyncProvider } from './sync'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch forums. @@ -41,10 +42,11 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseActivityPrefetchH filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, private glossaryProvider: AddonModGlossaryProvider, private syncProvider: AddonModGlossarySyncProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/imscp/providers/prefetch-handler.ts b/src/addon/mod/imscp/providers/prefetch-handler.ts index 22b793f0c..0b9c5b57e 100644 --- a/src/addon/mod/imscp/providers/prefetch-handler.ts +++ b/src/addon/mod/imscp/providers/prefetch-handler.ts @@ -22,6 +22,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/resource-prefetch-handler'; import { AddonModImscpProvider } from './imscp'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch IMSCPs. @@ -32,11 +33,17 @@ export class AddonModImscpPrefetchHandler extends CoreCourseResourcePrefetchHand modName = 'imscp'; component = AddonModImscpProvider.COMPONENT; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected imscpProvider: AddonModImscpProvider) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected imscpProvider: AddonModImscpProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/label/providers/prefetch-handler.ts b/src/addon/mod/label/providers/prefetch-handler.ts index d9679a430..140c23538 100644 --- a/src/addon/mod/label/providers/prefetch-handler.ts +++ b/src/addon/mod/label/providers/prefetch-handler.ts @@ -22,6 +22,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/resource-prefetch-handler'; import { AddonModLabelProvider } from './label'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch labels. @@ -34,11 +35,17 @@ export class AddonModLabelPrefetchHandler extends CoreCourseResourcePrefetchHand updatesNames = /^.*files$/; skipListStatus = true; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected labelProvider: AddonModLabelProvider) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected labelProvider: AddonModLabelProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/lesson/providers/prefetch-handler.ts b/src/addon/mod/lesson/providers/prefetch-handler.ts index b424edf92..834845d47 100644 --- a/src/addon/mod/lesson/providers/prefetch-handler.ts +++ b/src/addon/mod/lesson/providers/prefetch-handler.ts @@ -25,6 +25,7 @@ import { CoreGroupsProvider } from '@providers/groups'; import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/activity-prefetch-handler'; import { AddonModLessonProvider } from './lesson'; import { AddonModLessonSyncProvider } from './lesson-sync'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch lessons. @@ -39,12 +40,20 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan protected syncProvider: AddonModLessonSyncProvider; // It will be injected later to prevent circular dependencies. - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected modalCtrl: ModalController, protected groupsProvider: CoreGroupsProvider, - protected lessonProvider: AddonModLessonProvider, protected injector: Injector) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected modalCtrl: ModalController, + protected groupsProvider: CoreGroupsProvider, + protected lessonProvider: AddonModLessonProvider, + protected injector: Injector) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/page/providers/prefetch-handler.ts b/src/addon/mod/page/providers/prefetch-handler.ts index 5c37eebef..982b1d45b 100644 --- a/src/addon/mod/page/providers/prefetch-handler.ts +++ b/src/addon/mod/page/providers/prefetch-handler.ts @@ -23,6 +23,7 @@ import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/resource-prefetch-handler'; import { AddonModPageProvider } from './page'; import { AddonModPageHelperProvider } from './helper'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch pages. @@ -34,12 +35,18 @@ export class AddonModPagePrefetchHandler extends CoreCourseResourcePrefetchHandl component = AddonModPageProvider.COMPONENT; updatesNames = /^configuration$|^.*files$/; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected pageProvider: AddonModPageProvider, + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected pageProvider: AddonModPageProvider, protected pageHelper: AddonModPageHelperProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/quiz/providers/prefetch-handler.ts b/src/addon/mod/quiz/providers/prefetch-handler.ts index 4801db409..1874ce516 100644 --- a/src/addon/mod/quiz/providers/prefetch-handler.ts +++ b/src/addon/mod/quiz/providers/prefetch-handler.ts @@ -28,6 +28,7 @@ import { AddonModQuizHelperProvider } from './helper'; import { AddonModQuizAccessRuleDelegate } from './access-rules-delegate'; import { AddonModQuizSyncProvider } from './quiz-sync'; import { CoreConstants } from '@core/constants'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch quizzes. @@ -41,13 +42,22 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl protected syncProvider: AddonModQuizSyncProvider; // It will be injected later to prevent circular dependencies. - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected injector: Injector, protected quizProvider: AddonModQuizProvider, - protected textUtils: CoreTextUtilsProvider, protected quizHelper: AddonModQuizHelperProvider, - protected accessRuleDelegate: AddonModQuizAccessRuleDelegate, protected questionHelper: CoreQuestionHelperProvider) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected injector: Injector, + protected quizProvider: AddonModQuizProvider, + protected textUtils: CoreTextUtilsProvider, + protected quizHelper: AddonModQuizHelperProvider, + protected accessRuleDelegate: AddonModQuizAccessRuleDelegate, + protected questionHelper: CoreQuestionHelperProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/resource/providers/prefetch-handler.ts b/src/addon/mod/resource/providers/prefetch-handler.ts index 94a946ae4..2f9bb6215 100644 --- a/src/addon/mod/resource/providers/prefetch-handler.ts +++ b/src/addon/mod/resource/providers/prefetch-handler.ts @@ -24,6 +24,7 @@ import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/reso import { AddonModResourceProvider } from './resource'; import { AddonModResourceHelperProvider } from './helper'; import { CoreConstants } from '@core/constants'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch resources. @@ -34,12 +35,18 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH modName = 'resource'; component = AddonModResourceProvider.COMPONENT; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected resourceProvider: AddonModResourceProvider, + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected resourceProvider: AddonModResourceProvider, protected resourceHelper: AddonModResourceHelperProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/scorm/providers/prefetch-handler.ts b/src/addon/mod/scorm/providers/prefetch-handler.ts index 8195d4789..fd2d34b6e 100644 --- a/src/addon/mod/scorm/providers/prefetch-handler.ts +++ b/src/addon/mod/scorm/providers/prefetch-handler.ts @@ -25,6 +25,7 @@ import { CoreTextUtilsProvider } from '@providers/utils/text'; import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/activity-prefetch-handler'; import { AddonModScormProvider } from './scorm'; import { AddonModScormSyncProvider } from './scorm-sync'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Progress event used when downloading a SCORM. @@ -58,12 +59,20 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand protected syncProvider: AddonModScormSyncProvider; // It will be injected later to prevent circular dependencies. - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected fileProvider: CoreFileProvider, protected textUtils: CoreTextUtilsProvider, - protected scormProvider: AddonModScormProvider, protected injector: Injector) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected fileProvider: CoreFileProvider, + protected textUtils: CoreTextUtilsProvider, + protected scormProvider: AddonModScormProvider, + protected injector: Injector) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/survey/providers/prefetch-handler.ts b/src/addon/mod/survey/providers/prefetch-handler.ts index 175825ab5..faa894364 100644 --- a/src/addon/mod/survey/providers/prefetch-handler.ts +++ b/src/addon/mod/survey/providers/prefetch-handler.ts @@ -24,6 +24,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/acti import { AddonModSurveyProvider } from './survey'; import { AddonModSurveySyncProvider } from './sync'; import { AddonModSurveyHelperProvider } from './helper'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch surveys. @@ -37,12 +38,19 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan protected syncProvider: AddonModSurveySyncProvider; // It will be injected later to prevent circular dependencies. - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected surveyProvider: AddonModSurveyProvider, - protected surveyHelper: AddonModSurveyHelperProvider, protected injector: Injector) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected surveyProvider: AddonModSurveyProvider, + protected surveyHelper: AddonModSurveyHelperProvider, + protected injector: Injector) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/wiki/providers/prefetch-handler.ts b/src/addon/mod/wiki/providers/prefetch-handler.ts index d09fea4e4..918ad0441 100644 --- a/src/addon/mod/wiki/providers/prefetch-handler.ts +++ b/src/addon/mod/wiki/providers/prefetch-handler.ts @@ -28,6 +28,7 @@ import { CoreGradesHelperProvider } from '@core/grades/providers/helper'; import { CoreUserProvider } from '@core/user/providers/user'; import { AddonModWikiProvider } from './wiki'; import { AddonModWikiSyncProvider } from './wiki-sync'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch wikis. @@ -39,14 +40,23 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl component = AddonModWikiProvider.COMPONENT; updatesNames = /^.*files$|^pages$/; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected wikiProvider: AddonModWikiProvider, protected userProvider: CoreUserProvider, - protected textUtils: CoreTextUtilsProvider, protected courseHelper: CoreCourseHelperProvider, - protected groupsProvider: CoreGroupsProvider, protected gradesHelper: CoreGradesHelperProvider, + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected wikiProvider: AddonModWikiProvider, + protected userProvider: CoreUserProvider, + protected textUtils: CoreTextUtilsProvider, + protected courseHelper: CoreCourseHelperProvider, + protected groupsProvider: CoreGroupsProvider, + protected gradesHelper: CoreGradesHelperProvider, protected syncProvider: AddonModWikiSyncProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/addon/mod/workshop/providers/prefetch-handler.ts b/src/addon/mod/workshop/providers/prefetch-handler.ts index 940febd72..0b7b47eee 100644 --- a/src/addon/mod/workshop/providers/prefetch-handler.ts +++ b/src/addon/mod/workshop/providers/prefetch-handler.ts @@ -26,6 +26,7 @@ import { CoreUserProvider } from '@core/user/providers/user'; import { AddonModWorkshopProvider } from './workshop'; import { AddonModWorkshopSyncProvider } from './sync'; import { AddonModWorkshopHelperProvider } from './helper'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch workshops. @@ -45,13 +46,14 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, private groupsProvider: CoreGroupsProvider, private userProvider: CoreUserProvider, private workshopProvider: AddonModWorkshopProvider, private workshopHelper: AddonModWorkshopHelperProvider, private syncProvider: AddonModWorkshopSyncProvider) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); } /** diff --git a/src/core/course/classes/activity-prefetch-handler.ts b/src/core/course/classes/activity-prefetch-handler.ts index c98a702fc..b655979f6 100644 --- a/src/core/course/classes/activity-prefetch-handler.ts +++ b/src/core/course/classes/activity-prefetch-handler.ts @@ -101,10 +101,11 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe } const prefetchPromise = this.setDownloading(module.id, siteId).then(() => { - // Package marked as downloading, get module info to be able to handle links. + // Package marked as downloading, get module info to be able to handle links. Get module filters too. return Promise.all([ this.courseProvider.getModuleBasicInfo(module.id, siteId), this.courseProvider.getModule(module.id, courseId, undefined, false, true, siteId), + this.filterHelper.getFilters('module', module.id, {courseId: courseId}) ]); }).then(() => { // Call the download function, send all the params except downloadFn. This includes all params passed after siteId. diff --git a/src/core/course/classes/module-prefetch-handler.ts b/src/core/course/classes/module-prefetch-handler.ts index 8173f615b..2e344104a 100644 --- a/src/core/course/classes/module-prefetch-handler.ts +++ b/src/core/course/classes/module-prefetch-handler.ts @@ -20,6 +20,7 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom'; import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreCourseProvider } from '../providers/course'; import { CoreCourseModulePrefetchHandler } from '../providers/module-prefetch-delegate'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Base prefetch handler to be registered in CoreCourseModulePrefetchDelegate. Prefetch handlers should inherit either @@ -59,9 +60,14 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref */ protected downloadPromises: { [s: string]: { [s: string]: Promise } } = {}; - constructor(protected translate: TranslateService, protected appProvider: CoreAppProvider, protected utils: CoreUtilsProvider, - protected courseProvider: CoreCourseProvider, protected filepoolProvider: CoreFilepoolProvider, - protected sitesProvider: CoreSitesProvider, protected domUtils: CoreDomUtilsProvider) { } + constructor(protected translate: TranslateService, + protected appProvider: CoreAppProvider, + protected utils: CoreUtilsProvider, + protected courseProvider: CoreCourseProvider, + protected filepoolProvider: CoreFilepoolProvider, + protected sitesProvider: CoreSitesProvider, + protected domUtils: CoreDomUtilsProvider, + protected filterHelper: CoreFilterHelperProvider) { } /** * Add an ongoing download to the downloadPromises list. When the promise finishes it will be removed. diff --git a/src/core/course/classes/resource-prefetch-handler.ts b/src/core/course/classes/resource-prefetch-handler.ts index 2847d3e69..db7a3a568 100644 --- a/src/core/course/classes/resource-prefetch-handler.ts +++ b/src/core/course/classes/resource-prefetch-handler.ts @@ -87,6 +87,8 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe promises.push(downloadFn(siteId, files, this.component, module.id)); } + promises.push(this.filterHelper.getFilters('module', module.id, {courseId: courseId})); + return Promise.all(promises); }); diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index 30b0e0dff..f4b2f8bcb 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -38,6 +38,7 @@ import { CoreConstants } from '@core/constants'; import { CoreSite } from '@classes/site'; import { CoreLoggerProvider } from '@providers/logger'; import * as moment from 'moment'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Prefetch info of a module. @@ -108,16 +109,28 @@ export class CoreCourseHelperProvider { protected courseDwnPromises: { [s: string]: { [id: number]: Promise } } = {}; protected logger; - constructor(private courseProvider: CoreCourseProvider, private domUtils: CoreDomUtilsProvider, - private moduleDelegate: CoreCourseModuleDelegate, private prefetchDelegate: CoreCourseModulePrefetchDelegate, - private filepoolProvider: CoreFilepoolProvider, private sitesProvider: CoreSitesProvider, - private textUtils: CoreTextUtilsProvider, private timeUtils: CoreTimeUtilsProvider, - private utils: CoreUtilsProvider, private translate: TranslateService, private loginHelper: CoreLoginHelperProvider, - private courseOptionsDelegate: CoreCourseOptionsDelegate, private siteHomeProvider: CoreSiteHomeProvider, - private eventsProvider: CoreEventsProvider, private fileHelper: CoreFileHelperProvider, - private appProvider: CoreAppProvider, private fileProvider: CoreFileProvider, private injector: Injector, - private coursesProvider: CoreCoursesProvider, private courseOffline: CoreCourseOfflineProvider, - loggerProvider: CoreLoggerProvider) { + constructor(private courseProvider: CoreCourseProvider, + private domUtils: CoreDomUtilsProvider, + private moduleDelegate: CoreCourseModuleDelegate, + private prefetchDelegate: CoreCourseModulePrefetchDelegate, + private filepoolProvider: CoreFilepoolProvider, + private sitesProvider: CoreSitesProvider, + private textUtils: CoreTextUtilsProvider, + private timeUtils: CoreTimeUtilsProvider, + private utils: CoreUtilsProvider, + private translate: TranslateService, + private loginHelper: CoreLoginHelperProvider, + private courseOptionsDelegate: CoreCourseOptionsDelegate, + private siteHomeProvider: CoreSiteHomeProvider, + private eventsProvider: CoreEventsProvider, + private fileHelper: CoreFileHelperProvider, + private appProvider: CoreAppProvider, + private fileProvider: CoreFileProvider, + private injector: Injector, + private coursesProvider: CoreCoursesProvider, + private courseOffline: CoreCourseOfflineProvider, + loggerProvider: CoreLoggerProvider, + private filterHelper: CoreFilterHelperProvider) { this.logger = loggerProvider.getInstance('CoreCourseHelperProvider'); } @@ -1270,6 +1283,8 @@ export class CoreCourseHelperProvider { promises.push(this.courseProvider.getActivitiesCompletionStatus(course.id)); } + promises.push(this.filterHelper.getFilters('course', course.id)); + return this.utils.allPromises(promises); }).then(() => { // Download success, mark the course as downloaded. diff --git a/src/core/filter/providers/helper.ts b/src/core/filter/providers/helper.ts index af7fbac1d..2b3a6704a 100644 --- a/src/core/filter/providers/helper.ts +++ b/src/core/filter/providers/helper.ts @@ -105,6 +105,7 @@ export class CoreFilterHelperProvider { getFilters(contextLevel: string, instanceId: number, options?: CoreFilterFormatTextOptions, siteId?: string) : Promise { + options = options || {}; options.contextLevel = contextLevel; options.instanceId = instanceId; options.filter = false; diff --git a/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts b/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts index 96ceb2db0..e2cc1d795 100644 --- a/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts +++ b/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts @@ -21,6 +21,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreSitePluginsProvider } from '../../providers/siteplugins'; import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/activity-prefetch-handler'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; /** * Handler to prefetch a module site plugin. @@ -30,12 +31,21 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref protected isResource: boolean; - constructor(translate: TranslateService, appProvider: CoreAppProvider, utils: CoreUtilsProvider, - courseProvider: CoreCourseProvider, filepoolProvider: CoreFilepoolProvider, sitesProvider: CoreSitesProvider, - domUtils: CoreDomUtilsProvider, protected sitePluginsProvider: CoreSitePluginsProvider, component: string, - name: string, modName: string, protected handlerSchema: any) { + constructor(translate: TranslateService, + appProvider: CoreAppProvider, + utils: CoreUtilsProvider, + courseProvider: CoreCourseProvider, + filepoolProvider: CoreFilepoolProvider, + sitesProvider: CoreSitesProvider, + domUtils: CoreDomUtilsProvider, + filterHelper: CoreFilterHelperProvider, + protected sitePluginsProvider: CoreSitePluginsProvider, + component: string, + name: string, + modName: string, + protected handlerSchema: any) { - super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils); + super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils, filterHelper); this.component = component; this.name = name; diff --git a/src/core/siteplugins/providers/helper.ts b/src/core/siteplugins/providers/helper.ts index 5c992ff6f..d80bfe84b 100644 --- a/src/core/siteplugins/providers/helper.ts +++ b/src/core/siteplugins/providers/helper.ts @@ -31,6 +31,7 @@ import { CoreCompileProvider } from '@core/compile/providers/compile'; import { CoreQuestionProvider } from '@core/question/providers/question'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCoursesProvider } from '@core/courses/providers/courses'; +import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; // Delegates import { CoreMainMenuDelegate } from '@core/mainmenu/providers/delegate'; @@ -84,21 +85,39 @@ export class CoreSitePluginsHelperProvider { protected logger; protected courseRestrictHandlers = {}; - constructor(logger: CoreLoggerProvider, private sitesProvider: CoreSitesProvider, private domUtils: CoreDomUtilsProvider, - private mainMenuDelegate: CoreMainMenuDelegate, private moduleDelegate: CoreCourseModuleDelegate, - private userDelegate: CoreUserDelegate, private langProvider: CoreLangProvider, private http: Http, - private sitePluginsProvider: CoreSitePluginsProvider, private prefetchDelegate: CoreCourseModulePrefetchDelegate, - private compileProvider: CoreCompileProvider, private utils: CoreUtilsProvider, private urlUtils: CoreUrlUtilsProvider, - private courseOptionsDelegate: CoreCourseOptionsDelegate, private eventsProvider: CoreEventsProvider, - private courseFormatDelegate: CoreCourseFormatDelegate, private profileFieldDelegate: CoreUserProfileFieldDelegate, - private textUtils: CoreTextUtilsProvider, private filepoolProvider: CoreFilepoolProvider, - private settingsDelegate: CoreSettingsDelegate, private questionDelegate: CoreQuestionDelegate, - private questionBehaviourDelegate: CoreQuestionBehaviourDelegate, private questionProvider: CoreQuestionProvider, - private messageOutputDelegate: AddonMessageOutputDelegate, private accessRulesDelegate: AddonModQuizAccessRuleDelegate, - private assignSubmissionDelegate: AddonModAssignSubmissionDelegate, private translate: TranslateService, - private assignFeedbackDelegate: AddonModAssignFeedbackDelegate, private appProvider: CoreAppProvider, + constructor(logger: CoreLoggerProvider, + private sitesProvider: CoreSitesProvider, + private domUtils: CoreDomUtilsProvider, + private mainMenuDelegate: CoreMainMenuDelegate, + private moduleDelegate: CoreCourseModuleDelegate, + private userDelegate: CoreUserDelegate, + private langProvider: CoreLangProvider, + private http: Http, + private sitePluginsProvider: CoreSitePluginsProvider, + private prefetchDelegate: CoreCourseModulePrefetchDelegate, + private compileProvider: CoreCompileProvider, + private utils: CoreUtilsProvider, + private urlUtils: CoreUrlUtilsProvider, + private courseOptionsDelegate: CoreCourseOptionsDelegate, + private eventsProvider: CoreEventsProvider, + private courseFormatDelegate: CoreCourseFormatDelegate, + private profileFieldDelegate: CoreUserProfileFieldDelegate, + private textUtils: CoreTextUtilsProvider, + private filepoolProvider: CoreFilepoolProvider, + private settingsDelegate: CoreSettingsDelegate, + private questionDelegate: CoreQuestionDelegate, + private questionBehaviourDelegate: CoreQuestionBehaviourDelegate, + private questionProvider: CoreQuestionProvider, + private messageOutputDelegate: AddonMessageOutputDelegate, + private accessRulesDelegate: AddonModQuizAccessRuleDelegate, + private assignSubmissionDelegate: AddonModAssignSubmissionDelegate, + private translate: TranslateService, + private assignFeedbackDelegate: AddonModAssignFeedbackDelegate, + private appProvider: CoreAppProvider, private workshopAssessmentStrategyDelegate: AddonWorkshopAssessmentStrategyDelegate, - private courseProvider: CoreCourseProvider, private blockDelegate: CoreBlockDelegate) { + private courseProvider: CoreCourseProvider, + private blockDelegate: CoreBlockDelegate, + private filterHelper: CoreFilterHelperProvider) { this.logger = logger.getInstance('CoreSitePluginsHelperProvider'); @@ -820,7 +839,7 @@ export class CoreSitePluginsHelperProvider { if (handlerSchema.offlinefunctions && Object.keys(handlerSchema.offlinefunctions).length) { // Register the prefetch handler. this.prefetchDelegate.registerHandler(new CoreSitePluginsModulePrefetchHandler(this.translate, this.appProvider, - this.utils, this.courseProvider, this.filepoolProvider, this.sitesProvider, this.domUtils, + this.utils, this.courseProvider, this.filepoolProvider, this.sitesProvider, this.domUtils, this.filterHelper, this.sitePluginsProvider, plugin.component, uniqueName, modName, handlerSchema)); }