Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
StudIP-SimpleBBB-Connector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Uni Vechta
Plugins
StudIP-SimpleBBB-Connector
Commits
154a6429
Commit
154a6429
authored
4 years ago
by
David Siegfried
Browse files
Options
Downloads
Patches
Plain Diff
add stats
parent
a49684af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
classes/GreenlightConnection.php
+12
-1
12 additions, 1 deletion
classes/GreenlightConnection.php
controllers/statistics.php
+21
-0
21 additions, 0 deletions
controllers/statistics.php
models/Metric.php
+64
-7
64 additions, 7 deletions
models/Metric.php
plugin.manifest
+1
-1
1 addition, 1 deletion
plugin.manifest
with
98 additions
and
9 deletions
classes/GreenlightConnection.php
+
12
−
1
View file @
154a6429
...
...
@@ -24,7 +24,7 @@ class GreenlightConnection
$config
=
Config
::
Get
()
->
GREENLIGHT_CONNECTION
;
if
(
!
$config
)
{
throw
new
Exception
(
'
POS c
onnection is not configured'
);
throw
new
Exception
(
'
Greenlight-C
onnection is not configured'
);
}
return
self
::
$instance
=
new
self
(
...
...
@@ -69,4 +69,15 @@ class GreenlightConnection
$stm
->
execute
();
return
$stm
->
fetchColumn
();
}
public
function
getMeetingData
(
$meeting_id
)
{
$sql
=
"SELECT * FROM rooms as r
JOIN users as u ON u.id = r.user_id
WHERE r.bbb_id = :meeting_id"
;
$stm
=
$this
->
connection
->
prepare
(
$sql
);
$stm
->
execute
([
':meeting_id'
=>
$meeting_id
]);
return
$stm
->
fetch
(
PDO
::
FETCH_ASSOC
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
controllers/statistics.php
+
21
−
0
View file @
154a6429
...
...
@@ -13,6 +13,8 @@ class StatisticsController extends Controller
{
parent
::
before_filter
(
$action
,
$args
);
Metric
::
collect
();
$this
->
buildSidebar
();
}
public
function
index_action
()
...
...
@@ -30,6 +32,14 @@ class StatisticsController extends Controller
$this
->
biggest_meetings
=
Metric
::
getStatistics
(
'current_month'
,
'all'
,
10
);
}
public
function
export_csv_action
()
{
$results
=
Metric
::
getExport
();
$this
->
render_csv
(
$results
,
'BigBlueButtonStatistik_'
.
time
()
.
'.csv'
);
}
public
function
buildDataSet
(
$label
,
$data
,
$border_color
,
$background_color
)
{
...
...
@@ -62,4 +72,15 @@ class StatisticsController extends Controller
'brown'
=>
'rgba(255, 159, 64, 1)'
];
return
$colors
[
$color
];
}
private
function
buildSidebar
()
{
$exports
=
new
ExportWidget
();
$exports
->
addLink
(
_
(
'Als CSV herunterladen'
),
$this
->
url_for
(
'statistic/export_csv'
),
Icon
::
create
(
'file-excel'
)
);
Sidebar
::
Get
()
->
addWidget
(
$exports
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
models/Metric.php
+
64
−
7
View file @
154a6429
...
...
@@ -8,6 +8,7 @@ namespace Vec\BBB;
use
SimpleORMap
;
use
DateTime
;
use
PluginEngine
;
use
DBManager
;
use
SimpleORMapCollection
;
...
...
@@ -21,7 +22,7 @@ class Metric extends SimpleORMap
$config
[
'belongs_to'
][
'server'
]
=
[
'class_name'
=>
'Vec\\BBB\\Server'
,
'
assoc_
foreign_key'
=>
'server_id'
,
'foreign_key'
=>
'server_id'
,
];
parent
::
configure
(
$config
);
}
...
...
@@ -31,6 +32,62 @@ class Metric extends SimpleORMap
return
DBManager
::
get
()
->
fetchColumn
(
'SELECT DISTINCT YEAR(`start_time`) FROM `bigbluebutton_metrics`'
);
}
public
static
function
getExport
()
{
$metrics
=
self
::
findBySQL
(
'1 ORDER BY `mkdate`'
);
$results
=
[];
if
(
!
empty
(
$metrics
))
{
$results
[]
=
[
'Server'
,
'Meeting-id'
,
'Meeting-Name'
,
'Anzahl TeilnehmerInnen'
,
'Anzahl Webcams'
,
'Anzahl ZuhörerInnen'
,
'Anzahl Audio'
,
'BreakOutRaum'
,
'Start-Zeit'
,
'End-Zeit'
,
'Username'
,
];
$meeting_plugin_installed
=
PluginEngine
::
getPlugin
(
'MeetingPlugin'
)
!==
null
;
foreach
(
$metrics
as
$metric
)
{
$result
=
[];
$result
[
'server'
]
=
$metric
->
server
->
url
;
$result
[
'meeting_id'
]
=
$metric
->
meeting_id
;
$result
[
'meeting_name'
]
=
$metric
->
meeting_name
;
$result
[
'participant_count'
]
=
$metric
->
participant_count
;
$result
[
'video_count'
]
=
$metric
->
video_count
;
$result
[
'listener_count'
]
=
$metric
->
listener_count
;
$result
[
'voice_participant_count'
]
=
$metric
->
voice_participant_count
;
$result
[
'is_break_out'
]
=
$metric
->
is_break_out
;
$result
[
'start_time'
]
=
$metric
->
start_time
;
$result
[
'end_time'
]
=
$metric
->
end_time
;
$result
[
'email'
]
=
""
;
if
(
$meeting_plugin_installed
)
{
$username
=
DBManager
::
get
()
->
fetchColumn
(
"SELECT a.username FROM auth_user_md5 a
JOIN vc_meetings vc ON vc.user_id = a.user_id
WHERE vc.remote_id = ?"
,
[
$metric
->
meeting_id
]
);
if
(
$username
)
{
$result
[
'email'
]
=
$username
;
}
}
else
{
$meeting_data
=
GreenlightConnection
::
Get
()
->
getMeetingData
(
$metric
->
meeting_id
);
if
(
$meeting_data
)
{
$result
[
'email'
]
=
$meeting_data
[
'username'
];
}
}
$results
[]
=
$result
;
}
return
$results
;
}
return
$results
;
}
public
static
function
collect
()
{
$servers
=
SimpleORMapCollection
::
createFromArray
(
...
...
@@ -98,9 +155,9 @@ class Metric extends SimpleORMap
return
$msgs
;
}
public
static
function
getStatistics
(
$filter
=
''
,
$mode
=
'sum'
,
$limit
=
null
)
public
static
function
getStatistics
(
$filter
=
''
,
$mode
=
'sum'
,
$limit
=
null
)
{
if
(
$mode
===
'sum'
)
{
if
(
$mode
===
'sum'
)
{
$sql
=
'SELECT
COUNT(*) as "Anzahl Konferenzen",
SUM(participant_count) as "Anzahl TeilnehmerInnen",
...
...
@@ -117,7 +174,7 @@ class Metric extends SimpleORMap
$attributes
=
[];
if
(
$filter
!==
''
)
{
$result
=
self
::
getFilter
(
$filter
);
$result
=
self
::
getFilter
(
$filter
);
[
$begin
,
$end
]
=
$result
;
}
...
...
@@ -128,11 +185,11 @@ class Metric extends SimpleORMap
}
$sql
.
=
' ORDER BY `participant_count` DESC, `meeting_name`'
;
if
(
$limit
!==
null
)
{
if
(
$limit
!==
null
)
{
$sql
.
=
" LIMIT
{
$limit
}
"
;
}
if
(
$mode
!==
'sum'
)
{
return
\DBManager
::
get
()
->
fetchAll
(
$sql
,
$attributes
);
if
(
$mode
!==
'sum'
)
{
return
\DBManager
::
get
()
->
fetchAll
(
$sql
,
$attributes
);
}
return
\DBManager
::
get
()
->
fetchOne
(
$sql
,
$attributes
);
}
...
...
This diff is collapsed.
Click to expand it.
plugin.manifest
+
1
−
1
View file @
154a6429
pluginname=SimpleBBB-Connector
pluginclassname=SimpleBBBConnector
origin=Vec
version=1.2.
0
version=1.2.
1
studipMinVersion=4.2
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment