<?php 
    # $Id: benchmarkFile_DOWNLOAD.php,v 1.2 2007/01/08 12:51:13 jarda Exp $

    /* This page downloads one benchmark
     */

    require_once('simplePage.inc.php');

    class PageClass extends ViewSimplePage {

        function createPage()
        {
            $db = connect();

            $query = "SELECT benchmarkInstance.fileName AS filename, " .
                     "benchmarkSet.name AS benchmarksetname " .
                     "FROM benchmarkInstance, benchmarkSet " .
                     "WHERE benchmarkInstance.id = $_GET[id] AND " .
                     "benchmarkInstance.benchmarkSetId = benchmarkSet.id";

            $recordSet = $db->Execute($query);
            $row = $recordSet->FetchRow();
            $extension = strtolower($row[formatname]);
            $fullFileName = BenchConfig::$benchmarkFilesDirectory . "/$row[benchmarksetname]/$row[filename]";
                     
            header("Content-Type: application/force-download");
            header("Content-Disposition: attachment; filename=\"{$row[filename]}\"");
            readfile($fullFileName);
        }
    }

    launchPage();

    # vim:enc=iso8859-2:fenc=iso8859-2:
?>
