| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- /**
- * Rune set entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * A rune set.
- *
- * Represents an object from the table 'rune_set'.
- *
- * @category Entity
- */
- class Rune_Set extends Entity{
-
- /**
- * @var int Set identifier.
- */
- private $id;
-
- /**
- * @var string Set name.
- */
- private $name;
-
- /**
- * @var int Required number of runes to activate the set.
- */
- private $amount;
-
- /**
- * @var string Set description.
- */
- private $description;
-
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * set, populating it and it's items.
- *
- * @param int $id Set identifier.
- */
- public function __construct($id){
-
- $statement = get_context()->get_db()->prepare("
- SELECT
- id,
- name,
- amount,
- description
- FROM rune_set
- WHERE id = :id;
- ");
- $statement->bindValue(':id', $id, SQLITE3_TEXT);
- $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->id = $r["id"];
- $this->name = HTML::e($r["name"]);
- $this->amount = $r["amount"];
- $this->description = HTML::e($r["description"]);
- }
- }
-
- /**
- * Retrieves the set identifier
- *
- * @return number Rune set ID.
- */
- public function get_id(){
- return $this->id;
- }
-
- /**
- * Retrieves the set name.
- *
- * @return string Rune set name.
- */
- public function get_name(){
- return $this->name;
- }
-
- /**
- * Retrieves the amount of runes required to complete a set.
- *
- * @return number Number of runes in the set (2|4).
- */
- public function get_amount(){
- return $this->amount;
- }
-
- /**
- * Retrieves the set description.
- *
- * @return string Rune set description.
- */
- public function get_description(){
- return $this->description;
- }
-
- /**
- * Gets the path to the set image.
- *
- * @return string Image URL, or a fixed unknown image.
- */
- public function get_image(){
- return APPLICATION::img("RUNE", $this->id);
- }
- }
- ?>
|