MOBILE-2491 filter: Prefetch filters

main
Dani Palou 2019-10-08 11:30:20 +02:00
parent b99d31ca61
commit 0d41e7206c
27 changed files with 313 additions and 114 deletions

View File

@ -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));
});
}
});
}

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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);
}
/**

View File

@ -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.

View File

@ -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<any> } } = {};
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.

View File

@ -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);
});

View File

@ -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<any> } } = {};
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.

View File

@ -105,6 +105,7 @@ export class CoreFilterHelperProvider {
getFilters(contextLevel: string, instanceId: number, options?: CoreFilterFormatTextOptions, siteId?: string)
: Promise<CoreFilterFilter[]> {
options = options || {};
options.contextLevel = contextLevel;
options.instanceId = instanceId;
options.filter = false;

View File

@ -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;

View File

@ -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));
}