PHP Class PMA\libraries\Bookmark

Show file Open project: phpmyadmin/phpmyadmin Class Usage Examples

Public Methods

Method Description
applyVariables ( array $variables ) : string Replace the placeholders in the bookmark query with variables
createBookmark ( array $bkm_fields, boolean $all_users = false ) : Bookmark | false Creates a Bookmark object from the parameters
delete ( ) : boolean Deletes a bookmark
get ( string $db, mixed $id, string $id_field = 'id', boolean $action_bookmark_all = false, boolean $exact_user_match = false ) : Bookmark Retrieve a specific bookmark
getDatabase ( ) : string Returns the database of the bookmark
getId ( ) : integer Returns the ID of the bookmark
getLabel ( ) : string Returns the label of the bookmark
getList ( string | boolean $db = false ) : Bookmark[] Gets the list of bookmarks defined for the current database
getParams ( ) : array Defines the bookmark parameters for the current user
getQuery ( ) : string Returns the query
getUser ( ) : string Returns the user whom the bookmark belongs to
getVariableCount ( ) : number Returns the number of variables in a bookmark
save ( ) : boolean Adds a bookmark

Method Details

applyVariables() public method

Replace the placeholders in the bookmark query with variables
public applyVariables ( array $variables ) : string
$variables array array of variables
return string query with variables applied

createBookmark() public static method

Creates a Bookmark object from the parameters
public static createBookmark ( array $bkm_fields, boolean $all_users = false ) : Bookmark | false
$bkm_fields array the properties of the bookmark to add; here, $bkm_fields['bkm_sql_query'] is urlencoded
$all_users boolean whether to make the bookmark available for all users
return Bookmark | false

delete() public method

Deletes a bookmark
public delete ( ) : boolean
return boolean true if successful

get() public static method

Retrieve a specific bookmark
public static get ( string $db, mixed $id, string $id_field = 'id', boolean $action_bookmark_all = false, boolean $exact_user_match = false ) : Bookmark
$db string the current database name
$id mixed an identifier of the bookmark to get
$id_field string which field to look up the identifier
$action_bookmark_all boolean true: get all bookmarks regardless of the owning user
$exact_user_match boolean whether to ignore bookmarks with no user
return Bookmark the bookmark

getDatabase() public method

Returns the database of the bookmark
public getDatabase ( ) : string
return string

getId() public method

Returns the ID of the bookmark
public getId ( ) : integer
return integer

getLabel() public method

Returns the label of the bookmark
public getLabel ( ) : string
return string

getList() public static method

Gets the list of bookmarks defined for the current database
public static getList ( string | boolean $db = false ) : Bookmark[]
$db string | boolean the current database name or false
return Bookmark[] the bookmarks list

getParams() public static method

Defines the bookmark parameters for the current user
public static getParams ( ) : array
return array the bookmark parameters for the current user

getQuery() public method

Returns the query
public getQuery ( ) : string
return string

getUser() public method

Returns the user whom the bookmark belongs to
public getUser ( ) : string
return string

getVariableCount() public method

Returns the number of variables in a bookmark
public getVariableCount ( ) : number
return number number of variables

save() public method

Adds a bookmark
public save ( ) : boolean
return boolean whether the INSERT succeeds or not