+
+
+
+
+
+ {{ 'addon.mod_survey.surveycompletednograph' | translate }}
+
+
+ {{ 'addon.mod_survey.results' | translate }}
+
+
+
+
+
+
+ {{ 'core.hasdatatosync' | translate: {$a: moduleName} }}
+
+
+
+
+
+
+
+
+
{{ question.text }}
+
+
+
+ {{ 'addon.mod_survey.responses' | translate }}
+
+
+ {{ option }}
+
+
+
+
+ {{ question.intro }}
+
+
+
+
+
+
+
+ {{question.num}}. {{ question.text }}
+
+
+
+
+
+
+
+
+ {{ 'core.choose' | translate }}
+ {{option}}
+
+
+
+
+
+
+
+ 0" [class.even]="isEven">
+
+
+ {{question.num}}. {{ question.text }}
+
+
+
+ {{option}}
+
+
+
+
+
+
+
+ {{question.num}}. {{ question.text }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/addon/mod/survey/components/index/index.scss b/src/addon/mod/survey/components/index/index.scss
new file mode 100644
index 000000000..d9cbd7ee7
--- /dev/null
+++ b/src/addon/mod/survey/components/index/index.scss
@@ -0,0 +1,33 @@
+addon-mod-survey-index {
+
+ .label, .label[stacked] {
+ font-size: initial;
+ color: $text-color;
+ }
+
+ .addon-mod_survey-question {
+ border-top: 1px solid $gray;
+ }
+
+ ion-grid {
+ background-color: $white;
+ }
+
+ ion-select {
+ float: right;
+ max-width: none;
+ .select-text {
+ white-space: normal;
+ text-align: right;
+ }
+ }
+
+ .even {
+ background-color: $gray-light;
+ }
+
+ .addon-mod_survey-textarea textarea {
+ height: 100px;
+ border: 1px solid $gray-dark;
+ }
+}
\ No newline at end of file
diff --git a/src/addon/mod/survey/components/index/index.ts b/src/addon/mod/survey/components/index/index.ts
new file mode 100644
index 000000000..a5e8e234b
--- /dev/null
+++ b/src/addon/mod/survey/components/index/index.ts
@@ -0,0 +1,221 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// 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.
+
+import { Component, Optional, Injector } from '@angular/core';
+import { Content } from 'ionic-angular';
+import { CoreCourseModuleMainActivityComponent } from '@core/course/classes/main-activity-component';
+import { AddonModSurveyProvider } from '../../providers/survey';
+import { AddonModSurveyHelperProvider } from '../../providers/helper';
+import { AddonModSurveyOfflineProvider } from '../../providers/offline';
+import { AddonModSurveySyncProvider } from '../../providers/sync';
+
+/**
+ * Component that displays a survey.
+ */
+@Component({
+ selector: 'addon-mod-survey-index',
+ templateUrl: 'index.html',
+})
+export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityComponent {
+ component = AddonModSurveyProvider.COMPONENT;
+ moduleName = 'survey';
+
+ survey: any;
+ questions: any;
+ answers = {};
+
+ protected userId: number;
+ protected syncEventName = AddonModSurveySyncProvider.AUTO_SYNCED;
+
+ constructor(injector: Injector, private surveyProvider: AddonModSurveyProvider, @Optional() private content: Content,
+ private surveyHelper: AddonModSurveyHelperProvider, private surveyOffline: AddonModSurveyOfflineProvider,
+ private surveySync: AddonModSurveySyncProvider) {
+ super(injector);
+ }
+
+ /**
+ * Component being initialized.
+ */
+ ngOnInit(): void {
+ super.ngOnInit();
+
+ this.userId = this.sitesProvider.getCurrentSiteUserId();
+
+ this.loadContent(false, true).then(() => {
+ this.surveyProvider.logView(this.survey.id).then(() => {
+ this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
+ });
+ });
+ }
+
+ /**
+ * Perform the invalidate content function.
+ *
+ * @return {Promise