Zed. The source code to build a world.

Place extends Entity
in package
Uses WithDatabase

Geo place

A place is a city or a hypership district.

It's identified by a 9 chars geocode like B0001001. The 5 first chars indicates the body (class GeoBody) where the place is and the 3 last digits is the place number.

This class maps the geo_places table.

Table of Contents

Constants

LOCATION_LOCAL_DEFAULT_FORMAT  = "/^\\([0-9]+( )*,( )*[0-9]+( )*,( )*[0-9]+\\)\$/"

Properties

$body_code  : mixed
$code  : mixed
$description  : mixed
$hidden  : mixed
$id  : mixed
$lastError  : string
$location_local_format  : mixed
$name  : mixed
$start  : mixed
$db  : DatabaseEngine

Methods

__construct()  : mixed
Initializes a new instance
__tostring()  : string
Gets a string representation of the current place
from_code()  : Place
Creates a Place instance, from the specified body/place code
get_start_location()  : string
Gets a start location
getDatabase()  : DatabaseEngine
getStatus()  : string
Gets status field value
is_valid_local_location()  : bool
Determines if the specified local location looks valid
load_from_database()  : bool
Loads the object place (ie fill the properties) from the database
load_from_form()  : mixed
Loads the object place (ie fill the properties) from the $_POST array
save_to_database()  : void
Saves to database
setDatabase()  : void

Constants

LOCATION_LOCAL_DEFAULT_FORMAT

public mixed LOCATION_LOCAL_DEFAULT_FORMAT = "/^\\([0-9]+( )*,( )*[0-9]+( )*,( )*[0-9]+\\)\$/"

Properties

$body_code

public mixed $body_code

$description

public mixed $description

$hidden

public mixed $hidden

$lastError

public string $lastError = ""

$location_local_format

public mixed $location_local_format

Methods

__construct()

Initializes a new instance

public __construct(mixed $db[, int $id = null ]) : mixed
Parameters
$db : mixed
$id : int = null

the primary key

__tostring()

Gets a string representation of the current place

public __tostring() : string
Return values
string

A Bxxxxxyyy string like B00001001, which represents the current place.

from_code()

Creates a Place instance, from the specified body/place code

public static from_code(DatabaseEngine $db,  $code) : Place
Parameters
$db : DatabaseEngine
$code :

the place's code

Return values
Place

the place instance

get_start_location()

Gets a start location

public static get_start_location(DatabaseEngine $db) : string
Parameters
$db : DatabaseEngine
Tags
TODO

sql optimisation (query contains ORDER BY RAND())

Return values
string

The global location code of a start location

getDatabase()

public getDatabase() : DatabaseEngine
Return values
DatabaseEngine

getStatus()

Gets status field value

public getStatus() : string
Return values
string

the status field value (e.g. "requiresPTA,default")

is_valid_local_location()

Determines if the specified local location looks valid

public is_valid_local_location(string $local_location) : bool
Parameters
$local_location : string

the local location

Return values
bool

true if the specified local location looks valid ; otherwise, false.

load_from_database()

Loads the object place (ie fill the properties) from the database

public load_from_database() : bool
Return values
bool

load_from_form()

Loads the object place (ie fill the properties) from the $_POST array

public load_from_form() : mixed

save_to_database()

Saves to database

public save_to_database() : void

setDatabase()

public setDatabase(DatabaseEngine $db) : void
Parameters
$db : DatabaseEngine

        
On this page

Search results