\BusinessAdmin

Provides basic functions like adding elements to the database

Summary

Methods
Properties
Constants
getClientIds()
getClients()
getContactIds()
getContacts()
getOfferIds()
getOffers()
getAssignmentIds()
getAssignments()
createClient()
createFile()
formatDate()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getClientIds()

getClientIds(\PDO  $pdo) : array<mixed,integer>

Get all client ids

Parameters

\PDO $pdo

The PDO class for database connection

Throws

\PDOException

If something went wrong with the database

Returns

array<mixed,integer> —

The ids

getClients()

getClients(\PDO  $pdo) : array<mixed,\client>

Get all clients

Parameters

\PDO $pdo

The PDO class for database connection

Throws

\PDOException

If something went wrong with the database

Returns

array<mixed,\client> —

An array indexed by id of instances of the client class

getContactIds()

getContactIds(\PDO  $pdo) : array<mixed,integer>

Get all contact ids

Parameters

\PDO $pdo

The PDO class for database connection

Throws

\PDOException

Is something went wrong with the database

Returns

array<mixed,integer> —

The ids

getContacts()

getContacts(\PDO  $pdo) : array<mixed,\contact>

Get all contacts

Parameters

\PDO $pdo

The PDO class for database connection

Throws

\PDOException

If something went wrong with the database

Returns

array<mixed,\contact> —

An array indexed by id of instances of the contact class

getOfferIds()

getOfferIds(\PDO  $pdo, array<mixed,string>  $where = array()) : array<mixed,integer>

Get all offer ids

Parameters

\PDO $pdo

The PDO class for database connection

array<mixed,string> $where

An array of WHERE clauses that will be AND-ed

Throws

\PDOException

Is something went wrong with the database

Returns

array<mixed,integer> —

The ids

getOffers()

getOffers(\PDO  $pdo, array<mixed,string>  $where = array()) : array<mixed,\offer>

Get all offers

Parameters

\PDO $pdo

The PDO class for database connection

array<mixed,string> $where

An array of WHERE clauses that will be AND-ed

Throws

\PDOException

If something went wrong with the database

Returns

array<mixed,\offer> —

An array indexed by id of instances of the offer class

getAssignmentIds()

getAssignmentIds(\PDO  $pdo) : array<mixed,integer>

Get all assignment ids

Parameters

\PDO $pdo

The PDO class for database connection

Throws

\PDOException

Is something went wrong with the database

Returns

array<mixed,integer> —

The ids

getAssignments()

getAssignments(\PDO  $pdo) : array<mixed,\assignment>

Get all assignments

Parameters

\PDO $pdo

The PDO class for database connection

Throws

\PDOException

If something went wrong with the database

Returns

array<mixed,\assignment> —

An array indexed by id of instances of the assignment class

createClient()

createClient(\PDO  $pdo, string  $name) : \client|boolean

Create a new client

Parameters

\PDO $pdo

The database connection

string $name

The name for the new client

Throws

\PDOException

If something went wrong with the database

Returns

\client|boolean —

A new instance of the client object, or false on failure

createFile()

createFile(\PDO  $pdo, string  $filename) : \file

Create a new file

Parameters

\PDO $pdo

The database connection

string $filename

The desired filename

Throws

\PDOException

If something went wrong with the database

\Exception

If the file could not be created (due to permissions, file existed already, etc.), or the database record couldn't be added

Returns

\file

A new instance of the file object

formatDate()

formatDate(integer  $timestamp, boolean  $with_time = true, boolean  $full_date = false, boolean  $relatively = false) : string

Format a date nicely

Parameters

integer $timestamp

The UNIX timestamp to format

boolean $with_time

If false, only the date is returned; if false, also the time

boolean $full_date

If true, a year will be outputted even if the date is in the current year

boolean $relatively

Whether or not to show the date relatively (e.g. '1 day ago') (NOT IMPLEMENTED YET)

Returns

string —

The formatted date