* @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3 * @package SWDB */ 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. */ private $teams = []; /** * Constructor. * * Retrieves the data and initializes the variables. */ public function __construct(){ $this->view = PATH::VIEW . "optimizer.php"; $this->title = "Optimizer - SWDB"; $this->description = "Optimizer"; $this->canonical = URL::BASE . "optimizer/"; // Get teams $statement = get_context()->get_db()->prepare(" SELECT id FROM team WHERE player = :player ORDER BY area_type, area"); $statement->bindValue(":player", get_context()->get_player()->get_id(), SQLITE3_TEXT); $result_set = $statement->execute(); while ($result = $result_set->fetchArray(SQLITE3_ASSOC)){ array_push($this->teams, new Team($result["id"])); } } /** * Retrieves the player teams. * * @return Team[] Player teams. */ public function get_teams(){ return $this->teams; } }