| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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.
- */
- public function __construct(){
- $this->view = PATH::VIEW . "guild.php";
- $s = "
- SELECT id
- FROM guild
- WHERE id = (SELECT guild FROM guild_member WHERE member = '" . get_context()->get_player()->get_id() . "');
- ";
- $q = get_context()->get_db()->query($s);
- $r = $q->fetchArray(SQLITE3_ASSOC);
- if ($r){
- $guild_id = $r["id"];
- $this->guild = new Guild($guild_id);
- $this->title = $this->guild->get_name() . " - SWDB";
- $this->description = $this->guild->get_name() . " Guild details";
- $s = "
- SELECT id
- FROM guild_skill_group
- ORDER BY id;
- ";
- $q = get_context()->get_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/";
- }
- }
- ?>
|