| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- /**
- * Guild page file.
- *
- * Provides a class with all the properties and methods to display the page.
- *
- * @category Page
- */
- /**
- * Require dependent files if not present.
- */
- require_once(PATH::PAGE . "Page.php");
- require_once(PATH::ENTITY . "Guild.php");
- require_once(PATH::ENTITY . "Guild_Skill_Group.php");
- /**
- * Guild page model.
- *
- * @category Page
- */
- class Guild_Page extends Page{
- /**
- * @var Guild Player guild.
- */
- public $guild;
- /**
- * @var \Guild_Skill_Group[] List of Guild skill groups.
- */
- public $skill_groups = [];
- /**
- * Constructor.
- *
- * Retrieves the data and initializes the variables.
- *
- * @global Player Currenty selected player.
- * @global resource Connection to the database.
- */
- public function __construct(){
- global $PLAYER;
- global $db;
- $this->view = PATH::VIEW . "guild.php";
- $s = "
- SELECT id
- FROM guild
- WHERE id = (SELECT guild FROM guild_member WHERE member = '" . $PLAYER->id . "');
- ";
- $q = $db->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $guild_id = $r["id"];
- $this->guild = new Guild($guild_id);
- $this->title = $this->guild->name . " - SWDB";
- $this->description = $this->guild->name . " Guild details";
- $s = "
- SELECT id
- FROM guild_skill_group
- ORDER BY id;
- ";
- $q = $db->query($s);
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
- array_push($this->skill_groups, new Guild_Skill_Group($r["id"]));
- }
- }
- else{
- $this->title = "Guild - SWDB";
- $this->description = "No guild";
- }
- $this->canonical = URL::BASE . "guild/";
- }
- }
- ?>
|