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
ffb12cca
Commit
ffb12cca
authored
4 years ago
by
David Siegfried
Browse files
Options
Downloads
Patches
Plain Diff
add more stats
parent
7a964a0c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
controllers/statistics.php
+40
-9
40 additions, 9 deletions
controllers/statistics.php
models/Metric.php
+8
-5
8 additions, 5 deletions
models/Metric.php
views/statistics/index.php
+2
-108
2 additions, 108 deletions
views/statistics/index.php
with
50 additions
and
122 deletions
controllers/statistics.php
+
40
−
9
View file @
ffb12cca
...
...
@@ -20,15 +20,46 @@ class StatisticsController extends Controller
Navigation
::
activateItem
(
'simplebbbconnector/statistics/index'
);
PageLayout
::
setTitle
(
_
(
'Statistik'
));
$current_month_complete
=
Metric
::
getStatistics
(
'current_month'
);
$current_week_complete
=
Metric
::
getStatistics
(
'current_week'
);
$last_week_complete
=
Metric
::
getStatistics
(
'last_week'
);
$today_complete
=
Metric
::
getStatistics
(
'today'
);
$data
=
[
'labels'
=>
array_keys
(
$current_month_complete
)];
$data
[
'datasets'
][]
=
$this
->
buildDataSet
(
strftime
(
'%B'
),
$current_month_complete
,
'red'
,
'redDark'
);
$data
[
'datasets'
][]
=
$this
->
buildDataSet
(
_
(
'Diese Woche'
),
Metric
::
getStatistics
(
'current_week'
),
'blue'
,
'blueDark'
);
$data
[
'datasets'
][]
=
$this
->
buildDataSet
(
_
(
'Letzte Woche'
),
Metric
::
getStatistics
(
'last_week'
),
'green'
,
'greenDark'
);
$data
[
'datasets'
][]
=
$this
->
buildDataSet
(
_
(
'Heute'
),
Metric
::
getStatistics
(
'today'
),
'yellow'
,
'yellowDark'
);
$data
[
'datasets'
][]
=
$this
->
buildDataSet
(
_
(
'Gestern'
),
Metric
::
getStatistics
(
'yesterday'
),
'purple'
,
'purpleDark'
);
$this
->
dataset
=
json_encode
(
$data
);
$this
->
biggest_meetings
=
Metric
::
getStatistics
(
'current_month'
,
'all'
,
10
);
}
public
function
buildDataSet
(
$label
,
$data
,
$border_color
,
$background_color
)
{
$set
=
[
'label'
=>
$label
,
'data'
=>
array_map
(
'intval'
,
array_values
(
$data
)),
'borderWidth'
=>
1
];
$this
->
labels
=
json_encode
(
array_keys
(
$current_month_complete
));
$this
->
current_month_complete
=
json_encode
(
array_map
(
'intval'
,
array_values
(
$current_month_complete
)));
$this
->
current_week_complete
=
json_encode
(
array_map
(
'intval'
,
array_values
(
$current_week_complete
)));
$this
->
last_week_complete
=
json_encode
(
array_map
(
'intval'
,
array_values
(
$last_week_complete
)));
$this
->
today_complete
=
json_encode
(
array_map
(
'intval'
,
array_values
(
$today_complete
)));
$this
->
biggest_meetings
=
Metric
::
getStatistics
(
'current_month'
,
'all'
,
10
);
for
(
$i
=
0
;
$i
<
count
(
$data
);
$i
++
)
{
$set
[
'borderColor'
][]
=
$this
->
getColor
(
$border_color
);
$set
[
'backgroundColor'
][]
=
$this
->
getColor
(
$background_color
);
}
return
$set
;
}
private
function
getColor
(
$color
)
{
$colors
=
[
'redDark'
=>
'rgba(255, 99, 132, 0.2)'
,
'red'
=>
'rgba(255, 99, 132, 1)'
,
'blueDark'
=>
'rgba(54, 162, 235, 0.2)'
,
'blue'
=>
'rgba(54, 162, 235, 1)'
,
'yellowDark'
=>
'rgba(255, 206, 86, 0.2)'
,
'yellow'
=>
'rgba(255, 206, 86, 1)'
,
'greenDark'
=>
'rgba(75, 192, 192, 0.2)'
,
'green'
=>
'rgba(75, 192, 192, 1)'
,
'purpleDark'
=>
'rgba(153, 102, 255, 0.2)'
,
'purple'
=>
'rgba(153, 102, 255, 1)'
,
'brownDark'
=>
'rgba(255, 159, 64, 0.2)'
,
'brown'
=>
'rgba(255, 159, 64, 1)'
];
return
$colors
[
$color
];
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
models/Metric.php
+
8
−
5
View file @
ffb12cca
...
...
@@ -144,10 +144,6 @@ class Metric extends SimpleORMap
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'first day of this month 00:00:00'
));
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'first day of next month 00:00:00'
));
}
if
(
$filter
===
'today'
)
{
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'today 00:00:00'
));
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'next day 00:00:00'
));
}
if
(
$filter
===
'current_week'
)
{
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'monday this week 00:00:00'
));
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'sunday this week 00:00:00'
));
...
...
@@ -156,7 +152,14 @@ class Metric extends SimpleORMap
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'monday last week 00:00:00'
));
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'sunday last week 00:00:00'
));
}
if
(
$filter
===
'today'
)
{
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'today 00:00:00'
));
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'next day 00:00:00'
));
}
if
(
$filter
===
'yesterday'
)
{
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'yesterday 00:00:00'
));
$result
[]
=
date
(
self
::
BBB_DATETIME_FORMAT
,
strtotime
(
'today 00:00:00'
));
}
return
$result
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
views/statistics/index.php
+
2
−
108
View file @
ffb12cca
<section
class=
"bbb-metrics"
>
<?
if
(
!
empty
(
$
current_month_compl
et
e
))
:
?>
<?
if
(
!
empty
(
$
datas
et
))
:
?>
<section
class=
"contentbox"
>
<header>
<h1>
<?=
sprintf
(
_
(
'Statistik für %s'
),
strftime
(
'%B'
))
?>
</h1>
...
...
@@ -8,115 +8,9 @@
<canvas
id=
"bar-chart"
style=
"width: 100%; height: 400px"
></canvas>
<script>
var
ctx
=
document
.
getElementById
(
'
bar-chart
'
).
getContext
(
'
2d
'
)
window
.
chartColors
=
{
redDark
:
'
rgba(255, 99, 132, 0.2)
'
,
red
:
'
rgba(255, 99, 132, 1)
'
,
blueDark
:
'
rgba(54, 162, 235, 0.2)
'
,
blue
:
'
rgba(54, 162, 235, 1)
'
,
yellowDark
:
'
rgba(255, 206, 86, 0.2)
'
,
yellow
:
'
rgba(255, 206, 86, 1)
'
,
greenDark
:
'
rgba(75, 192, 192, 0.2)
'
,
green
:
'
rgba(75, 192, 192, 1)
'
,
purpleDark
:
'
rgba(153, 102, 255, 0.2)
'
,
purple
:
'
rgba(153, 102, 255, 1)
'
,
brownDark
:
'
rgba(255, 159, 64, 0.2)
'
,
brown
:
'
rgba(255, 159, 64, 1)
'
};
var
myChart
=
new
Chart
(
ctx
,
{
type
:
'
bar
'
,
data
:
{
labels
:
<?=
$labels
?>
,
datasets
:
[{
label
:
'
#
<?=
strftime
(
'%B'
)
?>
'
,
data
:
<?=
$current_month_complete
?>
,
backgroundColor
:
[
window
.
chartColors
.
redDark
,
window
.
chartColors
.
redDark
,
window
.
chartColors
.
redDark
,
window
.
chartColors
.
redDark
,
window
.
chartColors
.
redDark
,
window
.
chartColors
.
redDark
,
window
.
chartColors
.
redDark
,
],
borderColor
:
[
window
.
chartColors
.
red
,
window
.
chartColors
.
red
,
window
.
chartColors
.
red
,
window
.
chartColors
.
red
,
window
.
chartColors
.
red
,
window
.
chartColors
.
red
,
window
.
chartColors
.
red
,
],
borderWidth
:
1
},
{
label
:
'
#
<?=
_
(
'Heute'
)
?>
'
,
data
:
<?=
$today_complete
?>
,
backgroundColor
:
[
window
.
chartColors
.
blueDark
,
window
.
chartColors
.
blueDark
,
window
.
chartColors
.
blueDark
,
window
.
chartColors
.
blueDark
,
window
.
chartColors
.
blueDark
,
window
.
chartColors
.
blueDark
,
window
.
chartColors
.
blueDark
,
],
borderColor
:
[
window
.
chartColors
.
blue
,
window
.
chartColors
.
blue
,
window
.
chartColors
.
blue
,
window
.
chartColors
.
blue
,
window
.
chartColors
.
blue
,
window
.
chartColors
.
blue
,
window
.
chartColors
.
blue
,
],
borderWidth
:
1
},
{
label
:
'
#
<?=
_
(
'Diese Woche'
)
?>
'
,
data
:
<?=
$current_week_complete
?>
,
backgroundColor
:
[
window
.
chartColors
.
greenDark
,
window
.
chartColors
.
greenDark
,
window
.
chartColors
.
greenDark
,
window
.
chartColors
.
greenDark
,
window
.
chartColors
.
greenDark
,
window
.
chartColors
.
greenDark
,
window
.
chartColors
.
greenDark
,
],
borderColor
:
[
window
.
chartColors
.
green
,
window
.
chartColors
.
green
,
window
.
chartColors
.
green
,
window
.
chartColors
.
green
,
window
.
chartColors
.
green
,
window
.
chartColors
.
green
,
window
.
chartColors
.
green
,
],
borderWidth
:
1
},
{
label
:
'
#
<?=
_
(
'Letzte Woche'
)
?>
'
,
data
:
<?=
$last_week_complete
?>
,
backgroundColor
:
[
window
.
chartColors
.
yellowDark
,
window
.
chartColors
.
yellowDark
,
window
.
chartColors
.
yellowDark
,
window
.
chartColors
.
yellowDark
,
window
.
chartColors
.
yellowDark
,
window
.
chartColors
.
yellowDark
,
window
.
chartColors
.
yellowDark
,
],
borderColor
:
[
window
.
chartColors
.
yellow
,
window
.
chartColors
.
yellow
,
window
.
chartColors
.
yellow
,
window
.
chartColors
.
yellow
,
window
.
chartColors
.
yellow
,
window
.
chartColors
.
yellow
,
window
.
chartColors
.
yellow
,
],
borderWidth
:
1
}
]
},
data
:
<?=
$dataset
?>
,
options
:
{
scales
:
{
yAxes
:
[{
...
...
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