K_Guild_Skill.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. $s =
  49. "SELECT " .
  50. " id, " .
  51. " skill_group, " .
  52. " level, " .
  53. " effect " .
  54. "FROM k_guild_skill " .
  55. "WHERE id = $id; ";
  56. $q = $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. ?>