class Bookmark

Handles bookmarking SQL queries

Methods

__construct(DatabaseInterface $dbi, string $user)

Bookmark constructor.

int
getId()

Returns the ID of the bookmark

string
getDatabase()

Returns the database of the bookmark

string
getUser()

Returns the user whom the bookmark belongs to

string
getLabel()

Returns the label of the bookmark

string
getQuery()

Returns the query

bool
save()

Adds a bookmark

bool
delete()

Deletes a bookmark

int
getVariableCount()

Returns the number of variables in a bookmark

string
applyVariables(array $variables)

Replace the placeholders in the bookmark query with variables

static array|bool
getParams(string $user)

Defines the bookmark parameters for the current user

static Bookmark|false
createBookmark(DatabaseInterface $dbi, string $user, array $bkm_fields, bool $all_users = false)

Creates a Bookmark object from the parameters

static Bookmark
createFromRow(DatabaseInterface $dbi, string $user, array $row)

No description

static array
getList(DatabaseInterface $dbi, string $user, string|bool $db = false)

Gets the list of bookmarks defined for the current database

static Bookmark|null
get(DatabaseInterface $dbi, string $user, string $db, mixed $id, string $id_field = 'id', bool $action_bookmark_all = false, bool $exact_user_match = false)

Retrieve a specific bookmark

Details

at line 67
__construct(DatabaseInterface $dbi, string $user)

Bookmark constructor.

Parameters

DatabaseInterface $dbi DatabaseInterface object
string $user Current user

at line 78
int getId()

Returns the ID of the bookmark

Return Value

int

at line 88
string getDatabase()

Returns the database of the bookmark

Return Value

string

at line 98
string getUser()

Returns the user whom the bookmark belongs to

Return Value

string

at line 108
string getLabel()

Returns the label of the bookmark

Return Value

string

at line 118
string getQuery()

Returns the query

Return Value

string

at line 130
bool save()

Adds a bookmark

Return Value

bool whether the INSERT succeeds or not

at line 154
bool delete()

Deletes a bookmark

Return Value

bool true if successful

at line 172
int getVariableCount()

Returns the number of variables in a bookmark

Return Value

int number of variables

at line 186
string applyVariables(array $variables)

Replace the placeholders in the bookmark query with variables

Parameters

array $variables array of variables

Return Value

string query with variables applied

at line 218
static array|bool getParams(string $user)

Defines the bookmark parameters for the current user

Parameters

string $user Current user

Return Value

array|bool the bookmark parameters for the current user

at line 253
static Bookmark|false createBookmark(DatabaseInterface $dbi, string $user, array $bkm_fields, bool $all_users = false)

Creates a Bookmark object from the parameters

Parameters

DatabaseInterface $dbi DatabaseInterface object
string $user Current user
array $bkm_fields the properties of the bookmark to add; here, $bkm_fields['bkm_sql_query'] is urlencoded
bool $all_users whether to make the bookmark available for all users

Return Value

Bookmark|false

at line 282
static protected Bookmark createFromRow(DatabaseInterface $dbi, string $user, array $row)

Parameters

DatabaseInterface $dbi DatabaseInterface object
string $user Current user
array $row Resource used to build the bookmark

Return Value

Bookmark

at line 307
static array getList(DatabaseInterface $dbi, string $user, string|bool $db = false)

Gets the list of bookmarks defined for the current database

Parameters

DatabaseInterface $dbi DatabaseInterface object
string $user Current user
string|bool $db the current database name or false

Return Value

array the bookmarks list

at line 363
static Bookmark|null get(DatabaseInterface $dbi, string $user, string $db, mixed $id, string $id_field = 'id', bool $action_bookmark_all = false, bool $exact_user_match = false)

Retrieve a specific bookmark

Parameters

DatabaseInterface $dbi DatabaseInterface object
string $user Current user
string $db the current database name
mixed $id an identifier of the bookmark to get
string $id_field which field to look up the identifier
bool $action_bookmark_all true: get all bookmarks regardless of the owning user
bool $exact_user_match whether to ignore bookmarks with no user

Return Value

Bookmark|null the bookmark