diff --git a/src/core/features/block/components/side-blocks-button/side-blocks-button.html b/src/core/features/block/components/side-blocks-button/side-blocks-button.html
index b4d634937..d38d89e7f 100644
--- a/src/core/features/block/components/side-blocks-button/side-blocks-button.html
+++ b/src/core/features/block/components/side-blocks-button/side-blocks-button.html
@@ -1,3 +1,3 @@
-
+
diff --git a/src/core/features/block/components/side-blocks/side-blocks.html b/src/core/features/block/components/side-blocks/side-blocks.html
index 627139e3c..52408d9f2 100644
--- a/src/core/features/block/components/side-blocks/side-blocks.html
+++ b/src/core/features/block/components/side-blocks/side-blocks.html
@@ -20,7 +20,7 @@
-
+
diff --git a/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html b/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html
index 1f3a37007..17cf0dd0f 100644
--- a/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html
+++ b/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html
@@ -1 +1,4 @@
+
+
+
diff --git a/src/core/features/course/format/singleactivity/components/singleactivity.ts b/src/core/features/course/format/singleactivity/components/singleactivity.ts
index ade822ac2..3fd7cf5c0 100644
--- a/src/core/features/course/format/singleactivity/components/singleactivity.ts
+++ b/src/core/features/course/format/singleactivity/components/singleactivity.ts
@@ -20,6 +20,8 @@ import { CoreDynamicComponent } from '@components/dynamic-component/dynamic-comp
import { CoreCourseAnyCourseData } from '@features/courses/services/courses';
import { IonRefresher } from '@ionic/angular';
import { CoreCourseModuleCompletionData, CoreCourseSectionWithStatus } from '@features/course/services/course-helper';
+import { CoreBlockHelper } from '@features/block/services/block-helper';
+import { CoreCourse } from '@features/course/services/course';
/**
* Component to display single activity format. It will determine the right component to use and instantiate it.
@@ -44,12 +46,13 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges {
componentClass?: Type; // The class of the component to render.
data: Record = {}; // Data to pass to the component.
+ hasBlocks = false;
/**
- * Detect changes on input properties.
+ * @inheritdoc
*/
async ngOnChanges(changes: { [name: string]: SimpleChange }): Promise {
- if (!changes.course || !changes.sections) {
+ if (!changes.course && !changes.sections) {
return;
}
@@ -57,6 +60,8 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges {
return;
}
+ this.hasBlocks = await CoreBlockHelper.hasCourseBlocks(this.course.id);
+
// In single activity the module should only have 1 section and 1 module. Get the module.
const module = this.sections?.[0].modules?.[0];
@@ -85,6 +90,15 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges {
}
await this.dynamicComponent?.callComponentFunction('doRefresh', [refresher, done]);
+
+ if (this.course) {
+ const courseId = this.course.id;
+ await CoreCourse.invalidateCourseBlocks(courseId).then(async () => {
+ this.hasBlocks = await CoreBlockHelper.hasCourseBlocks(courseId);
+
+ return;
+ });
+ }
}
/**
diff --git a/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts b/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts
index 9efe6fc27..3ce49d231 100644
--- a/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts
+++ b/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts
@@ -31,43 +31,28 @@ export class CoreCourseFormatSingleActivityHandlerService implements CoreCourseF
format = 'singleactivity';
/**
- * Whether or not the handler is enabled on a site level.
- *
- * @return True or promise resolved with true if enabled.
+ * @inheritdoc
*/
async isEnabled(): Promise {
return true;
}
/**
- * Whether it allows seeing all sections at the same time. Defaults to true.
- *
- * @param course The course to check.
- * @return Whether it can view all sections.
+ * @inheritdoc
*/
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- canViewAllSections(course: CoreCourseAnyCourseData): boolean {
+ canViewAllSections(): boolean {
return false;
}
/**
- * Whether the option blocks should be displayed. Defaults to true.
- *
- * @param course The course to check.
- * @return Whether it can display blocks.
+ * @inheritdoc
*/
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- displayBlocks(course: CoreCourseAnyCourseData): boolean {
- return false;
+ displayBlocks(): boolean {
+ return true;
}
/**
- * Get the title to use in course page. If not defined, course displayname or fullname.
- * This function will be called without sections first, and then call it again when the sections are retrieved.
- *
- * @param course The course.
- * @param sections List of sections.
- * @return Title.
+ * @inheritdoc
*/
getCourseTitle(course: CoreCourseAnyCourseData, sections?: CoreCourseWSSection[]): string {
if (sections?.[0]?.modules?.[0]) {
@@ -84,34 +69,21 @@ export class CoreCourseFormatSingleActivityHandlerService implements CoreCourseF
}
/**
- * Whether the option to enable section/module download should be displayed. Defaults to true.
- *
- * @param course The course to check.
- * @return Whether the option to enable section/module download should be displayed
+ * @inheritdoc
*/
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- displayEnableDownload(course: CoreCourseAnyCourseData): boolean {
+ displayEnableDownload(): boolean {
return false;
}
/**
- * Whether the default section selector should be displayed. Defaults to true.
- *
- * @param course The course to check.
- * @return Whether the default section selector should be displayed.
+ * @inheritdoc
*/
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- displaySectionSelector(course: CoreCourseAnyCourseData): boolean {
+ displaySectionSelector(): boolean {
return false;
}
/**
- * Whether the course refresher should be displayed. If it returns false, a refresher must be included in the course format,
- * and the doRefresh method of CoreCourseSectionPage must be called on refresh. Defaults to true.
- *
- * @param course The course to check.
- * @param sections List of course sections.
- * @return Whether the refresher should be displayed.
+ * @inheritdoc
*/
displayRefresher(course: CoreCourseAnyCourseData, sections: CoreCourseWSSection[]): boolean {
if (sections?.[0]?.modules?.[0]) {
@@ -122,28 +94,16 @@ export class CoreCourseFormatSingleActivityHandlerService implements CoreCourseF
}
/**
- * Return the Component to use to display the course format instead of using the default one.
- * Use it if you want to display a format completely different from the default one.
- * If you want to customize the default format there are several methods to customize parts of it.
- * It's recommended to return the class of the component, but you can also return an instance of the component.
- *
- * @param course The course to render.
- * @return The component (or promise resolved with component) to use, undefined if not found.
+ * @inheritdoc
*/
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- async getCourseFormatComponent(course: CoreCourseAnyCourseData): Promise> {
+ async getCourseFormatComponent(): Promise> {
return CoreCourseFormatSingleActivityComponent;
}
/**
- * Whether the view should be refreshed when completion changes. If your course format doesn't display
- * activity completion then you should return false.
- *
- * @param course The course.
- * @return Whether course view should be refreshed when an activity completion changes.
+ * @inheritdoc
*/
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- async shouldRefreshWhenCompletionChanges(course: CoreCourseAnyCourseData): Promise {
+ async shouldRefreshWhenCompletionChanges(): Promise {
return false;
}
diff --git a/src/core/features/course/format/singleactivity/singleactivity.module.ts b/src/core/features/course/format/singleactivity/singleactivity.module.ts
index c42f04b27..5060d7511 100644
--- a/src/core/features/course/format/singleactivity/singleactivity.module.ts
+++ b/src/core/features/course/format/singleactivity/singleactivity.module.ts
@@ -18,6 +18,7 @@ import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseFormatDelegate } from '@features/course/services/format-delegate';
import { CoreCourseFormatSingleActivityComponent } from './components/singleactivity';
import { CoreCourseFormatSingleActivityHandler } from './services/handlers/singleactivity-format';
+import { CoreBlockComponentsModule } from '@features/block/components/components.module';
@NgModule({
declarations: [
@@ -25,6 +26,7 @@ import { CoreCourseFormatSingleActivityHandler } from './services/handlers/singl
],
imports: [
CoreSharedModule,
+ CoreBlockComponentsModule,
],
providers: [
{