 <?php
    /**
     * Main reports 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 . "Custom_Filter.php");


    /**
     * Main reports page model.
     *
     * @category Page
     */
    class Report_Page extends Page{

        /**
         * @var \Filter[] Custom filters for thie rune upgrade form.
         */
        public $custom_filters_runeupgrade = [];

        /**
         * Constructor.
         *
         * Retrieves the data and initializes the variables.
         *
         * @param resource $db Connection to the database.
         * @global int Player ID.
         */
        public function __construct($db){
            global $UID;
            parent::__construct($db);
            $this->view = PATH::VIEW . "report.php";

            // Get custom filters
            $s = "
              SELECT id
              FROM filter
              WHERE
                uid = '$UID' AND
                page = 'REPORT_RUNEUPGRADE';
            ";
            $q = $this->db->query($s);
            while ($r = $q->fetchArray(SQLITE3_ASSOC)){
                array_push($this->custom_filters_runeupgrade, new Custom_Filter($this->db, $r["id"]));
            }

            $this->title = "Reports - SWDB";
            $this->description = "Usefull reports for summoners";
            $this->canonical = URL::BASE . "report";
            $this->title = "Reports - SWDB";
        }
    }
?>

