| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * Decoration entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- require_once(PATH::ENTITY . "Decorative.php");
- /**
- * A Decoration.
- *
- * Represents an object from the table 'decoration'.
- *
- * @category Entity
- */
- class Decoration extends Entity{
- private $player_id;
- private $decorative;
- private $level;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * decoration, populating it and it's items.
- *
- * @param int $id Building identifier.
- */
- public function __construct($id){
- $statement = get_context()->get_db()->prepare("
- SELECT
- player,
- decorative,
- level
- FROM decoration
- WHERE id = :id;
- ");
- $statement->bindValue(':id', $id, SQLITE3_TEXT);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->player = $r["player"];
- $this->decorative = new Decorative($r["decorative"]);
- $this->level = $r["level"];
- }
- }
- /**
- * Retrieves the owner's player id.
- *
- * @return int Player ID.
- */
- public function get_player_id(){
- return $this->player_id;
- }
-
- /**
- * Retrieves the base decorative structure.
- *
- * @return Decorative Base decorative.
- */
- public function get_decorative(){
- return $this->decorative;
- }
-
- /**
- * Retrieves the decoration level.
- *
- * @return int Decoration level.
- */
- public function get_level(){
- return $this->level;
- }
-
- }
- ?>
|