<?php
require_once(SYSTEM_LOGICS . 'registration_history/logic.php');

class ControlRegistrationHistory extends LogicRegistrationHistory {

    public function __construct(){
        parent::__construct();
    }
    
    public function action(){
        try{
            $this -> logic();
                       
            if($this -> getType() == TYPE_EXPORT){
                header('Content-Type: application/octet-stream');
                header('Content-Disposition: attachment; filename=Registration_History_' . date('YmdHis') . '.csv');
                header('Content-Transfer-Encoding: binary');
                echo "\xEF\xBB\xBF";
                echo $this -> getExportDataCommon();
            }else
                require_once($this -> getSystemHTML('tmp_registration_history.php', $this -> dispHTML()));
        }catch(Exception $ex){
            header("Location: /");
        }
    }
    
}