| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?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;
- $s = "
- SELECT
- uid,
- decoration,
- level
- FROM decoration
- WHERE id = $id;
- ";
- $q = $db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- $this->uid = $r["uid"];
- $this->decoration = new K_Decoration($r["decoration"]);
- $this->level = $r["level"];
- }
- }
- ?>
|