MOBILE-3002 block: Add Online users block feature
parent
11eee9b8a8
commit
16d768d187
|
@ -43,6 +43,7 @@
|
||||||
"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_onlineusers.pluginname": "block_online_users",
|
||||||
"addon.block_privatefiles.pluginname": "block_private_files",
|
"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",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"pluginname": "Online users"
|
||||||
|
}
|
|
@ -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 { AddonBlockOnlineUsersHandler } from './providers/block-handler';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule,
|
||||||
|
TranslateModule.forChild()
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
AddonBlockOnlineUsersHandler
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AddonBlockOnlineUsersModule {
|
||||||
|
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockOnlineUsersHandler) {
|
||||||
|
blockDelegate.registerHandler(blockHandler);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
.addon-block-online-users core-block-pre-rendered .core-block-content {
|
||||||
|
.list {
|
||||||
|
@include margin-horizontal(0);
|
||||||
|
-webkit-padding-start: 0;
|
||||||
|
|
||||||
|
li.listentry {
|
||||||
|
clear: both;
|
||||||
|
list-style-type: none;
|
||||||
|
|
||||||
|
.user {
|
||||||
|
@include float(start);
|
||||||
|
position: relative;
|
||||||
|
padding-bottom: 16px;
|
||||||
|
|
||||||
|
.core-adapted-img-container {
|
||||||
|
display: inline;
|
||||||
|
@include margin-horizontal(0, 8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userpicture {
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.message {
|
||||||
|
@include float(end);
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uservisibility { // No support on the app.
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 { Injectable, Injector } from '@angular/core';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
|
||||||
|
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
|
||||||
|
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block handler.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class AddonBlockOnlineUsersHandler extends CoreBlockBaseHandler {
|
||||||
|
name = 'AddonBlockOnlineUsers';
|
||||||
|
blockName = 'online_users';
|
||||||
|
|
||||||
|
constructor(private translate: TranslateService) {
|
||||||
|
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: this.translate.instant('addon.block_onlineusers.pluginname'),
|
||||||
|
class: 'addon-block-online-users',
|
||||||
|
component: CoreBlockPreRenderedComponent
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -97,6 +97,7 @@ import { AddonBlockCommentsModule } from '@addon/block/comments/comments.module'
|
||||||
import { AddonBlockCompletionStatusModule } from '@addon/block/completionstatus/completionstatus.module';
|
import { AddonBlockCompletionStatusModule } from '@addon/block/completionstatus/completionstatus.module';
|
||||||
import { AddonBlockHtmlModule } from '@addon/block/html/html.module';
|
import { AddonBlockHtmlModule } from '@addon/block/html/html.module';
|
||||||
import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.module';
|
import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.module';
|
||||||
|
import { AddonBlockOnlineUsersModule } from '@addon/block/onlineusers/onlineusers.module';
|
||||||
import { AddonBlockLearningPlansModule } from '@addon/block/learningplans/learningplans.module';
|
import { AddonBlockLearningPlansModule } from '@addon/block/learningplans/learningplans.module';
|
||||||
import { AddonBlockPrivateFilesModule } from '@addon/block/privatefiles/privatefiles.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';
|
||||||
|
@ -228,6 +229,7 @@ export const CORE_PROVIDERS: any[] = [
|
||||||
AddonBlockHtmlModule,
|
AddonBlockHtmlModule,
|
||||||
AddonBlockLearningPlansModule,
|
AddonBlockLearningPlansModule,
|
||||||
AddonBlockMyOverviewModule,
|
AddonBlockMyOverviewModule,
|
||||||
|
AddonBlockOnlineUsersModule,
|
||||||
AddonBlockPrivateFilesModule,
|
AddonBlockPrivateFilesModule,
|
||||||
AddonBlockSiteMainMenuModule,
|
AddonBlockSiteMainMenuModule,
|
||||||
AddonBlockTimelineModule,
|
AddonBlockTimelineModule,
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
"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_onlineusers.pluginname": "Online users",
|
||||||
"addon.block_privatefiles.pluginname": "Private files",
|
"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",
|
||||||
|
|
Loading…
Reference in New Issue