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 'guild_skill'.
  17. *
  18. * @category Entity
  19. */
  20. class 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 int $id Skill identifier.
  44. */
  45. public function __construct($id){
  46. $statement = get_context()->get_db()->prepare("
  47. SELECT
  48. id,
  49. skill_group,
  50. level,
  51. effect
  52. FROM key.guild_skill
  53. WHERE id = :id;
  54. ");
  55. $statement->bindValue(':id', $id, SQLITE3_TEXT);
  56. $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
  57. if ($r){
  58. $this->id = $r["id"];
  59. $this->group = $r["skill_group"];
  60. $this->level = $r["level"];
  61. $this->effect = HTML::e($r["effect"]);
  62. }
  63. }
  64. }
  65. ?>