| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- /**
- * Guild member entity file.
- *
- * Creates the entity and makes it available.
- *
- * @category Entity
- */
- /**
- * Require dependent entities if not present.
- */
- require_once(PATH::ENTITY . "Entity.php");
- /**
- * Guild.
- *
- * Represents an object from the table 'guild'.
- *
- * @category Entity
- */
- class Guild_Member extends Entity{
- /**
- * @var int Member identifier.
- */
- public $id;
- /**
- * @var int Guild id.
- */
- public $guild;
- /**
- * @var string Member name.
- */
- public $name;
- /**
- * @var int Member level.
- */
- public $level;
- /**
- * @var int Member grade.
- */
- public $grade;
- /**
- * @var int Memeber rating.
- */
- public $rating;
- /**
- * @var int Memebr arena score.
- */
- public $arena_score;
- /**
- * @var DateTime Time the user joined the guild at.
- */
- public $joined;
- /**
- * @var Datetime Time the user last log on at.
- */
- public $last_login;
- /**
- * @var bool Indicates if the member is included in guild wars.
- */
- public $in_war;
- /**
- * @var bool Indicates if the member has set guild wars defenses.
- */
- public $has_defense;
- /**
- * Constructor.
- *
- * Searches the database and retrieves the information about the
- * guild, populating it and it's items.
- *
- * @param resource $db Connection to the database.
- * @param int $id Guild identifier.
- */
- public function __construct($db, $id){
- global $path;
- parent::__construct($db);
- $s =
- "SELECT " .
- " id, " .
- " guild, " .
- " name, " .
- " level, " .
- " grade, " .
- " rating, " .
- " arena_score, " .
- " joined, " .
- " last_login, " .
- " in_war, " .
- " has_defense " .
- "FROM guild_member " .
- "WHERE id = $id; ";
- $q = $this->db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $this->id = $r["id"];
- $this->guild = $r["guild"];
- $this->name = HTML::e($r["name"]);
- $this->level = $r["level"];
- $this->grade = $r["grade"];
- $this->rating = $r["rating"];
- $this->arena_score = $r["arena_score"];
- $this->joined = $r["joined"];
- $this->last_login = $r["last_login"];
- $this->in_war = $r["in_war"];
- $this->has_defense = $r["has_defense"];
- }
- }
- }
- ?>
|