| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- /**
- * Optimizer team list 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 . "Team.php");
- /**
- * Optimizer team list page model.
- *
- * @category Page
- */
- class Optimizer_Page extends Page{
- /**
- * @var \Team[] Teams to show.
- */
- public $teams = [];
- /**
- * Constructor.
- *
- * Retrieves the data and initializes the variables.
- *
- * @global Player Currently selected player.
- * @global resource Database connection.
- */
- public function __construct(){
- global $PLAYER;
- global $db;
- $this->view = PATH::VIEW . "optimizer.php";
- $s = $this->build_query();
- $q = $db->query($s);
- while ($r = $q->fetchArray(SQLITE3_ASSOC)){
- array_push($this->teams, new Team($r["id"]));
- }
- $s = "
- SELECT id
- FROM unit
- WHERE player = '" . $PLAYER->id . "';
- ";
- $this->title = "Optmizer - SWDB";
- $this->description = "Optimizer";
- $this->canonical = URL::BASE . "optmizer/";
- }
- /**
- * Builds the query to the rune table using the selected or default
- * filters.
- *
- * @return string The query to be executed.
- * @global Player Currently selected player.
- */
- private function build_query(){
- global $PLAYER;
- $s = "
- SELECT id
- FROM team
- WHERE player = '" . $PLAYER->id . "'
- ORDER BY
- area_type,
- area
- ";
- return $s;
- }
- }
- ?>
|