| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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 . "K_Decoration.php");
- /**
- * A Decoration.
- *
- * Represents an object from the table 'decoration'.
- *
- * @category Entity
- */
- class Decoration extends Entity{
- /**
- * @var int player identifier.
- */
- public $uid;
- /**
- * @var K_Decoration Base decoration.
- */
- public $decoration;
- /**
- * @var int decoration level.
- */
- public $level;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * decoration, populating it and it's items.
- *
- * @param int $id Building identifier.
- * @global resource Database connection.
- */
- public function __construct($id){
- global $db;
- $statement = $db->prepare("
- SELECT
- uid,
- decoration,
- level
- FROM decoration
- WHERE id = :id;
- ");
- $statement->bindValue(':id', $id, SQLITE3_TEXT);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->uid = $r["uid"];
- $this->decoration = new K_Decoration($r["decoration"]);
- $this->level = $r["level"];
- }
- }
- }
- ?>
|