This fork provides necessary functionality for an external timeclock terminal and some other modifications.
Simple work time clocking service built on Yii 2 framework.
-
Install TimeClock using Composer:
git clone https://github.com/niclasku/timeclock cd timeclock composer install
-
Prepare virtual host pointing to
/public
directory. -
Prepare configuration for DB of your choice. Place it in
/src/config/db.php
. -
Modify the
/src/config/web.php
file to change:timeZone
(defaultUTC
)language
(defaulten-US
;pl
andde
translations are provided in/src/messages/
folder)components > mailer
configuration to actually send emails (needed for password reset)components > formatter
configuration of date and time formatsparams > company
(defaultCompany Name
; displayed in footer and other layout places)params > email
(default[email protected]
; used as the email sender address for emails)params > allowedDomains
(default['@company.com']
; array with email domains allowed for registration)params > employeeSessionEdit
(defaulttrue
; allows employees to edit own sessions)params > employeeSessionDelete
(defaulttrue
; allows employees to delete own sessions)params > employeeOffTimeEdit
(defaulttrue
; allows employees to edit own off-times)params > employeeOffTimeDelete
(defaulttrue
; allows employees to delete own off-times)params > employeeOffTimeApprovedDelete
(defaulttrue
; allows employees to delete own approved off-times)params > adminSessionAdd
(defaultfalse
; allows admins to add sessions)params > adminSessionEdit
(defaultfalse
; allows admins to edit every session)params > adminSessionDelete
(defaultfalse
; allows admins to delete every session)params > adminOffTimeAdd
(defaultfalse
; allows admins to add off-time)params > adminOffTimeEdit
(defaultfalse
; allows admins to edit every off-time)params > adminOffTimeDelete
(defaultfalse
; allows admins to delete every off-time)params > showAllVacations
(defaultfalse
; shows off-times of the whole year first)params > approvableOffTime
(default[Off::TYPE_SICK, Off::TYPE_VACATION]
; defines which off-time types need an approval)params > weekendDays
(default[7]
; defines which days of the week are actually weekend for employees)params > uploadPath
(defaultdirname(__DIR__) . '/../uploads/'
; path to photo upload folder)
-
Change
/public/index.php
file to setYII_DEBUG
mode tofalse
andYII_ENV
environment toprod
. -
Apply migrations by running in console
php yii migrate
. -
Start webserver and register first account.
-
If you want to make an account to be admin run in console
php yii admin/set ID
whereID
is DB identifier of account to be set (usually first one is1
). -
If you want to use an external timeclock terminal you can get a special API token via
php yii terminal/add
.
- Registering account requires its email address to be in one of the provided domains. If you want to change this behavior
you must prepare your own code. Current implementation is at
/src/models/RegisterForm.php
and/src/views/site/register.php
. - Session can be started at any time but it must be ended not overlapping any other ended session.
- There can be many sessions in one day.
- Session can not be longer than midnight.
- Not ended sessions not count for work hours.
- Off-time must not overlap any other off-time period.
- Holidays are automatically fetched from
https://www.kalendarzswiat.pl
which is Polish holiday list. If you want to use something different you must prepare your own code for this. Current implementation is at/src/models/Holiday.php
.
- account registration
- password reset
- profile update
- themes
- signing in with login or PIN
- session time with note
- off-time with note
- session and off-time history
- calendar
- holidays
- admin section
- REST API
- Bootstrap 4 layout
- vacations requests
- projects
- sessions time CSV download for admins
- deactivating accounts for admins
- Update all the project files to match the repository.
- Apply migrations by running in console
php yii migrate
.
Read TimeClock Wiki first.
For anything related to Yii go to the Yii 2 Guide.
I really don't want to point obvious links with solutions from there.
You can use this project in whatever way you like as long as you mention where did you get it from.