| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?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 'k_rune_set'.
- *
- * @category Entity
- */
- class K_Rune_Set extends Entity{
- /**
- * @var int Set identifier.
- */
- public $id;
- /**
- * @var string Set name.
- */
- public $name;
- /**
- * @var int Required number of runes to activate the set.
- */
- public $amount;
- /**
- * @var string Set description.
- */
- public $description;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * set, populating it and it's items.
- *
- * @param int $id Set identifier.
- * @global resource Database connection.
- */
- public function __construct($id){
- global $db;
- $s =
- "SELECT " .
- " id, " .
- " name, " .
- " amount, " .
- " description " .
- "FROM k_rune_set " .
- "WHERE id = $id;";
- $q = $db->query($s);
- $r = $q->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"]);
- }
- }
- /**
- * Gets the path to the set image. The image must be in the
- * img/rune/ directory, and its name must be the set id,
- * padded with '0' to 2 digits, and the extension must be '.png'.
- *
- * @return string Image URL, or a fixed unknown image.
- */
- public function get_image(){
- return APPLICATION::img("RUNE", $this->id);
- }
- }
- ?>
|