| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?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 resource $db Connection to the database.
- * @param int $id Building identifier.
- */
- public function __construct($db, $id){
- parent::__construct($db);
- $s = "
- SELECT
- uid,
- decoration,
- level
- FROM decoration
- WHERE decoration = $id;
- ";
- $q = $this->db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- $this->uid = $r["uid"];
- $this->decoration = new K_Decoration($this->db, $r["decoration"]);
- $this->level = $r["level"];
- }
- }
- ?>
|