Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-local_learning_analytics
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LAIXMO
moodle-local_learning_analytics
Commits
8d16723e
You need to sign in or sign up before continuing.
Commit
8d16723e
authored
4 years ago
by
Thorben Laprell
Browse files
Options
Downloads
Patches
Plain Diff
heatmap_start_on_week_start
parent
9a3d8246
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
reports/weekheatmap/classes/query_helper.php
+4
-2
4 additions, 2 deletions
reports/weekheatmap/classes/query_helper.php
reports/weekheatmap/lareport_weekheatmap.php
+9
-2
9 additions, 2 deletions
reports/weekheatmap/lareport_weekheatmap.php
with
13 additions
and
4 deletions
reports/weekheatmap/classes/query_helper.php
+
4
−
2
View file @
8d16723e
...
@@ -33,7 +33,7 @@ use context_course;
...
@@ -33,7 +33,7 @@ use context_course;
class
query_helper
{
class
query_helper
{
public
static
function
query_heatmap
(
int
$courseid
):
array
{
public
static
function
query_heatmap
(
int
$courseid
,
int
$startOfWeek
):
array
{
global
$DB
;
global
$DB
;
$course
=
get_course
(
$courseid
);
$course
=
get_course
(
$courseid
);
...
@@ -41,6 +41,8 @@ class query_helper {
...
@@ -41,6 +41,8 @@ class query_helper {
$startdate
->
setTimestamp
(
$course
->
startdate
);
$startdate
->
setTimestamp
(
$course
->
startdate
);
$startdate
->
modify
(
'Monday this week'
);
// Get start of week.
$startdate
->
modify
(
'Monday this week'
);
// Get start of week.
$mondaytimestamp
=
$startdate
->
getTimestamp
();
$mondaytimestamp
=
$startdate
->
getTimestamp
();
$calendarTimestamp
=
$mondaytimestamp
+
(
86400
*
(
$startOfWeek
-
1
));
// TODO Implement Daylight saving offeset
// TODO Implement Daylight saving offeset
// This does not work very well if daylight saving comes into play, then all old
// This does not work very well if daylight saving comes into play, then all old
// dates will be shifted by 1 hour...
// dates will be shifted by 1 hour...
...
@@ -56,6 +58,6 @@ class query_helper {
...
@@ -56,6 +58,6 @@ class query_helper {
ORDER BY heatpoint
ORDER BY heatpoint
SQL;
SQL;
return
$DB
->
get_records_sql
(
$query
,
[
$
mo
nda
yt
imestamp
,
$courseid
]);
return
$DB
->
get_records_sql
(
$query
,
[
$
cale
nda
rT
imestamp
,
$courseid
]);
}
}
}
}
This diff is collapsed.
Click to expand it.
reports/weekheatmap/lareport_weekheatmap.php
+
9
−
2
View file @
8d16723e
...
@@ -31,6 +31,8 @@ use lareport_weekheatmap\query_helper;
...
@@ -31,6 +31,8 @@ use lareport_weekheatmap\query_helper;
use
local_learning_analytics
\router
;
use
local_learning_analytics
\router
;
use
local_learning_analytics
\settings
;
use
local_learning_analytics
\settings
;
require_once
(
'../../calendar/lib.php'
);
class
lareport_weekheatmap
extends
report_base
{
class
lareport_weekheatmap
extends
report_base
{
public
function
run
(
array
$params
):
array
{
public
function
run
(
array
$params
):
array
{
...
@@ -43,7 +45,12 @@ class lareport_weekheatmap extends report_base {
...
@@ -43,7 +45,12 @@ class lareport_weekheatmap extends report_base {
$xstrs
=
[];
$xstrs
=
[];
$texts
=
[];
$texts
=
[];
$days
=
array
(
'sunday'
,
'saturday'
,
'friday'
,
'thursday'
,
'wednesday'
,
'tuesday'
,
'monday'
);
$startOfWeek
=
calendar_get_starting_weekday
();
$days
=
array
(
'saturday'
,
'friday'
,
'thursday'
,
'wednesday'
,
'tuesday'
,
'monday'
,
'sunday'
);
for
(
$i
=
0
;
$i
<
$startOfWeek
;
$i
++
)
{
$days
=
array
(
$days
[
6
],
$days
[
0
],
$days
[
1
],
$days
[
2
],
$days
[
3
],
$days
[
4
],
$days
[
5
]);
}
$ystrs
=
[];
$ystrs
=
[];
foreach
(
$days
as
$day
)
{
foreach
(
$days
as
$day
)
{
$ystrs
[]
=
get_string
(
$day
,
'calendar'
);
$ystrs
[]
=
get_string
(
$day
,
'calendar'
);
...
@@ -57,7 +64,7 @@ class lareport_weekheatmap extends report_base {
...
@@ -57,7 +64,7 @@ class lareport_weekheatmap extends report_base {
$maxvalue
=
0
;
$maxvalue
=
0
;
$hitsstr
=
get_string
(
'hits'
,
'lareport_weekheatmap'
);
$hitsstr
=
get_string
(
'hits'
,
'lareport_weekheatmap'
);
$heatpoints
=
query_helper
::
query_heatmap
(
$courseid
);
$heatpoints
=
query_helper
::
query_heatmap
(
$courseid
,
$startOfWeek
);
for
(
$d
=
0
;
$d
<
7
;
$d
+=
1
)
{
for
(
$d
=
0
;
$d
<
7
;
$d
+=
1
)
{
// we need to start the plot at the bottom (sun -> sat -> fri -> ...)
// we need to start the plot at the bottom (sun -> sat -> fri -> ...)
$startpos
=
(
6
-
$d
)
*
24
;
$startpos
=
(
6
-
$d
)
*
24
;
...
...
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