K_Guild_Skill.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Guild skill entity file.
  4. *
  5. * Creates the entity and makes it available.
  6. *
  7. * @category Entity
  8. */
  9. /**
  10. * Require dependent entities if not present.
  11. */
  12. require_once(PATH::ENTITY . "Entity.php");
  13. /**
  14. * Guild skill.
  15. *
  16. * Represents an object from the table 'k_guild_skill'.
  17. *
  18. * @category Entity
  19. */
  20. class K_Guild_Skill extends Entity{
  21. /**
  22. * @var int Skill identifier.
  23. */
  24. public $id;
  25. /**
  26. * @var int Skill group id.
  27. */
  28. public $group;
  29. /**
  30. * @var int Level at which the skill becames available.
  31. */
  32. public $level;
  33. /**
  34. * @var string Skill description.
  35. */
  36. public $effect;
  37. /**
  38. * Constructor.
  39. *
  40. * Searches the database and retrieves the information about the
  41. * skill, populating it and it's items.
  42. *
  43. * @param resource $db Connection to the database.
  44. * @param int $id Skill identifier.
  45. */
  46. public function __construct($db, $id){
  47. parent::__construct($db);
  48. $s =
  49. "SELECT " .
  50. " id, " .
  51. " skill_group, " .
  52. " level, " .
  53. " effect " .
  54. "FROM k_guild_skill " .
  55. "WHERE id = $id; ";
  56. $q = $this->db->query($s);
  57. $r = $q->fetchArray(SQLITE3_ASSOC);
  58. if ($r){
  59. $this->id = $r["id"];
  60. $this->group = $r["skill_group"];
  61. $this->level = $r["level"];
  62. $this->effect = HTML::e($r["effect"]);
  63. }
  64. }
  65. }
  66. ?>