<?php

namespace auctionforge\inc\controllers;

use auctionforge\inc\helpers\View;

class History
{
    public function init() {
        add_action('admin_menu', array($this, 'auction_register_admin_page_history'));
    }

    public function auction_register_admin_page_history() {
        $hook = add_submenu_page(
            'edit.php?post_type=lot',
            __('History Import', 'auctionforge'),
            __('History', 'auctionforge'),
            'administrator',
            'auction_history',
            array($this, 'auction_history_page')
        );

        add_action( "load-$hook", array($this, 'history_table_load') );
    }

    function history_table_load(){
        require_once __DIR__ . '/HistoryTable.php';
        // create an instance and save it next
        $GLOBALS['HistoryTable'] = new HistoryTable();
    }

    public function auction_history_page()
    {
        echo View::render('admin.view.history', array());
    }
}
$history = new History();
$history->init();
