A docker image providing a sync-server for TaskTimeTerminate
- Server Task
- Add Tasks directly on the server
- Statistics
- Show stats one the server
- Show charts made with ChartJS
- Account Management
- Each user gets an account, also called group
- This account can have multiple devices
- Device Management
- Add, edit and delete devices
This is a docker project, so it you will need docker to run it. It is recommended to use the docker-compose.yml provided.
- Copy the docker-compose.yml
- Make sure to bind to a free port
- Change the volume to a location wich is regularly made a backup from. (Inside the container all data is stored in
/php-code/data/
) - Edit environment variables
DEVMODE
should always befalse
(enables error messages)CONF_DOMAIN
the url where the service will be hosted (what the webbrowser sees)CONF_TIMEZONE
a PHP timezone string, matching the location of the server users (see https://www.php.net/manual/en/timezones.php for list of supported ones)ADMIN_ACCOUNT
username/ groupname of the initial account (will be created on first container startup; will be an admin user)ADMIN_PASSWORD
password for the initial account
- Run the container and log into the Webinterface
One may delete
ADMIN_ACCOUNT
andADMIN_PASSWORD
after the account is created (and also change the password), IfADMIN_ACCOUNT
is set and the account already exists, the system will overwrite the password withADMIN_PASSWORD
.
See https://github.com/KIMB-technologies/TaskTimeTerminate for more information about TTT.
- Log into the Webinterface and go to
Device Management
- Add a new device and remember its token.
- Run
ttt conf sync server
in your client - Type the URL of this installation, the account name/ group, the client token and the devices/ clients name.
- The client will import all recorded data to the installation and also update it with new completed task.
This repository contains a script to import data from other devices to the server and also a script that exports the data of all devices to a directory. The format used is the same as used in the local directory synchronisation.
So one may transfer the the data from an old client (not used anymore, used clients will automatically import their data when they are connected to the server for the first time) to the server.
Create the the device for which the data should be imported and remember its token. (The name of the device can only be set once via the Webinterface).
- Run
php ./imexport/import.php
- Type credentials of device when prompted
- Fill in path to the directory containing the devices data (e.g.
2020-04-01.json
,2020-04-03.json
, ...) - Change the timezone, if you want (see https://www.php.net/manual/en/timezones.php for list of supported zones)
- The data for the device will be available in the Webinterface (and through the API).
One may use any device of an account, but the device will only get data from other devices and no data from itself. (So create a new device for a full export!)
- Run
php ./imexport/export.php
- Type credentials of device when prompted
- Change the export directory if you want (it has to be any empty directory and it will be created if not exists).
- The data for all devices will show up the directory
It is possible to create custom graph-views for the stats view.
See an example e.g. Pie
When the user selects a graph and clicks on Display Graph the corresponding JS-file is loaded and the the function createGraph(combiData, plainData, singleDayData, canvas)
of this file will be executed. In a file like Pie
such function like createGraph(combiData, plainData, singleDayData, canvas)
can be defined.
Each function gets four parameters, three *Data
and one canvas
.
The parameter *Data
are arrays containing objects with datasets, they all represent the same current data selection of the user, but haven different formats.
combiData
[{"category":"Test","name":"My Task","duration":3600,"times":1,"days":["23.09", ...],"devices":["Server", ...]}, ...]
plainData
- This array may be very large and the system may not deliver all user selected datasets (when they become too much).
[{"name":"My Task","category":"Test","begin":1600866000,"end":1600869600,"duration":3600,"device":"Server"}, ...]
singleDayData
- Will be
false
if more than one day selected by user. [{"Begin":"15:00","Category":"Test","Name":"My Task","Time":" 1h 0m"}, ...]
- Will be
The object canvas
is a connector to the canvas on the page, where the chart should show up.
It can be directly used with new Chart(canvas, chartData)
.
The function must return the created Chart
object, cause the stats page need access to it.
So a typical wokflow will use data
to generate a object chartData
for ChartJS and
end with return new Chart(canvas, chartData);
.
For information how to create charts see https://www.chartjs.org/ (also jQuery is loaded in the DOM as $
).
All JS file creating charts (and containing exactly one createGraph
) have to be placed in the folder
/php-code/load/graphs/
inside the docker-container. Using docker-compose one might add
./charts/:/php-code/load/graphs/
to the volumes
section of the docker-compose.yml
and
add all file to ./charts/
.
All JS file should be named like this <GraphName>.js
. Of course it it recommended to
use only A-Za-z-9
for the GraphName
.