| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- /**
- * Guild skill group 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_Guild_Skill.php");
- /**
- * Guild skill group.
- *
- * Represents an object from the table 'k_guild_skill_group'.
- *
- * @category Entity
- */
- class K_Guild_Skill_Group extends Entity{
- /**
- * @var int Group identifier.
- */
- public $id;
- /**
- * @var string Group name.
- */
- public $name;
- /**
- * @var string Group description.
- */
- public $description;
- /**
- * @var \K_Guild_Skill[] List of K_Guild_Skills in the group.
- */
- public $skills = [];
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * skill group, populating it and it's items.
- *
- * @param resource $db Connection to the database.
- * @param int $id Skill group identifier.
- */
- public function __construct($db, $id){
- parent::__construct($db);
- $s =
- "SELECT " .
- " id, " .
- " name, " .
- " description " .
- "FROM k_guild_skill_group " .
- "WHERE id = $id; ";
- $q = $this->db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->id = $r["id"];
- $this->name = HTML::e($r["name"]);
- $this->description = HTML::e($r["description"]);
- }
- $s =
- "SELECT id " .
- "FROM k_guild_skill " .
- "WHERE skill_group = $this->id; ";
- $q = $this->db->query($s);
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
- array_push($this->skills, new K_Guild_Skill($db, $r["id"]));
- }
- }
- /**
- * Gets the pathto the monster image. The image must be in the
- * img/skill_guild/ directory, and its name must be the monster id,
- * padded with '0' to 1 digits, and the extension must be '.png'.
- *
- * @return string Image URL, or a fixed unknown image.
- */
- public function get_image(){
- return APPLICATION::img("SKILL_GUILD", $this->id);
- }
- }
- ?>
|