Location
extends Entity
in package
Content location class
This class maps the content_locations table.
A content location is defined by 3 parameters:
- location_global
- location_local
- location_k, an index for the content at the specified location
This class allows to get or set the content_id at this (global, local, k) location.
This class also provides a static helper method to get local content from a specific location.
Table of Contents
Properties
- $content_id : mixed
- $location_global : mixed
- $location_k : mixed
- $location_local : mixed
- $db : DatabaseEngine
Methods
- __construct() : mixed
- Initializes a new Location instance
- __toString() : string
- Returns a string representation of current Location instance
- delete() : mixed
- Deletes this content location from the database
- get_free_location_k() : mixed
- Gets the next k free value for the specified location
- get_local_content() : array<string|int, File>
- Gets content at specified location
- getDatabase() : DatabaseEngine
- load_from_database() : bool
- Loads the object Location (ie fill the properties) from the database
- load_from_row() : mixed
- Loads the object from row
- move() : mixed
- Moves the content into new location
- save_to_database() : void
- Saves to database
- setDatabase() : void
Properties
$content_id
public
mixed
$content_id
$location_global
public
mixed
$location_global
= null
$location_k
public
mixed
$location_k
= null
$location_local
public
mixed
$location_local
= null
$db
private
DatabaseEngine
$db
Methods
__construct()
Initializes a new Location instance
public
__construct(DatabaseEngine $db[, string $location_global = null ][, string $location_local = null ][, int $location_k = null ]) : mixed
Parameters
- $db : DatabaseEngine
- $location_global : string = null
-
the global location
- $location_local : string = null
-
the local location
- $location_k : int = null
-
the item indice for the specified location
__toString()
Returns a string representation of current Location instance
public
__toString() : string
Return values
string —the content title or path if title is blank.
delete()
Deletes this content location from the database
public
delete() : mixed
get_free_location_k()
Gets the next k free value for the specified location
public
get_free_location_k(string $location_global, string $location_local) : mixed
Parameters
- $location_global : string
-
the global location
- $location_local : string
-
the local location
get_local_content()
Gets content at specified location
public
static get_local_content(DatabaseEngine $db, string $location_global, string $location_local) : array<string|int, File>
Parameters
- $db : DatabaseEngine
- $location_global : string
-
global content location
- $location_local : string
-
local content location
Return values
array<string|int, File> —The returned array indices are the local_k.
getDatabase()
public
getDatabase() : DatabaseEngine
Return values
DatabaseEngineload_from_database()
Loads the object Location (ie fill the properties) from the database
public
load_from_database() : bool
Return values
boolload_from_row()
Loads the object from row
public
load_from_row(mixed $row) : mixed
Parameters
- $row : mixed
move()
Moves the content into new location
public
move(string $location_global, string $location_local[, int $location_k = null ]) : mixed
Parameters
- $location_global : string
-
the target global location
- $location_local : string
-
the target local location
- $location_k : int = null
-
the target local content indice [facultative]
save_to_database()
Saves to database
public
save_to_database() : void
setDatabase()
public
setDatabase(DatabaseEngine $db) : void
Parameters
- $db : DatabaseEngine