commit
8b15d26f47
|
@ -27,6 +27,11 @@
|
||||||
"addon.badges.version": "badges",
|
"addon.badges.version": "badges",
|
||||||
"addon.badges.warnexpired": "badges",
|
"addon.badges.warnexpired": "badges",
|
||||||
"addon.block_activitymodules.pluginname": "block_activity_modules",
|
"addon.block_activitymodules.pluginname": "block_activity_modules",
|
||||||
|
"addon.block_calendarmonth.pluginname": "block_calendar_month",
|
||||||
|
"addon.block_calendarupcoming.pluginname": "block_calendar_upcoming",
|
||||||
|
"addon.block_comments.pluginname": "block_comments",
|
||||||
|
"addon.block_completionstatus.pluginname": "block_completionstatus",
|
||||||
|
"addon.block_learningplans.pluginname": "block_lp",
|
||||||
"addon.block_myoverview.all": "block_myoverview",
|
"addon.block_myoverview.all": "block_myoverview",
|
||||||
"addon.block_myoverview.favourites": "block_myoverview",
|
"addon.block_myoverview.favourites": "block_myoverview",
|
||||||
"addon.block_myoverview.future": "block_myoverview",
|
"addon.block_myoverview.future": "block_myoverview",
|
||||||
|
@ -38,10 +43,12 @@
|
||||||
"addon.block_myoverview.past": "block_myoverview",
|
"addon.block_myoverview.past": "block_myoverview",
|
||||||
"addon.block_myoverview.pluginname": "block_myoverview",
|
"addon.block_myoverview.pluginname": "block_myoverview",
|
||||||
"addon.block_myoverview.title": "block_myoverview",
|
"addon.block_myoverview.title": "block_myoverview",
|
||||||
|
"addon.block_privatefiles.pluginname": "block_private_files",
|
||||||
"addon.block_recentlyaccessedcourses.nocourses": "block_recentlyaccessedcourses",
|
"addon.block_recentlyaccessedcourses.nocourses": "block_recentlyaccessedcourses",
|
||||||
"addon.block_recentlyaccessedcourses.pluginname": "block_recentlyaccessedcourses",
|
"addon.block_recentlyaccessedcourses.pluginname": "block_recentlyaccessedcourses",
|
||||||
"addon.block_recentlyaccesseditems.noitems": "block_recentlyaccesseditems",
|
"addon.block_recentlyaccesseditems.noitems": "block_recentlyaccesseditems",
|
||||||
"addon.block_recentlyaccesseditems.pluginname": "block_recentlyaccesseditems",
|
"addon.block_recentlyaccesseditems.pluginname": "block_recentlyaccesseditems",
|
||||||
|
"addon.block_selfcompletion.pluginname": "block_selfcompletion",
|
||||||
"addon.block_sitemainmenu.pluginname": "block_site_main_menu",
|
"addon.block_sitemainmenu.pluginname": "block_site_main_menu",
|
||||||
"addon.block_starredcourses.nocourses": "block_starredcourses",
|
"addon.block_starredcourses.nocourses": "block_starredcourses",
|
||||||
"addon.block_starredcourses.pluginname": "block_starredcourses",
|
"addon.block_starredcourses.pluginname": "block_starredcourses",
|
||||||
|
@ -1233,6 +1240,7 @@
|
||||||
"core.answered": "quiz",
|
"core.answered": "quiz",
|
||||||
"core.areyousure": "moodle",
|
"core.areyousure": "moodle",
|
||||||
"core.back": "moodle",
|
"core.back": "moodle",
|
||||||
|
"core.block.blocks": "moodle",
|
||||||
"core.cancel": "moodle",
|
"core.cancel": "moodle",
|
||||||
"core.cannotconnect": "local_moodlemobileapp",
|
"core.cannotconnect": "local_moodlemobileapp",
|
||||||
"core.cannotdownloadfiles": "local_moodlemobileapp",
|
"core.cannotdownloadfiles": "local_moodlemobileapp",
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class AddonBlockActivityModulesHandler extends CoreBlockBaseHandler {
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
// (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 { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||||
|
import { AddonBlockCalendarMonthHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockCalendarMonthHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockCalendarMonthModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockCalendarMonthHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Calendar"
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from '@core/block/components/only-title-block/only-title-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockCalendarMonthHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockCalendarMonth';
|
||||||
|
blockName = 'calendar_month';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the block.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {any} block The block to render.
|
||||||
|
* @param {string} contextLevel The context where the block will be used.
|
||||||
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: 'addon.block_calendarmonth.pluginname',
|
||||||
|
class: 'addon-block-calendar-month',
|
||||||
|
component: CoreBlockOnlyTitleComponent,
|
||||||
|
link: 'AddonCalendarListPage',
|
||||||
|
linkParams: contextLevel == 'course' ? { courseId: instanceId } : null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
// (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 { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||||
|
import { AddonBlockCalendarUpcomingHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockCalendarUpcomingHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockCalendarUpcomingModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockCalendarUpcomingHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": " Upcoming events"
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from '@core/block/components/only-title-block/only-title-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockCalendarUpcomingHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockCalendarUpcoming';
|
||||||
|
blockName = 'calendar_upcoming';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the block.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {any} block The block to render.
|
||||||
|
* @param {string} contextLevel The context where the block will be used.
|
||||||
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: 'addon.block_calendarupcoming.pluginname',
|
||||||
|
class: 'addon-block-calendar-upcoming',
|
||||||
|
component: CoreBlockOnlyTitleComponent,
|
||||||
|
link: 'AddonCalendarListPage',
|
||||||
|
linkParams: contextLevel == 'course' ? { courseId: instanceId } : null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
// (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 { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||||
|
import { AddonBlockCommentsHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockCommentsHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockCommentsModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockCommentsHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Comments"
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from '@core/block/components/only-title-block/only-title-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockCommentsHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockComments';
|
||||||
|
blockName = 'comments';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the block.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {any} block The block to render.
|
||||||
|
* @param {string} contextLevel The context where the block will be used.
|
||||||
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: 'addon.block_comments.pluginname',
|
||||||
|
class: 'addon-block-comments',
|
||||||
|
component: CoreBlockOnlyTitleComponent,
|
||||||
|
link: 'CoreCommentsViewerPage',
|
||||||
|
linkParams: { contextLevel: contextLevel, instanceId: instanceId,
|
||||||
|
component: 'block_comments', area: 'page_comments', itemId: 0 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
// (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 { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||||
|
import { AddonBlockCompletionStatusHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockCompletionStatusHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockCompletionStatusModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockCompletionStatusHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Course completion status"
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from '@core/block/components/only-title-block/only-title-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockCompletionStatusHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockCompletionStatus';
|
||||||
|
blockName = 'completionstatus';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the block.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {any} block The block to render.
|
||||||
|
* @param {string} contextLevel The context where the block will be used.
|
||||||
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: 'addon.block_completionstatus.pluginname',
|
||||||
|
class: 'addon-block-completion-status',
|
||||||
|
component: CoreBlockOnlyTitleComponent,
|
||||||
|
link: 'AddonCourseCompletionReportPage',
|
||||||
|
linkParams: { courseId: instanceId }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Learning plans"
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
// (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 { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||||
|
import { AddonBlockLearningPlansHandler } from './providers/block-handler';
|
||||||
|
import { CoreBlockComponentsModule } from '@core/block/components/components.module';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
CoreBlockComponentsModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockLearningPlansHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockLearningPlansModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockLearningPlansHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from '@core/block/components/only-title-block/only-title-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockLearningPlansHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockLearningPlans';
|
||||||
|
blockName = 'lp';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the block.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {any} block The block to render.
|
||||||
|
* @param {string} contextLevel The context where the block will be used.
|
||||||
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: 'addon.block_learningplans.pluginname',
|
||||||
|
class: 'addon-block-learning-plans',
|
||||||
|
component: CoreBlockOnlyTitleComponent,
|
||||||
|
link: 'AddonCompetencyPlanListPage'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,7 +50,7 @@ export class AddonBlockMyOverviewHandler extends CoreBlockBaseHandler {
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Private files"
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
// (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 { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||||
|
import { AddonBlockPrivateFilesHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockPrivateFilesHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockPrivateFilesModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockPrivateFilesHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from '@core/block/components/only-title-block/only-title-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockPrivateFilesHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockPrivateFiles';
|
||||||
|
blockName = 'private_files';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the block.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {any} block The block to render.
|
||||||
|
* @param {string} contextLevel The context where the block will be used.
|
||||||
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: 'addon.block_privatefiles.pluginname',
|
||||||
|
class: 'addon-block-private-files',
|
||||||
|
component: CoreBlockOnlyTitleComponent,
|
||||||
|
link: 'AddonFilesListPage',
|
||||||
|
linkParams: {root: 'my'}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,7 @@ export class AddonBlockRecentlyAccessedCoursesHandler extends CoreBlockBaseHandl
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class AddonBlockRecentlyAccessedItemsHandler extends CoreBlockBaseHandler
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Self completion"
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from '@core/block/components/only-title-block/only-title-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockSelfCompletionHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockSelfCompletion';
|
||||||
|
blockName = 'selfcompletion';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the block.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {any} block The block to render.
|
||||||
|
* @param {string} contextLevel The context where the block will be used.
|
||||||
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: 'addon.block_selfcompletion.pluginname',
|
||||||
|
class: 'addon-block-self-completion',
|
||||||
|
component: CoreBlockOnlyTitleComponent,
|
||||||
|
link: 'AddonCourseCompletionReportPage',
|
||||||
|
linkParams: { courseId: instanceId }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
// (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 { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockDelegate } from '@core/block/providers/delegate';
|
||||||
|
import { AddonBlockSelfCompletionHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockSelfCompletionHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockSelfCompletionModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockSelfCompletionHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,7 @@ export class AddonBlockSiteMainMenuHandler extends CoreBlockBaseHandler {
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class AddonBlockStarredCoursesHandler extends CoreBlockBaseHandler {
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class AddonBlockTimelineHandler extends CoreBlockBaseHandler {
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -53,6 +53,7 @@ export class AddonCalendarListPage implements OnDestroy {
|
||||||
protected siteHomeId: number;
|
protected siteHomeId: number;
|
||||||
protected obsDefaultTimeChange: any;
|
protected obsDefaultTimeChange: any;
|
||||||
protected eventId: number;
|
protected eventId: number;
|
||||||
|
protected preSelectedCourseId: number;
|
||||||
|
|
||||||
courses: any[];
|
courses: any[];
|
||||||
eventsLoaded = false;
|
eventsLoaded = false;
|
||||||
|
@ -81,6 +82,7 @@ export class AddonCalendarListPage implements OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eventId = navParams.get('eventId') || false;
|
this.eventId = navParams.get('eventId') || false;
|
||||||
|
this.preSelectedCourseId = navParams.get('courseId') || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,6 +120,12 @@ export class AddonCalendarListPage implements OnDestroy {
|
||||||
courses.unshift(this.allCourses);
|
courses.unshift(this.allCourses);
|
||||||
this.courses = courses;
|
this.courses = courses;
|
||||||
|
|
||||||
|
if (this.preSelectedCourseId) {
|
||||||
|
this.filter.course = courses.find((course) => {
|
||||||
|
return course.id == this.preSelectedCourseId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return this.fetchEvents(refresh);
|
return this.fetchEvents(refresh);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,12 +91,19 @@ import { AddonCourseCompletionModule } from '@addon/coursecompletion/coursecompl
|
||||||
import { AddonUserProfileFieldModule } from '@addon/userprofilefield/userprofilefield.module';
|
import { AddonUserProfileFieldModule } from '@addon/userprofilefield/userprofilefield.module';
|
||||||
import { AddonFilesModule } from '@addon/files/files.module';
|
import { AddonFilesModule } from '@addon/files/files.module';
|
||||||
import { AddonBlockActivityModulesModule } from '@addon/block/activitymodules/activitymodules.module';
|
import { AddonBlockActivityModulesModule } from '@addon/block/activitymodules/activitymodules.module';
|
||||||
|
import { AddonBlockCalendarMonthModule } from '@addon/block/calendarmonth/calendarmonth.module';
|
||||||
|
import { AddonBlockCalendarUpcomingModule } from '@addon/block/calendarupcoming/calendarupcoming.module';
|
||||||
|
import { AddonBlockCommentsModule } from '@addon/block/comments/comments.module';
|
||||||
|
import { AddonBlockCompletionStatusModule } from '@addon/block/completionstatus/completionstatus.module';
|
||||||
import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.module';
|
import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.module';
|
||||||
|
import { AddonBlockLearningPlansModule } from '@addon/block/learningplans/learningplans.module';
|
||||||
|
import { AddonBlockPrivateFilesModule } from '@addon/block/privatefiles/privatefiles.module';
|
||||||
import { AddonBlockSiteMainMenuModule } from '@addon/block/sitemainmenu/sitemainmenu.module';
|
import { AddonBlockSiteMainMenuModule } from '@addon/block/sitemainmenu/sitemainmenu.module';
|
||||||
import { AddonBlockTimelineModule } from '@addon/block/timeline/timeline.module';
|
import { AddonBlockTimelineModule } from '@addon/block/timeline/timeline.module';
|
||||||
import { AddonBlockRecentlyAccessedCoursesModule } from '@addon/block/recentlyaccessedcourses/recentlyaccessedcourses.module';
|
import { AddonBlockRecentlyAccessedCoursesModule } from '@addon/block/recentlyaccessedcourses/recentlyaccessedcourses.module';
|
||||||
import { AddonBlockRecentlyAccessedItemsModule } from '@addon/block/recentlyaccesseditems/recentlyaccesseditems.module';
|
import { AddonBlockRecentlyAccessedItemsModule } from '@addon/block/recentlyaccesseditems/recentlyaccesseditems.module';
|
||||||
import { AddonBlockStarredCoursesModule } from '@addon/block/starredcourses/starredcourses.module';
|
import { AddonBlockStarredCoursesModule } from '@addon/block/starredcourses/starredcourses.module';
|
||||||
|
import { AddonBlockSelfCompletionModule } from '@addon/block/selfcompletion/selfcompletion.module';
|
||||||
import { AddonModAssignModule } from '@addon/mod/assign/assign.module';
|
import { AddonModAssignModule } from '@addon/mod/assign/assign.module';
|
||||||
import { AddonModBookModule } from '@addon/mod/book/book.module';
|
import { AddonModBookModule } from '@addon/mod/book/book.module';
|
||||||
import { AddonModChatModule } from '@addon/mod/chat/chat.module';
|
import { AddonModChatModule } from '@addon/mod/chat/chat.module';
|
||||||
|
@ -213,12 +220,19 @@ export const CORE_PROVIDERS: any[] = [
|
||||||
AddonUserProfileFieldModule,
|
AddonUserProfileFieldModule,
|
||||||
AddonFilesModule,
|
AddonFilesModule,
|
||||||
AddonBlockActivityModulesModule,
|
AddonBlockActivityModulesModule,
|
||||||
|
AddonBlockCalendarMonthModule,
|
||||||
|
AddonBlockCalendarUpcomingModule,
|
||||||
|
AddonBlockCommentsModule,
|
||||||
|
AddonBlockCompletionStatusModule,
|
||||||
|
AddonBlockLearningPlansModule,
|
||||||
AddonBlockMyOverviewModule,
|
AddonBlockMyOverviewModule,
|
||||||
|
AddonBlockPrivateFilesModule,
|
||||||
AddonBlockSiteMainMenuModule,
|
AddonBlockSiteMainMenuModule,
|
||||||
AddonBlockTimelineModule,
|
AddonBlockTimelineModule,
|
||||||
AddonBlockRecentlyAccessedCoursesModule,
|
AddonBlockRecentlyAccessedCoursesModule,
|
||||||
AddonBlockRecentlyAccessedItemsModule,
|
AddonBlockRecentlyAccessedItemsModule,
|
||||||
AddonBlockStarredCoursesModule,
|
AddonBlockStarredCoursesModule,
|
||||||
|
AddonBlockSelfCompletionModule,
|
||||||
AddonModAssignModule,
|
AddonModAssignModule,
|
||||||
AddonModBookModule,
|
AddonModBookModule,
|
||||||
AddonModChatModule,
|
AddonModChatModule,
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
"addon.badges.version": "Version",
|
"addon.badges.version": "Version",
|
||||||
"addon.badges.warnexpired": "(This badge has expired!)",
|
"addon.badges.warnexpired": "(This badge has expired!)",
|
||||||
"addon.block_activitymodules.pluginname": "Activities",
|
"addon.block_activitymodules.pluginname": "Activities",
|
||||||
|
"addon.block_calendarmonth.pluginname": "Calendar",
|
||||||
|
"addon.block_calendarupcoming.pluginname": " Upcoming events",
|
||||||
|
"addon.block_comments.pluginname": "Comments",
|
||||||
|
"addon.block_completionstatus.pluginname": "Course completion status",
|
||||||
|
"addon.block_learningplans.pluginname": "Learning plans",
|
||||||
"addon.block_myoverview.all": "All",
|
"addon.block_myoverview.all": "All",
|
||||||
"addon.block_myoverview.favourites": "Starred",
|
"addon.block_myoverview.favourites": "Starred",
|
||||||
"addon.block_myoverview.future": "Future",
|
"addon.block_myoverview.future": "Future",
|
||||||
|
@ -38,10 +43,12 @@
|
||||||
"addon.block_myoverview.past": "Past",
|
"addon.block_myoverview.past": "Past",
|
||||||
"addon.block_myoverview.pluginname": "Course overview",
|
"addon.block_myoverview.pluginname": "Course overview",
|
||||||
"addon.block_myoverview.title": "Course name",
|
"addon.block_myoverview.title": "Course name",
|
||||||
|
"addon.block_privatefiles.pluginname": "Private files",
|
||||||
"addon.block_recentlyaccessedcourses.nocourses": "No recent courses",
|
"addon.block_recentlyaccessedcourses.nocourses": "No recent courses",
|
||||||
"addon.block_recentlyaccessedcourses.pluginname": "Recently accessed courses",
|
"addon.block_recentlyaccessedcourses.pluginname": "Recently accessed courses",
|
||||||
"addon.block_recentlyaccesseditems.noitems": "No recent items",
|
"addon.block_recentlyaccesseditems.noitems": "No recent items",
|
||||||
"addon.block_recentlyaccesseditems.pluginname": "Recently accessed items",
|
"addon.block_recentlyaccesseditems.pluginname": "Recently accessed items",
|
||||||
|
"addon.block_selfcompletion.pluginname": "Self completion",
|
||||||
"addon.block_sitemainmenu.pluginname": "Main menu",
|
"addon.block_sitemainmenu.pluginname": "Main menu",
|
||||||
"addon.block_starredcourses.nocourses": "No starred courses",
|
"addon.block_starredcourses.nocourses": "No starred courses",
|
||||||
"addon.block_starredcourses.pluginname": "Starred courses",
|
"addon.block_starredcourses.pluginname": "Starred courses",
|
||||||
|
@ -1233,6 +1240,7 @@
|
||||||
"core.answered": "Answered",
|
"core.answered": "Answered",
|
||||||
"core.areyousure": "Are you sure?",
|
"core.areyousure": "Are you sure?",
|
||||||
"core.back": "Back",
|
"core.back": "Back",
|
||||||
|
"core.block.blocks": "Blocks",
|
||||||
"core.cancel": "Cancel",
|
"core.cancel": "Cancel",
|
||||||
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 2.4 or later.",
|
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 2.4 or later.",
|
||||||
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
|
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CoreBlockDelegate } from './providers/delegate';
|
import { CoreBlockDelegate } from './providers/delegate';
|
||||||
import { CoreBlockDefaultHandler } from './providers/default-block-handler';
|
import { CoreBlockDefaultHandler } from './providers/default-block-handler';
|
||||||
|
import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delegate';
|
||||||
|
import { CoreBlockCourseBlocksCourseOptionHandler } from './providers/course-option-handler';
|
||||||
|
import { CoreBlockComponentsModule } from './components/components.module';
|
||||||
|
|
||||||
// List of providers (without handlers).
|
// List of providers (without handlers).
|
||||||
export const CORE_BLOCK_PROVIDERS: any[] = [
|
export const CORE_BLOCK_PROVIDERS: any[] = [
|
||||||
|
@ -24,11 +27,18 @@ export const CORE_BLOCK_PROVIDERS: any[] = [
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [],
|
declarations: [],
|
||||||
imports: [
|
imports: [
|
||||||
|
CoreBlockComponentsModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
CoreBlockDelegate,
|
CoreBlockDelegate,
|
||||||
CoreBlockDefaultHandler
|
CoreBlockDefaultHandler,
|
||||||
|
CoreBlockCourseBlocksCourseOptionHandler
|
||||||
],
|
],
|
||||||
exports: []
|
exports: []
|
||||||
})
|
})
|
||||||
export class CoreBlockModule {}
|
export class CoreBlockModule {
|
||||||
|
constructor(courseOptionHandler: CoreBlockCourseBlocksCourseOptionHandler,
|
||||||
|
courseOptionsDelegate: CoreCourseOptionsDelegate) {
|
||||||
|
courseOptionsDelegate.registerHandler(courseOptionHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Injector, OnInit } from '@angular/core';
|
import { Injector, OnInit, Input } from '@angular/core';
|
||||||
import { CoreLoggerProvider } from '@providers/logger';
|
import { CoreLoggerProvider } from '@providers/logger';
|
||||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
|
|
||||||
|
@ -20,6 +20,13 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
* Template class to easily create components for blocks.
|
* Template class to easily create components for blocks.
|
||||||
*/
|
*/
|
||||||
export class CoreBlockBaseComponent implements OnInit {
|
export class CoreBlockBaseComponent implements OnInit {
|
||||||
|
@Input() title: string; // The block title.
|
||||||
|
@Input() block: any; // The block to render.
|
||||||
|
@Input() contextLevel: string; // The context where the block will be used.
|
||||||
|
@Input() instanceId: number; // The instance ID associated with the context level.
|
||||||
|
@Input() link: string; // Link to go when clicked.
|
||||||
|
@Input() linkParams: string; // Link params to go when clicked.
|
||||||
|
|
||||||
loaded: boolean; // If the component has been loaded.
|
loaded: boolean; // If the component has been loaded.
|
||||||
protected fetchContentDefaultError: string; // Default error to show when loading contents.
|
protected fetchContentDefaultError: string; // Default error to show when loading contents.
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ export class CoreBlockBaseHandler implements CoreBlockHandler {
|
||||||
* @param {number} instanceId The instance ID associated with the context level.
|
* @param {number} instanceId The instance ID associated with the context level.
|
||||||
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
|
||||||
*/
|
*/
|
||||||
getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
|
||||||
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
|
||||||
|
|
||||||
// To be overridden.
|
// To be overridden.
|
||||||
|
|
|
@ -33,7 +33,6 @@ export class CoreBlockComponent implements OnInit, OnDestroy {
|
||||||
@Input() instanceId: number; // The instance ID associated with the context level.
|
@Input() instanceId: number; // The instance ID associated with the context level.
|
||||||
@Input() extraData: any; // Any extra data to be passed to the block.
|
@Input() extraData: any; // Any extra data to be passed to the block.
|
||||||
|
|
||||||
title: string; // The title of the block.
|
|
||||||
componentClass: any; // The class of the component to render.
|
componentClass: any; // The class of the component to render.
|
||||||
data: any = {}; // Data to pass to the component.
|
data: any = {}; // Data to pass to the component.
|
||||||
class: string; // CSS class to apply to the block.
|
class: string; // CSS class to apply to the block.
|
||||||
|
@ -80,15 +79,17 @@ export class CoreBlockComponent implements OnInit, OnDestroy {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.title = data.title;
|
|
||||||
this.class = data.class;
|
this.class = data.class;
|
||||||
this.componentClass = data.component;
|
this.componentClass = data.component;
|
||||||
|
|
||||||
// Set up the data needed by the block component.
|
// Set up the data needed by the block component.
|
||||||
this.data = Object.assign({
|
this.data = Object.assign({
|
||||||
|
title: data.title,
|
||||||
block: this.block,
|
block: this.block,
|
||||||
contextLevel: this.contextLevel,
|
contextLevel: this.contextLevel,
|
||||||
instanceId: this.instanceId,
|
instanceId: this.instanceId,
|
||||||
|
link: data.link || null,
|
||||||
|
linkParams: data.linkParams || null,
|
||||||
}, this.extraData || {}, data.componentData || {});
|
}, this.extraData || {}, data.componentData || {});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
|
|
|
@ -16,23 +16,35 @@ import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { IonicModule } from 'ionic-angular';
|
import { IonicModule } from 'ionic-angular';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CoreDirectivesModule } from '@directives/directives.module';
|
||||||
import { CoreBlockComponent } from './block/block';
|
import { CoreBlockComponent } from './block/block';
|
||||||
|
import { CoreBlockOnlyTitleComponent } from './only-title-block/only-title-block';
|
||||||
|
import { CoreBlockCourseBlocksComponent } from './course-blocks/course-blocks';
|
||||||
import { CoreComponentsModule } from '@components/components.module';
|
import { CoreComponentsModule } from '@components/components.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
CoreBlockComponent
|
CoreBlockComponent,
|
||||||
|
CoreBlockOnlyTitleComponent,
|
||||||
|
CoreBlockCourseBlocksComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
IonicModule,
|
IonicModule,
|
||||||
|
CoreDirectivesModule,
|
||||||
TranslateModule.forChild(),
|
TranslateModule.forChild(),
|
||||||
CoreComponentsModule
|
CoreComponentsModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
CoreBlockComponent
|
CoreBlockComponent,
|
||||||
|
CoreBlockOnlyTitleComponent,
|
||||||
|
CoreBlockCourseBlocksComponent
|
||||||
|
],
|
||||||
|
entryComponents: [
|
||||||
|
CoreBlockOnlyTitleComponent,
|
||||||
|
CoreBlockCourseBlocksComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class CoreBlockComponentsModule {}
|
export class CoreBlockComponentsModule {}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<ion-content>
|
||||||
|
<ion-refresher [enabled]="dataLoaded" (ionRefresh)="doRefresh($event)">
|
||||||
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
|
</ion-refresher>
|
||||||
|
<core-loading [hideUntil]="dataLoaded" class="core-loading-center">
|
||||||
|
<ion-list *ngIf="hasSupportedBlock">
|
||||||
|
<!-- Course blocks. -->
|
||||||
|
<ng-container *ngFor="let block of blocks">
|
||||||
|
<core-block [block]="block" contextLevel="course" [instanceId]="courseId"></core-block>
|
||||||
|
</ng-container>
|
||||||
|
</ion-list>
|
||||||
|
|
||||||
|
<core-empty-box *ngIf="!hasSupportedBlock" icon="qr-scanner" [message]="'core.course.nocontentavailable' | translate"></core-empty-box>
|
||||||
|
</core-loading>
|
||||||
|
</ion-content>
|
|
@ -0,0 +1,100 @@
|
||||||
|
// (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, ViewChildren, Input, OnInit, QueryList } from '@angular/core';
|
||||||
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||||
|
import { CoreBlockComponent } from '../block/block';
|
||||||
|
import { CoreBlockDelegate } from '../../providers/delegate';
|
||||||
|
import { CoreCourseProvider } from '@core/course/providers/course';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component that displays the list of course blocks.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'core-block-course-blocks',
|
||||||
|
templateUrl: 'core-block-course-blocks.html',
|
||||||
|
})
|
||||||
|
export class CoreBlockCourseBlocksComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() courseId: number;
|
||||||
|
|
||||||
|
@ViewChildren(CoreBlockComponent) blocksComponents: QueryList<CoreBlockComponent>;
|
||||||
|
|
||||||
|
dataLoaded = false;
|
||||||
|
hasContent: boolean;
|
||||||
|
hasSupportedBlock: boolean;
|
||||||
|
blocks = [];
|
||||||
|
|
||||||
|
constructor(private domUtils: CoreDomUtilsProvider, private courseProvider: CoreCourseProvider,
|
||||||
|
private blockDelegate: CoreBlockDelegate) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component being initialized.
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.loadContent().finally(() => {
|
||||||
|
this.dataLoaded = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh the data.
|
||||||
|
*
|
||||||
|
* @param {any} refresher Refresher.
|
||||||
|
*/
|
||||||
|
doRefresh(refresher: any): void {
|
||||||
|
const promises = [];
|
||||||
|
|
||||||
|
if (this.courseProvider.canGetCourseBlocks()) {
|
||||||
|
promises.push(this.courseProvider.invalidateCourseBlocks(this.courseId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invalidate the blocks.
|
||||||
|
this.blocksComponents.forEach((blockComponent) => {
|
||||||
|
promises.push(blockComponent.invalidate().catch(() => {
|
||||||
|
// Ignore errors.
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
Promise.all(promises).finally(() => {
|
||||||
|
this.loadContent().finally(() => {
|
||||||
|
refresher.complete();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience function to fetch the data.
|
||||||
|
*
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
|
*/
|
||||||
|
protected loadContent(): Promise<any> {
|
||||||
|
// Get site home blocks.
|
||||||
|
const canGetBlocks = this.courseProvider.canGetCourseBlocks(),
|
||||||
|
promise = canGetBlocks ? this.courseProvider.getCourseBlocks(this.courseId) : Promise.reject(null);
|
||||||
|
|
||||||
|
return promise.then((blocks) => {
|
||||||
|
this.blocks = blocks;
|
||||||
|
this.hasSupportedBlock = this.blockDelegate.hasSupportedBlock(blocks);
|
||||||
|
|
||||||
|
}).catch((error) => {
|
||||||
|
if (canGetBlocks) {
|
||||||
|
this.domUtils.showErrorModal(error);
|
||||||
|
}
|
||||||
|
this.blocks = [];
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
<ion-item-divider text-wrap detail-push (click)="gotoBlock($event)">
|
||||||
|
<h2>{{ title | translate }}</h2>
|
||||||
|
</ion-item-divider>
|
|
@ -0,0 +1,50 @@
|
||||||
|
// (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 { Injector, OnInit, Component } from '@angular/core';
|
||||||
|
import { CoreBlockBaseComponent } from '../../classes/base-block-component';
|
||||||
|
import { CoreLoginHelperProvider } from '@core/login/providers/helper';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component to render blocks with only a title and link.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'core-block-only-title',
|
||||||
|
templateUrl: 'core-block-only-title.html'
|
||||||
|
})
|
||||||
|
export class CoreBlockOnlyTitleComponent extends CoreBlockBaseComponent implements OnInit {
|
||||||
|
|
||||||
|
protected loginHelper: CoreLoginHelperProvider;
|
||||||
|
|
||||||
|
constructor(injector: Injector) {
|
||||||
|
super(injector, 'CoreBlockOnlyTitleComponent');
|
||||||
|
this.loginHelper = injector.get(CoreLoginHelperProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component being initialized.
|
||||||
|
*/
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
|
||||||
|
this.fetchContentDefaultError = 'Error getting ' + this.block.contents.title + ' data.';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Go to the block page.
|
||||||
|
*/
|
||||||
|
gotoBlock(): void {
|
||||||
|
this.loginHelper.redirect(this.link, this.linkParams);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"blocks": "Blocks"
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
// (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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { CoreCourseOptionsHandler, CoreCourseOptionsHandlerData } from '@core/course/providers/options-delegate';
|
||||||
|
import { CoreCourseProvider } from '@core/course/providers/course';
|
||||||
|
import { CoreBlockCourseBlocksComponent } from '../components/course-blocks/course-blocks';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Course nav handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class CoreBlockCourseBlocksCourseOptionHandler implements CoreCourseOptionsHandler {
|
||||||
|
name = 'CoreCourseBlocks';
|
||||||
|
priority = 700;
|
||||||
|
|
||||||
|
constructor(private courseProvider: CoreCourseProvider) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should invalidate the data to determine if the handler is enabled for a certain course.
|
||||||
|
*
|
||||||
|
* @param {number} courseId The course ID.
|
||||||
|
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
|
||||||
|
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
|
*/
|
||||||
|
invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise<any> {
|
||||||
|
return this.courseProvider.invalidateCourseBlocks(courseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the handler is enabled on a site level.
|
||||||
|
*
|
||||||
|
* @return {boolean} Whether or not the handler is enabled on a site level.
|
||||||
|
*/
|
||||||
|
isEnabled(): boolean | Promise<boolean> {
|
||||||
|
return this.courseProvider.canGetCourseBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not the handler is enabled for a certain course.
|
||||||
|
*
|
||||||
|
* @param {number} courseId The course ID.
|
||||||
|
* @param {any} accessData Access type and data. Default, guest, ...
|
||||||
|
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
|
||||||
|
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
|
||||||
|
* @return {boolean|Promise<boolean>} True or promise resolved with true if enabled.
|
||||||
|
*/
|
||||||
|
isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data needed to render the handler.
|
||||||
|
*
|
||||||
|
* @param {Injector} injector Injector.
|
||||||
|
* @param {number} courseId The course ID.
|
||||||
|
* @return {CoreCourseOptionsHandlerData|Promise<CoreCourseOptionsHandlerData>} Data or promise resolved with the data.
|
||||||
|
*/
|
||||||
|
getDisplayData(injector: Injector, courseId: number): CoreCourseOptionsHandlerData | Promise<CoreCourseOptionsHandlerData> {
|
||||||
|
return {
|
||||||
|
title: 'core.block.blocks',
|
||||||
|
class: 'core-course-blocks-handler',
|
||||||
|
component: CoreBlockCourseBlocksComponent
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline.
|
||||||
|
*
|
||||||
|
* @param {any} course The course.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
|
*/
|
||||||
|
prefetch(course: any): Promise<any> {
|
||||||
|
return this.courseProvider.getCourseBlocks(course.id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -73,6 +73,18 @@ export interface CoreBlockHandlerData {
|
||||||
* @type {any}
|
* @type {any}
|
||||||
*/
|
*/
|
||||||
componentData?: any;
|
componentData?: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link to go when showing only title.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
link?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Params of the link.
|
||||||
|
* @type {[type]}
|
||||||
|
*/
|
||||||
|
linkParams?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +139,8 @@ export class CoreBlockDelegate extends CoreDelegate {
|
||||||
* @return {Promise<CoreBlockHandlerData>} Promise resolved with the display data.
|
* @return {Promise<CoreBlockHandlerData>} Promise resolved with the display data.
|
||||||
*/
|
*/
|
||||||
getBlockDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number): Promise<CoreBlockHandlerData> {
|
getBlockDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number): Promise<CoreBlockHandlerData> {
|
||||||
return Promise.resolve(this.executeFunctionOnEnabled(block.name, 'getDisplayData', [injector, block]));
|
return Promise.resolve(this.executeFunctionOnEnabled(block.name, 'getDisplayData',
|
||||||
|
[injector, block, contextLevel, instanceId]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue