Example #1
0
<?php

/**
 * This will:
 * Set headers for download, connect to DB, get data from database,
 * generate CSV file for the Epics in the project then download it.
 */
//If there is no ID posted, use the word 'report' so that the CSV file is not
//downloaded with a blank file name
$id = htmlspecialchars(filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING));
//Setting header to download
header("Content-Disposition: attachment; filename=" . $id . ".csv");
require_once 'lib.php';
require_once 'database.ini';
//Database must be created already, if not use createdatabase.php
$connection = connectToDb();
$raw_epics_data = getRawSqlEpicsData($connection, $id);
$table = reportAllEpics("csv", $raw_epics_data);
echo $table;
$connection = null;
Example #2
0
        <!--EPICS-->
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12 col-md-12 main">
                    <h4 class="text-center">Epics:</h4>
                    <div class="table-responsive" id="epics-table">
                        <table class="table table-striped" id="epic-table">
                            <?php 
//Display the HTML table for Epics using data from the database and set history ID
if (isset($_GET["id"])) {
    require_once 'lib.php';
    require_once 'database.ini';
    $history_id = htmlspecialchars(filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING));
    $connection = connectToDb();
    $epics_data = getRawSqlEpicsData($connection, $history_id);
    $table = reportAllEpics("html", $epics_data);
    echo $table;
} else {
    echo 'Please make sure parameters are set!';
}
$connection = null;
?>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <hr>