Guild_Member.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. require_once($path["entity"] . "Entity.php");
  3. /**
  4. * Guild.
  5. *
  6. * Represents an object from the table 'guild'.
  7. */
  8. class Guild_Member extends Entity{
  9. /**
  10. * Member identifier.
  11. */
  12. public $id;
  13. /**
  14. * Guild id.
  15. */
  16. public $guild;
  17. /**
  18. * Member name.
  19. */
  20. public $name;
  21. /**
  22. * Member level.
  23. */
  24. public $level;
  25. /**
  26. * Member grade.
  27. */
  28. public $grade;
  29. /**
  30. * Memeber rating.
  31. */
  32. public $rating;
  33. /**
  34. * Memebr arena score.
  35. */
  36. public $arena_score;
  37. /**
  38. * Timestam the user joined the guild.
  39. */
  40. public $joined;
  41. /**
  42. * Timestamp the user last log on.
  43. */
  44. public $last_login;
  45. /**
  46. * Indicates if the member is included in guild wars.
  47. */
  48. public $in_war;
  49. /**
  50. * Indicates if the member has set guild wars defenses.
  51. */
  52. public $has_defense;
  53. /**
  54. * Constructor.
  55. *
  56. * Searches the database and retrieves the information about the
  57. * guild, populating it and it's items.
  58. *
  59. * @param SQLite3 $db Connection to the database.
  60. * @param int $id Guild identifier.
  61. */
  62. public function __construct($db, $id){
  63. global $path;
  64. parent::__construct($db);
  65. $s =
  66. "SELECT " .
  67. " id, " .
  68. " guild, " .
  69. " name, " .
  70. " level, " .
  71. " grade, " .
  72. " rating, " .
  73. " arena_score, " .
  74. " joined, " .
  75. " last_login, " .
  76. " in_war, " .
  77. " has_defense " .
  78. "FROM guild_member " .
  79. "WHERE id = $id; ";
  80. $q = $this->db->query($s);
  81. $r = $q->fetchArray(SQLITE3_ASSOC);
  82. if ($r){
  83. $this->id = $r["id"];
  84. $this->guild = $r["guild"];
  85. $this->name = $r["name"];
  86. $this->level = $r["level"];
  87. $this->grade = $r["grade"];
  88. $this->rating = $r["rating"];
  89. $this->arena_score = $r["arena_score"];
  90. $this->joined = $r["joined"];
  91. $this->last_login = $r["last_login"];
  92. $this->in_war = $r["in_war"];
  93. $this->has_defense = $r["has_defense"];
  94. }
  95. }
  96. }
  97. ?>