POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_House

Source Location: /classes/OTS_House.php

Class OTS_House

Class Overview

Wrapper for house information.

Wrapper for house information. Unlike other OTS_Base_DAO child classes, OTS_House bases not only on database, but also loads some additional info from XML DOM node. It can't be load - it is always initialised with DOMElement object. Saving will only update database row - won't change XML data. Same about using delete() method.

Located in /classes/OTS_House.php [line 37]

OTS_Base_DAO
   |
   --OTS_House
Author(s):
API Tags:
Property:  OTS_Player $owner: House owner.
Property:  int $paid: Paid time.
Property:  int $warnings: Warnings message.
Property-read:  int $id: House ID.
Property-read:  string $name: House name.
Property-read:  int $townId: ID of town where house is located.
Property-read:  string $townName: Name of town where house is located.
Property-read:  int $rent: Rent cost.
Property-read:  int $size: House size.
Property-read:  OTS_MapCoords $entry: Entry point.
Property-read:  array $tiles: List of tile points which house uses.

Information Tags:
Version:  0.1.3
Version:  0.1.0
Since:  0.1.0

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From OTS_Base_DAO

OTS_Base_DAO::$db

Inherited From OTS_Base_DAO

OTS_Base_DAO::__construct()
Sets database connection handler.
OTS_Base_DAO::__clone()
Creates clone of object.
OTS_Base_DAO::__set_state()
Magic PHP5 method.
OTS_Base_DAO::__sleep()
Magic PHP5 method.
OTS_Base_DAO::__wakeup()
Magic PHP5 method.

[ Top ]
Method Summary
OTS_House   __construct()   Creates wrapper for given house element.
void   addTile()   Adds tile to house.
void   delete()   Deletes house info from database.
OTS_MapCoords   getEntry()   Returns entry position.
int   getId()   Returns house's ID.
string   getName()   Return house's name.
OTS_Player|null   getOwner()   Returns current house owner.
int|false   getPaid()   Returns paid date.
int   getRent()   Returns house rent cost.
int   getSize()   Returns house size.
array   getTiles()   Returns tiles list.
int   getTownId()   Returns town ID in which house is located.
string   getTownName()   Returns town name.
int|false   getWarnings()   Returns house warnings.
void   save()   Saves info in database.
void   setOwner()   Sets house owner.
void   setPaid()   Sets paid date.
void   setWarnings()   Sets house warnings.
mixed   __get()   Magic PHP5 method.
void   __set()   Magic PHP5 method.
array   __sleep()   Magic PHP5 method.
string   __toString()   Returns string representation of object.

[ Top ]
Methods
Constructor __construct  [line 66]

  OTS_House __construct( $element  )

Creates wrapper for given house element.

Creates wrapper for given house element.

Parameters:
DOMElement   $element:  House information.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  PDOException On PDO operation error.
Since:  0.1.0

Redefinition of:
OTS_Base_DAO::__construct()
Sets database connection handler.

[ Top ]
addTile  [line 304]

  void addTile( OTS_MapCoords $tile  )

Adds tile to house.

Adds tile to house.

Parameters:
OTS_MapCoords   $tile:  Tile to be added.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

[ Top ]
delete  [line 113]

  void delete( )

Deletes house info from database.

Deletes house info from database.


API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  PDOException On PDO operation error.
Since:  0.1.0

[ Top ]
getEntry  [line 193]

  OTS_MapCoords getEntry( )

Returns entry position.

Returns entry position.


API Tags:
Return:  Entry coordinations on map.
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

[ Top ]
getId  [line 128]

  int getId( )

Returns house's ID.

Returns house's ID.


API Tags:
Return:  House ID.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

[ Top ]
getName  [line 139]

  string getName( )

Return house's name.

Return house's name.


API Tags:
Return:  House name.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

[ Top ]
getOwner  [line 203]

  OTS_Player|null getOwner( )

Returns current house owner.

Returns current house owner.


API Tags:
Return:  Player that currently owns house (null if there is no owner).
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

[ Top ]
getPaid  [line 238]

  int|false getPaid( )

Returns paid date.

Returns paid date.


API Tags:
Return:  Date timestamp until which house is rent (false if none).
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

[ Top ]
getRent  [line 172]

  int getRent( )

Returns house rent cost.

Returns house rent cost.


API Tags:
Return:  Rent cost.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

[ Top ]
getSize  [line 183]

  int getSize( )

Returns house size.

Returns house size.


API Tags:
Return:  House size.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

[ Top ]
getTiles  [line 318]

  array getTiles( )

Returns tiles list.

Returns tiles list. This returns list of coords of tiles used by this house on map. It will succeed only if house object was created during map loading with houses file opened to assign loaded tiles.


API Tags:
Return:  List of tiles.
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

[ Top ]
getTownId  [line 150]

  int getTownId( )

Returns town ID in which house is located.

Returns town ID in which house is located.


API Tags:
Return:  Town ID.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  DOMException On DOM operation error.
Since:  0.1.0

[ Top ]
getTownName  [line 161]

  string getTownName( )

Returns town name.

Returns town name.


API Tags:
Return:  Town name.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  E_OTS_NotLoaded When map file is not loaded to fetch towns names.
Since:  0.1.0

[ Top ]
getWarnings  [line 271]

  int|false getWarnings( )

Returns house warnings.

Returns house warnings.


API Tags:
Return:  Warnings text (false if none).
Access:  public

Information Tags:
Version:  0.1.2
Version:  0.1.0
Since:  0.1.0

[ Top ]
save  [line 94]

  void save( )

Saves info in database.

Saves info in database.


API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  PDOException On PDO operation error.
Since:  0.1.0

[ Top ]
setOwner  [line 228]

  void setOwner( OTS_Player $player  )

Sets house owner.

Sets house owner. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
OTS_Player   $player:  House owner to be set.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  E_OTS_NotLoaded If given $player object is not loaded.
Since:  0.1.0

[ Top ]
setPaid  [line 260]

  void setPaid( int $paid  )

Sets paid date.

Sets paid date. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $paid:  Sets paid timestamp to passed one.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

[ Top ]
setWarnings  [line 294]

  void setWarnings( int $warnings  )

Sets house warnings.

Sets house warnings. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $warnings:  Sets house warnings.

API Tags:
Access:  public

Information Tags:
Version:  0.1.2
Version:  0.1.0
Since:  0.1.0

[ Top ]
__get  [line 332]

  mixed __get( string $name  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.

API Tags:
Return:  Property value.
Access:  public

Information Tags:
Version:  0.1.0
Throws:  E_OTS_NotLoaded When atempt to read info about map while map not being loaded.
Throws:  OutOfBoundsException For non-supported properties.
Throws:  DOMException On DOM operation error.
Since:  0.1.0

[ Top ]
__set  [line 382]

  void __set( string $name, mixed $value  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.
mixed   $value:  Property value.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Throws:  E_OTS_NotLoaded If passed parameter for owner field won't be loaded.
Throws:  OutOfBoundsException For non-supported properties.
Since:  0.1.0

[ Top ]
__sleep  [line 84]

  array __sleep( )

Magic PHP5 method.

Magic PHP5 method. Allows object serialisation.


API Tags:
Return:  List of properties that should be saved.
Access:  public

Information Tags:
Version:  0.1.0
Since:  0.1.0

Redefinition of:
OTS_Base_DAO::__sleep()
Magic PHP5 method.

[ Top ]
__toString  [line 414]

  string __toString( )

Returns string representation of object.

Returns string representation of object. If any display driver is currently loaded then it uses it's method. Otherwise just returns house ID.


API Tags:
Return:  String representation of object.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.1.0
Since:  0.1.0
Since:  0.1.3

[ Top ]