2021-03-16 16:25:03 +01:00
|
|
|
// (C) Copyright 2015 Moodle Pty Ltd.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2022-01-18 09:58:44 +01:00
|
|
|
import { CoreConstants, ModPurpose } from '@/core/constants';
|
2024-03-07 12:02:10 +01:00
|
|
|
import { ADDON_MOD_SURVEY_PAGE_NAME } from '@addons/mod/survey/constants';
|
2021-03-16 16:25:03 +01:00
|
|
|
import { Injectable, Type } from '@angular/core';
|
2021-09-08 14:40:20 +02:00
|
|
|
import { CoreModuleHandlerBase } from '@features/course/classes/module-base-handler';
|
|
|
|
import { CoreCourseModuleHandler } from '@features/course/services/module-delegate';
|
2021-03-16 16:25:03 +01:00
|
|
|
import { makeSingleton } from '@singletons';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler to support survey modules.
|
|
|
|
*/
|
|
|
|
@Injectable( { providedIn: 'root' })
|
2021-09-08 14:40:20 +02:00
|
|
|
export class AddonModSurveyModuleHandlerService extends CoreModuleHandlerBase implements CoreCourseModuleHandler {
|
2021-03-16 16:25:03 +01:00
|
|
|
|
|
|
|
name = 'AddonModSurvey';
|
|
|
|
modName = 'survey';
|
2024-03-07 12:02:10 +01:00
|
|
|
protected pageName = ADDON_MOD_SURVEY_PAGE_NAME;
|
2021-03-16 16:25:03 +01:00
|
|
|
|
|
|
|
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,
|
2022-01-18 09:58:44 +01:00
|
|
|
[CoreConstants.FEATURE_MOD_PURPOSE]: ModPurpose.MOD_PURPOSE_COMMUNICATION,
|
2021-03-16 16:25:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
async getMainComponent(): Promise<Type<unknown>> {
|
2024-03-07 12:02:10 +01:00
|
|
|
const { AddonModSurveyIndexComponent } = await import('@addons/mod/survey/components/index');
|
|
|
|
|
2021-03-16 16:25:03 +01:00
|
|
|
return AddonModSurveyIndexComponent;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
export const AddonModSurveyModuleHandler = makeSingleton(AddonModSurveyModuleHandlerService);
|