Documentation

tab_worktime_times

Class tab_worktime_times

This class provides methods for interacting with the 'worktime_times' table in the database.

Table of Contents

Properties

$allowedCols  : array<string|int, mixed>
$db  : db_tenant
Database connection object.

Methods

__construct()  : mixed
Constructor for the class.
__destruct()  : void
Destructor for the class.
delete()  : bool
Deletes a record from the 'worktime_times' table based on the provided value and column.
get()  : array<string|int, mixed>|bool
Retrieves a record from the `worktime_times` table based on the given value and column.
getalllastmonth()  : array<string|int, mixed>|bool
Get all records from the `worktime_times` table for the last month.
getlastpause()  : array<string|int, mixed>|bool
getlaststart()  : array<string|int, mixed>|bool
getworkorpausetoday()  : array<string|int, mixed>|bool
Retrieves work time or pause time records for a given user within a specified period.
insert()  : string|int|bool
Insert a new record into the `worktime_times` table.
update()  : bool
Updates a record in the 'worktime_times' table based on the provided column, value, and ID.

Properties

$allowedCols

protected array<string|int, mixed> $allowedCols = ['id', 'uid', 'type', 'wttype', 'start', 'end']

An array containing the names of allowed columns.

$db

Database connection object.

protected db_tenant $db

This class provides methods for establishing and maintaining a database connection. It also provides methods to execute queries and fetch results.

Tags
category

Database

Methods

__construct()

Constructor for the class.

public __construct() : mixed

Initializes the class by assigning the global $dbt object to the $db property.

delete()

Deletes a record from the 'worktime_times' table based on the provided value and column.

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

The value to match in the specified column.

$col : string = 'id'

The name of the column to match the value against. Default is 'id'.

Return values
bool

Returns true if the record is successfully deleted, false otherwise.

get()

Retrieves a record from the `worktime_times` table based on the given 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'

Optional. The column to search in. Defaults to 'uid'.

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

Returns an array containing the first matching record if found, or false if no match is found.

getalllastmonth()

Get all records from the `worktime_times` table for the last month.

public getalllastmonth(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 to search for the specified value. Default value is 'uid'.

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

Returns an array of records from the worktime_times table if records exist for the last month, otherwise returns false.

getlastpause()

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

getlaststart()

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

getworkorpausetoday()

Retrieves work time or pause time records for a given user within a specified period.

public getworkorpausetoday(string $uid, string $type, string $begin, string $end) : array<string|int, mixed>|bool
Parameters
$uid : string

The user ID.

$type : string

The type of record (work time or pause time).

$begin : string

The start of the period.

$end : string

The end of the period.

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

Returns an array of records if any found within the specified period, or false otherwise.

insert()

Insert a new record into the `worktime_times` table.

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

The user ID to insert.

$type : string

The type to insert.

$wttype : string = '0'

The work time type to insert. Default value is '0'.

Return values
string|int|bool

Returns the last inserted ID if the insertion is successful, otherwise returns false.

update()

Updates a record in the 'worktime_times' table based on the provided column, value, and ID.

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

The name of the column to be updated.

$val : string

The new value to be set for the specified column.

$id : string

The ID of the record to be updated.

Return values
bool

Returns true if the record is successfully updated, false otherwise.


        
On this page

Search results