forked from CIT/Vmeda.Online
		
	MOBILE-1874 modules: Implement plugin_supports for modules
This commit is contained in:
		
							parent
							
								
									0b357db3b5
								
							
						
					
					
						commit
						c3df04a9ac
					
				| @ -18,6 +18,7 @@ import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/cour | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { AddonModAssignProvider } from './assign'; | ||||
| import { AddonModAssignIndexComponent } from '../components/index/index'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support assign modules. | ||||
| @ -27,6 +28,21 @@ export class AddonModAssignModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModAssign'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -18,6 +18,7 @@ import { AddonModBookProvider } from './book'; | ||||
| import { AddonModBookIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support book modules. | ||||
| @ -27,6 +28,18 @@ export class AddonModBookModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModBook'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModChatIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support chat modules. | ||||
| @ -26,6 +27,17 @@ export class AddonModChatModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModChat'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModChoiceIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support choice modules. | ||||
| @ -26,6 +27,18 @@ export class AddonModChoiceModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModChoice'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -18,6 +18,7 @@ import { AddonModDataIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { AddonModDataProvider } from './data'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support data modules. | ||||
| @ -27,6 +28,20 @@ export class AddonModDataModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModData'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -18,6 +18,7 @@ import { AddonModFeedbackIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { AddonModFeedbackProvider } from './feedback'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support feedback modules. | ||||
| @ -27,6 +28,18 @@ export class AddonModFeedbackModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModFeedback'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModFolderIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support folder modules. | ||||
| @ -26,6 +27,18 @@ export class AddonModFolderModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModFolder'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -21,6 +21,7 @@ import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/cour | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { AddonModForumProvider } from './forum'; | ||||
| import { AddonModForumIndexComponent } from '../components/index/index'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support forum modules. | ||||
| @ -30,6 +31,20 @@ export class AddonModForumModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModForum'; | ||||
|     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, | ||||
|             private translate: TranslateService, private eventsProvider: CoreEventsProvider, | ||||
|             private sitesProvider: CoreSitesProvider) {} | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModGlossaryIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support glossary modules. | ||||
| @ -26,6 +27,20 @@ export class AddonModGlossaryModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModGlossary'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -18,6 +18,7 @@ import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/cour | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { AddonModImscpIndexComponent } from '../components/index/index'; | ||||
| import { AddonModImscpProvider } from './imscp'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support IMSCP modules. | ||||
| @ -27,6 +28,18 @@ export class AddonModImscpModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModImscp'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -14,6 +14,7 @@ | ||||
| 
 | ||||
| import { Injectable, Injector } from '@angular/core'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support label modules. | ||||
| @ -23,6 +24,19 @@ export class AddonModLabelModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModLabel'; | ||||
|     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() { | ||||
|         // Nothing to do.
 | ||||
|     } | ||||
|  | ||||
| @ -18,6 +18,7 @@ import { AddonModLessonIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { AddonModLessonProvider } from './lesson'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support quiz modules. | ||||
| @ -27,6 +28,18 @@ export class AddonModLessonModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModLesson'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -23,6 +23,7 @@ import { CoreFilepoolProvider } from '@providers/filepool'; | ||||
| import { CoreSitesProvider } from '@providers/sites'; | ||||
| import { AddonModLtiIndexComponent } from '../components/index/index'; | ||||
| import { AddonModLtiProvider } from './lti'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support LTI modules. | ||||
| @ -32,6 +33,17 @@ export class AddonModLtiModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModLti'; | ||||
|     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, | ||||
|             private courseProvider: CoreCourseProvider, | ||||
|             private domUtils: CoreDomUtilsProvider, | ||||
|  | ||||
| @ -18,6 +18,7 @@ import { AddonModPageProvider } from './page'; | ||||
| import { AddonModPageIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support page modules. | ||||
| @ -27,6 +28,18 @@ export class AddonModPageModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModPage'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModQuizIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support quiz modules. | ||||
| @ -26,6 +27,20 @@ export class AddonModQuizModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModQuiz'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -34,6 +34,18 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModResource'; | ||||
|     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; | ||||
| 
 | ||||
|     constructor(protected resourceProvider: AddonModResourceProvider, private courseProvider: CoreCourseProvider, | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModScormIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support SCORM modules. | ||||
| @ -26,6 +27,18 @@ export class AddonModScormModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModScorm'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModSurveyIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support survey modules. | ||||
| @ -26,6 +27,18 @@ export class AddonModSurveyModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModSurvey'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -31,6 +31,18 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModUrl'; | ||||
|     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, | ||||
|         private urlHelper: AddonModUrlHelperProvider, private domUtils: CoreDomUtilsProvider, | ||||
|         private contentLinksHelper: CoreContentLinksHelperProvider) { } | ||||
|  | ||||
| @ -17,6 +17,7 @@ import { NavController, NavOptions } from 'ionic-angular'; | ||||
| import { AddonModWikiIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support wiki modules. | ||||
| @ -26,6 +27,19 @@ export class AddonModWikiModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModWiki'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -18,6 +18,7 @@ import { AddonModWorkshopIndexComponent } from '../components/index/index'; | ||||
| import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { AddonModWorkshopProvider } from './workshop'; | ||||
| import { CoreConstants } from '@core/constants'; | ||||
| 
 | ||||
| /** | ||||
|  * Handler to support workshop modules. | ||||
| @ -27,6 +28,17 @@ export class AddonModWorkshopModuleHandler implements CoreCourseModuleHandler { | ||||
|     name = 'AddonModWorkshop'; | ||||
|     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) { } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -57,4 +57,31 @@ export class CoreConstants { | ||||
|     static RESOURCELIB_DISPLAY_DOWNLOAD = 4; // Force download of file instead of display.
 | ||||
|     static RESOURCELIB_DISPLAY_OPEN = 5; // Open directly.
 | ||||
|     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.
 | ||||
| } | ||||
|  | ||||
| @ -33,6 +33,14 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { | ||||
|      */ | ||||
|     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. | ||||
|      * | ||||
| @ -62,6 +70,15 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { | ||||
|      * @return {boolean} Whether the refresher should be displayed. | ||||
|      */ | ||||
|     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 { | ||||
|         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; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user