K_Guild_Skill.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 int $id Skill identifier.
  44. * @global resource Database connection.
  45. */
  46. public function __construct($id){
  47. global $db;
  48. $statement = $db->prepare("
  49. SELECT
  50. id,
  51. skill_group,
  52. level,
  53. effect
  54. FROM k_guild_skill
  55. WHERE id = :id;
  56. ");
  57. $statement->bindValue(':id', $id, SQLITE3_INTEGER);
  58. $r = $statement->execute()->fetchArray(SQLITE3_ASSOC);
  59. if ($r){
  60. $this->id = $r["id"];
  61. $this->group = $r["skill_group"];
  62. $this->level = $r["level"];
  63. $this->effect = HTML::e($r["effect"]);
  64. }
  65. }
  66. }
  67. ?>