Documentation

main

Represents the main class for work time records.

Table of Contents

Properties

$tab_worktime_times  : tab_worktime_times
Represents an object of work time records.

Methods

__construct()  : void
Initializes a new instance of the class.
__destruct()  : void
Destructor method that unsets the property $this->tab_worktime_times.
delete()  : bool
Deletes records from the database table based on the specified value and column.
generatebuttons()  : string
Generates buttons based on the session status and work/pause times.
get()  : array<string|int, mixed>|bool
Retrieves the data from the database based on the provided value and column.
getalllastmonth()  : array<string|int, mixed>|bool
Retrieves all entries from the table that match the given criteria for the last month.
insert()  : string|int|bool
Inserts a new entry into the table.
update()  : bool
Updates a record in the database table based on the specified column, value, and ID.
addButton()  : string
Adds a button to the HTML output.
checkifdaystart()  : array<string|int, mixed>|bool
Checks if the day has started for the user.
checkifpauserunning()  : array<string|int, mixed>|bool
Checks if a pause is currently running.
getallworkorpausetoday()  : int
Calculates the total time worked or paused today for a given user and type.

Properties

Methods

__construct()

Initializes a new instance of the class.

public __construct() : void

__destruct()

Destructor method that unsets the property $this->tab_worktime_times.

public __destruct() : void

delete()

Deletes records from the database table based on the specified value and column.

public delete(string $val[, string $col = 'id' ]) : bool
Parameters
$val : string

The value to match in the column.

$col : string = 'id'

The column to search for the specified value. Defaults to 'id'.

Return values
bool —

Returns true if the deletion is successful, false otherwise.

generatebuttons()

Generates buttons based on the session status and work/pause times.

public generatebuttons() : string
Return values
string —

The generated HTML buttons.

get()

Retrieves the data from the database based on the provided value and column.

public get(string $val[, string $col = 'uid' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to search for in the specified column.

$col : string = 'uid'

The column name to search the value in. Default is 'uid'.

Return values
array<string|int, mixed>|bool —

Returns an array of retrieved data if successful, otherwise returns false.

getalllastmonth()

Retrieves all entries from the table that match the given criteria for the last month.

public getalllastmonth(string $val[, string $col = 'uid' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to match against in the specified column.

$col : string = 'uid'

(optional) The column to search for the specified value. Default value is 'uid'.

Return values
array<string|int, mixed>|bool —

Returns an array of entries that match the criteria for the last month, or a boolean value indicating the result of the retrieval operation.

insert()

Inserts a new entry into the table.

public insert(string $uid, string $type[, string $wttype = '0' ]) : string|int|bool
Parameters
$uid : string

The unique identifier for the entry.

$type : string

The type of the entry.

$wttype : string = '0'

(optional) The work time type for the entry. Default value is '0'.

Return values
string|int|bool —

Returns the result of the insert operation. It can be a string, integer, or boolean value.

update()

Updates a record in the database table based on the specified column, value, and ID.

public update(string $col, string $val, string $id) : bool
Parameters
$col : string

The column to update in the database table.

$val : string

The new value to set for the specified column.

$id : string

The ID of the record to update.

Return values
bool —

Returns true if the update is successful, false otherwise.

addButton()

Adds a button to the HTML output.

private addButton(string $btnClass, string $url, string $title, string $text) : string
Parameters
$btnClass : string

The CSS class of the button.

$url : string

The URL that the button should link to.

$title : string

The title attribute of the button.

$text : string

The text displayed on the button.

Return values
string —

Returns the HTML code for the button.

checkifdaystart()

Checks if the day has started for the user.

private checkifdaystart([string $return = '0' ]) : array<string|int, mixed>|bool
Parameters
$return : string = '0'

The return value, defaults to '0'.

Return values
array<string|int, mixed>|bool —

Returns true if the day has started and $return is '0'. Returns the start information if the day has started and $return is '1'. Returns false if the day has not started.

checkifpauserunning()

Checks if a pause is currently running.

private checkifpauserunning([string $return = '0' ]) : array<string|int, mixed>|bool
Parameters
$return : string = '0'

The return value, defaults to '0'.

Return values
array<string|int, mixed>|bool —

Returns true if a pause is running and $return is '0'. Returns the pause information if a pause is running and $return is '1'. Returns false if no pause is running.

getallworkorpausetoday()

Calculates the total time worked or paused today for a given user and type.

private getallworkorpausetoday(string $uid, string $type) : int
Parameters
$uid : string

The user ID.

$type : string

The type of work or pause ('work' or 'pause').

Return values
int —

Returns the total time worked or paused today in seconds. Returns 0 if no work or pause is found.


        
On this page

Search results