forked from CIT/Vmeda.Online
		
	MOBILE-3014 block: Add Upcoming events block feature
This commit is contained in:
		
							parent
							
								
									2ad5daec1c
								
							
						
					
					
						commit
						ea7050104f
					
				| @ -28,6 +28,7 @@ | |||||||
|   "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_calendarmonth.pluginname": "block_calendar_month", | ||||||
|  |   "addon.block_calendarupcoming.pluginname": "block_calendar_upcoming", | ||||||
|   "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
									
								
								src/addon/block/calendarupcoming/calendarupcoming.module.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/addon/block/calendarupcoming/calendarupcoming.module.ts
									
									
									
									
									
										Normal file
									
								
							| @ -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); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										3
									
								
								src/addon/block/calendarupcoming/lang/en.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/addon/block/calendarupcoming/lang/en.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | { | ||||||
|  |     "pluginname": " Upcoming events" | ||||||
|  | } | ||||||
							
								
								
									
										52
									
								
								src/addon/block/calendarupcoming/providers/block-handler.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/addon/block/calendarupcoming/providers/block-handler.ts
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||||
|  |         }; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -92,6 +92,7 @@ import { AddonUserProfileFieldModule } from '@addon/userprofilefield/userprofile | |||||||
| 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 { AddonBlockCalendarMonthModule } from '@addon/block/calendarmonth/calendarmonth.module'; | ||||||
|  | import { AddonBlockCalendarUpcomingModule } from '@addon/block/calendarupcoming/calendarupcoming.module'; | ||||||
| import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.module'; | import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.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'; | ||||||
| @ -215,6 +216,7 @@ export const CORE_PROVIDERS: any[] = [ | |||||||
|         AddonFilesModule, |         AddonFilesModule, | ||||||
|         AddonBlockActivityModulesModule, |         AddonBlockActivityModulesModule, | ||||||
|         AddonBlockCalendarMonthModule, |         AddonBlockCalendarMonthModule, | ||||||
|  |         AddonBlockCalendarUpcomingModule, | ||||||
|         AddonBlockMyOverviewModule, |         AddonBlockMyOverviewModule, | ||||||
|         AddonBlockSiteMainMenuModule, |         AddonBlockSiteMainMenuModule, | ||||||
|         AddonBlockTimelineModule, |         AddonBlockTimelineModule, | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ | |||||||
|     "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_calendarmonth.pluginname": "Calendar", | ||||||
|  |     "addon.block_calendarupcoming.pluginname": " Upcoming events", | ||||||
|     "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", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user