MOBILE-1874 modules: Implement plugin_supports for modules

main
dpalou 2018-10-18 11:04:04 +02:00
parent 0b357db3b5
commit c3df04a9ac
23 changed files with 355 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/cour
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { AddonModAssignProvider } from './assign'; import { AddonModAssignProvider } from './assign';
import { AddonModAssignIndexComponent } from '../components/index/index'; import { AddonModAssignIndexComponent } from '../components/index/index';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support assign modules. * Handler to support assign modules.
@ -27,6 +28,21 @@ export class AddonModAssignModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModAssign'; name = 'AddonModAssign';
modName = 'assign'; modName = 'assign';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_ADVANCED_GRADING]: true,
[CoreConstants.FEATURE_PLAGIARISM]: true,
[CoreConstants.FEATURE_COMMENT]: true
};
constructor(private courseProvider: CoreCourseProvider, private assignProvider: AddonModAssignProvider) { } constructor(private courseProvider: CoreCourseProvider, private assignProvider: AddonModAssignProvider) { }
/** /**

View File

@ -18,6 +18,7 @@ import { AddonModBookProvider } from './book';
import { AddonModBookIndexComponent } from '../components/index/index'; import { AddonModBookIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support book modules. * Handler to support book modules.
@ -27,6 +28,18 @@ export class AddonModBookModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModBook'; name = 'AddonModBook';
modName = 'book'; modName = 'book';
supportedFeatures = {
[CoreConstants.FEATURE_MOD_ARCHETYPE]: CoreConstants.MOD_ARCHETYPE_RESOURCE,
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(protected bookProvider: AddonModBookProvider, private courseProvider: CoreCourseProvider) { } constructor(protected bookProvider: AddonModBookProvider, private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModChatIndexComponent } from '../components/index/index'; import { AddonModChatIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support chat modules. * Handler to support chat modules.
@ -26,6 +27,17 @@ export class AddonModChatModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModChat'; name = 'AddonModChat';
modName = 'chat'; modName = 'chat';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModChoiceIndexComponent } from '../components/index/index'; import { AddonModChoiceIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support choice modules. * Handler to support choice modules.
@ -26,6 +27,18 @@ export class AddonModChoiceModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModChoice'; name = 'AddonModChoice';
modName = 'choice'; modName = 'choice';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -18,6 +18,7 @@ import { AddonModDataIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { AddonModDataProvider } from './data'; import { AddonModDataProvider } from './data';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support data modules. * Handler to support data modules.
@ -27,6 +28,20 @@ export class AddonModDataModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModData'; name = 'AddonModData';
modName = 'data'; modName = 'data';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_RATE]: true,
[CoreConstants.FEATURE_COMMENT]: true
};
constructor(private courseProvider: CoreCourseProvider, private dataProvider: AddonModDataProvider) { } constructor(private courseProvider: CoreCourseProvider, private dataProvider: AddonModDataProvider) { }
/** /**

View File

@ -18,6 +18,7 @@ import { AddonModFeedbackIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { AddonModFeedbackProvider } from './feedback'; import { AddonModFeedbackProvider } from './feedback';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support feedback modules. * Handler to support feedback modules.
@ -27,6 +28,18 @@ export class AddonModFeedbackModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModFeedback'; name = 'AddonModFeedback';
modName = 'feedback'; modName = 'feedback';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider, private feedbackProvider: AddonModFeedbackProvider) { } constructor(private courseProvider: CoreCourseProvider, private feedbackProvider: AddonModFeedbackProvider) { }
/** /**

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModFolderIndexComponent } from '../components/index/index'; import { AddonModFolderIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support folder modules. * Handler to support folder modules.
@ -26,6 +27,18 @@ export class AddonModFolderModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModFolder'; name = 'AddonModFolder';
modName = 'folder'; modName = 'folder';
supportedFeatures = {
[CoreConstants.FEATURE_MOD_ARCHETYPE]: CoreConstants.MOD_ARCHETYPE_RESOURCE,
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -21,6 +21,7 @@ import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/cour
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { AddonModForumProvider } from './forum'; import { AddonModForumProvider } from './forum';
import { AddonModForumIndexComponent } from '../components/index/index'; import { AddonModForumIndexComponent } from '../components/index/index';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support forum modules. * Handler to support forum modules.
@ -30,6 +31,20 @@ export class AddonModForumModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModForum'; name = 'AddonModForum';
modName = 'forum'; modName = 'forum';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_RATE]: true,
[CoreConstants.FEATURE_PLAGIARISM]: true
};
constructor(private courseProvider: CoreCourseProvider, private forumProvider: AddonModForumProvider, constructor(private courseProvider: CoreCourseProvider, private forumProvider: AddonModForumProvider,
private translate: TranslateService, private eventsProvider: CoreEventsProvider, private translate: TranslateService, private eventsProvider: CoreEventsProvider,
private sitesProvider: CoreSitesProvider) {} private sitesProvider: CoreSitesProvider) {}

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModGlossaryIndexComponent } from '../components/index/index'; import { AddonModGlossaryIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support glossary modules. * Handler to support glossary modules.
@ -26,6 +27,20 @@ export class AddonModGlossaryModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModGlossary'; name = 'AddonModGlossary';
modName = 'glossary'; modName = 'glossary';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_RATE]: true,
[CoreConstants.FEATURE_PLAGIARISM]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -18,6 +18,7 @@ import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/cour
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { AddonModImscpIndexComponent } from '../components/index/index'; import { AddonModImscpIndexComponent } from '../components/index/index';
import { AddonModImscpProvider } from './imscp'; import { AddonModImscpProvider } from './imscp';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support IMSCP modules. * Handler to support IMSCP modules.
@ -27,6 +28,18 @@ export class AddonModImscpModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModImscp'; name = 'AddonModImscp';
modName = 'imscp'; modName = 'imscp';
supportedFeatures = {
[CoreConstants.FEATURE_MOD_ARCHETYPE]: CoreConstants.MOD_ARCHETYPE_RESOURCE,
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider, protected imscpProvider: AddonModImscpProvider) { } constructor(private courseProvider: CoreCourseProvider, protected imscpProvider: AddonModImscpProvider) { }
/** /**

View File

@ -14,6 +14,7 @@
import { Injectable, Injector } from '@angular/core'; import { Injectable, Injector } from '@angular/core';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support label modules. * Handler to support label modules.
@ -23,6 +24,19 @@ export class AddonModLabelModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModLabel'; name = 'AddonModLabel';
modName = 'label'; modName = 'label';
supportedFeatures = {
[CoreConstants.FEATURE_MOD_ARCHETYPE]: CoreConstants.MOD_ARCHETYPE_RESOURCE,
[CoreConstants.FEATURE_IDNUMBER]: true,
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: false,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor() { constructor() {
// Nothing to do. // Nothing to do.
} }

View File

@ -18,6 +18,7 @@ import { AddonModLessonIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { AddonModLessonProvider } from './lesson'; import { AddonModLessonProvider } from './lesson';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support quiz modules. * Handler to support quiz modules.
@ -27,6 +28,18 @@ export class AddonModLessonModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModLesson'; name = 'AddonModLesson';
modName = 'lesson'; modName = 'lesson';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider, private lessonProvider: AddonModLessonProvider) { } constructor(private courseProvider: CoreCourseProvider, private lessonProvider: AddonModLessonProvider) { }
/** /**

View File

@ -23,6 +23,7 @@ import { CoreFilepoolProvider } from '@providers/filepool';
import { CoreSitesProvider } from '@providers/sites'; import { CoreSitesProvider } from '@providers/sites';
import { AddonModLtiIndexComponent } from '../components/index/index'; import { AddonModLtiIndexComponent } from '../components/index/index';
import { AddonModLtiProvider } from './lti'; import { AddonModLtiProvider } from './lti';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support LTI modules. * Handler to support LTI modules.
@ -32,6 +33,17 @@ export class AddonModLtiModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModLti'; name = 'AddonModLti';
modName = 'lti'; modName = 'lti';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private appProvider: CoreAppProvider, constructor(private appProvider: CoreAppProvider,
private courseProvider: CoreCourseProvider, private courseProvider: CoreCourseProvider,
private domUtils: CoreDomUtilsProvider, private domUtils: CoreDomUtilsProvider,

View File

@ -18,6 +18,7 @@ import { AddonModPageProvider } from './page';
import { AddonModPageIndexComponent } from '../components/index/index'; import { AddonModPageIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support page modules. * Handler to support page modules.
@ -27,6 +28,18 @@ export class AddonModPageModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModPage'; name = 'AddonModPage';
modName = 'page'; modName = 'page';
supportedFeatures = {
[CoreConstants.FEATURE_MOD_ARCHETYPE]: CoreConstants.MOD_ARCHETYPE_RESOURCE,
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider, protected pageProvider: AddonModPageProvider) { } constructor(private courseProvider: CoreCourseProvider, protected pageProvider: AddonModPageProvider) { }
/** /**

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModQuizIndexComponent } from '../components/index/index'; import { AddonModQuizIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support quiz modules. * Handler to support quiz modules.
@ -26,6 +27,20 @@ export class AddonModQuizModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModQuiz'; name = 'AddonModQuiz';
modName = 'quiz'; modName = 'quiz';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_CONTROLS_GRADE_VISIBILITY]: true,
[CoreConstants.FEATURE_USES_QUESTIONS]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -34,6 +34,18 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModResource'; name = 'AddonModResource';
modName = 'resource'; modName = 'resource';
supportedFeatures = {
[CoreConstants.FEATURE_MOD_ARCHETYPE]: CoreConstants.MOD_ARCHETYPE_RESOURCE,
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
protected statusObserver; protected statusObserver;
constructor(protected resourceProvider: AddonModResourceProvider, private courseProvider: CoreCourseProvider, constructor(protected resourceProvider: AddonModResourceProvider, private courseProvider: CoreCourseProvider,

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModScormIndexComponent } from '../components/index/index'; import { AddonModScormIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support SCORM modules. * Handler to support SCORM modules.
@ -26,6 +27,18 @@ export class AddonModScormModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModScorm'; name = 'AddonModScorm';
modName = 'scorm'; modName = 'scorm';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModSurveyIndexComponent } from '../components/index/index'; import { AddonModSurveyIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support survey modules. * Handler to support survey modules.
@ -26,6 +27,18 @@ export class AddonModSurveyModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModSurvey'; name = 'AddonModSurvey';
modName = 'survey'; modName = 'survey';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_COMPLETION_HAS_RULES]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -31,6 +31,18 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModUrl'; name = 'AddonModUrl';
modName = 'url'; modName = 'url';
supportedFeatures = {
[CoreConstants.FEATURE_MOD_ARCHETYPE]: CoreConstants.MOD_ARCHETYPE_RESOURCE,
[CoreConstants.FEATURE_GROUPS]: false,
[CoreConstants.FEATURE_GROUPINGS]: false,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true
};
constructor(private courseProvider: CoreCourseProvider, private urlProvider: AddonModUrlProvider, constructor(private courseProvider: CoreCourseProvider, private urlProvider: AddonModUrlProvider,
private urlHelper: AddonModUrlHelperProvider, private domUtils: CoreDomUtilsProvider, private urlHelper: AddonModUrlHelperProvider, private domUtils: CoreDomUtilsProvider,
private contentLinksHelper: CoreContentLinksHelperProvider) { } private contentLinksHelper: CoreContentLinksHelperProvider) { }

View File

@ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular';
import { AddonModWikiIndexComponent } from '../components/index/index'; import { AddonModWikiIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support wiki modules. * Handler to support wiki modules.
@ -26,6 +27,19 @@ export class AddonModWikiModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModWiki'; name = 'AddonModWiki';
modName = 'wiki'; modName = 'wiki';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: false,
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_RATE]: false,
[CoreConstants.FEATURE_COMMENT]: true
};
constructor(private courseProvider: CoreCourseProvider) { } constructor(private courseProvider: CoreCourseProvider) { }
/** /**

View File

@ -18,6 +18,7 @@ import { AddonModWorkshopIndexComponent } from '../components/index/index';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreCourseProvider } from '@core/course/providers/course';
import { AddonModWorkshopProvider } from './workshop'; import { AddonModWorkshopProvider } from './workshop';
import { CoreConstants } from '@core/constants';
/** /**
* Handler to support workshop modules. * Handler to support workshop modules.
@ -27,6 +28,17 @@ export class AddonModWorkshopModuleHandler implements CoreCourseModuleHandler {
name = 'AddonModWorkshop'; name = 'AddonModWorkshop';
modName = 'workshop'; modName = 'workshop';
supportedFeatures = {
[CoreConstants.FEATURE_GROUPS]: true,
[CoreConstants.FEATURE_GROUPINGS]: true,
[CoreConstants.FEATURE_MOD_INTRO]: true,
[CoreConstants.FEATURE_COMPLETION_TRACKS_VIEWS]: true,
[CoreConstants.FEATURE_GRADE_HAS_GRADE]: true,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_PLAGIARISM]: true
};
constructor(private courseProvider: CoreCourseProvider, private workshopProvider: AddonModWorkshopProvider) { } constructor(private courseProvider: CoreCourseProvider, private workshopProvider: AddonModWorkshopProvider) { }
/** /**

View File

@ -57,4 +57,31 @@ export class CoreConstants {
static RESOURCELIB_DISPLAY_DOWNLOAD = 4; // Force download of file instead of display. static RESOURCELIB_DISPLAY_DOWNLOAD = 4; // Force download of file instead of display.
static RESOURCELIB_DISPLAY_OPEN = 5; // Open directly. static RESOURCELIB_DISPLAY_OPEN = 5; // Open directly.
static RESOURCELIB_DISPLAY_POPUP = 6; // Open in "emulated" pop-up without navigation. static RESOURCELIB_DISPLAY_POPUP = 6; // Open in "emulated" pop-up without navigation.
// Feature constants. Used to report features that are, or are not, supported by a module.
static FEATURE_GRADE_HAS_GRADE = 'grade_has_grade'; // True if module can provide a grade.
static FEATURE_GRADE_OUTCOMES = 'outcomes'; // True if module supports outcomes.
static FEATURE_ADVANCED_GRADING = 'grade_advanced_grading'; // True if module supports advanced grading methods.
static FEATURE_CONTROLS_GRADE_VISIBILITY = 'controlsgradevisbility'; // True if module controls grade visibility over gradebook.
static FEATURE_PLAGIARISM = 'plagiarism'; // True if module supports plagiarism plugins.
static FEATURE_COMPLETION_TRACKS_VIEWS = 'completion_tracks_views'; // True if module tracks whether somebody viewed it.
static FEATURE_COMPLETION_HAS_RULES = 'completion_has_rules'; // True if module has custom completion rules.
static FEATURE_NO_VIEW_LINK = 'viewlink'; // True if module has no 'view' page (like label).
static FEATURE_IDNUMBER = 'idnumber'; // True if module wants support for setting the ID number for grade calculation purposes.
static FEATURE_GROUPS = 'groups'; // True if module supports groups.
static FEATURE_GROUPINGS = 'groupings'; // True if module supports groupings.
static FEATURE_MOD_ARCHETYPE = 'mod_archetype'; // Type of module.
static FEATURE_MOD_INTRO = 'mod_intro'; // True if module supports intro editor.
static FEATURE_MODEDIT_DEFAULT_COMPLETION = 'modedit_default_completion'; // True if module has default completion.
static FEATURE_COMMENT = 'comment';
static FEATURE_RATE = 'rate';
static FEATURE_BACKUP_MOODLE2 = 'backup_moodle2'; // True if module supports backup/restore of moodle2 format.
static FEATURE_SHOW_DESCRIPTION = 'showdescription'; // True if module can show description on course main page.
static FEATURE_USES_QUESTIONS = 'usesquestions'; // True if module uses the question bank.
// Pssobile archetypes for modules.
static MOD_ARCHETYPE_OTHER = 0; // Unspecified module archetype.
static MOD_ARCHETYPE_RESOURCE = 1; // Resource-like type module.
static MOD_ARCHETYPE_ASSIGNMENT = 2; // Assignment module archetype.
static MOD_ARCHETYPE_SYSTEM = 3; // System (not user-addable) module archetype.
} }

View File

@ -33,6 +33,14 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler {
*/ */
modName: string; modName: string;
/**
* List of supported features. The keys should be the name of the feature.
* This is to replicate the "plugin_supports" function of Moodle.
* If you need some dynamic checks please implement the supportsFeature function.
* @type {{[name: string]: any}}
*/
supportedFeatures?: {[name: string]: any};
/** /**
* Get the data required to display the module in the course contents view. * Get the data required to display the module in the course contents view.
* *
@ -62,6 +70,15 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler {
* @return {boolean} Whether the refresher should be displayed. * @return {boolean} Whether the refresher should be displayed.
*/ */
displayRefresherInSingleActivity?(): boolean; displayRefresherInSingleActivity?(): boolean;
/**
* Check if this type of module supports a certain feature.
* If this function is implemented, the supportedFeatures object will be ignored.
*
* @param {string} feature The feature to check.
* @return {any} The result of the supports check.
*/
supportsFeature?(feature: string): any;
} }
/** /**
@ -284,4 +301,34 @@ export class CoreCourseModuleDelegate extends CoreDelegate {
displayRefresherInSingleActivity(modname: string): boolean { displayRefresherInSingleActivity(modname: string): boolean {
return this.executeFunctionOnEnabled(modname, 'displayRefresherInSingleActivity'); return this.executeFunctionOnEnabled(modname, 'displayRefresherInSingleActivity');
} }
/**
* Check if a certain type of module supports a certain feature.
*
* @param {string} modname The modname.
* @param {string} feature The feature to check.
* @param {any} defaultValue Value to return if the module is not supported or doesn't know if it's supported.
* @return {any} The result of the supports check.
*/
supportsFeature(modname: string, feature: string, defaultValue: any): any {
const handler = this.enabledHandlers[modname];
let result;
if (handler) {
if (handler['supportsFeature']) {
// The handler specified a function to determine the feature, use it.
result = handler['supportsFeature'].apply(handler, [feature]);
} else if (handler['supportedFeatures']) {
// Handler has an object to determine the feature, use it.
result = handler['supportedFeatures'][feature];
}
}
if (result === null || typeof result == 'undefined') {
// Not supported or doesn't know, return defaul.
return defaultValue;
} else {
return result;
}
}
} }