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

    /* Displays list of supported benchmark formats
    */

    require_once('structuredPage.inc.php');

    class PageClass extends ViewStructuredPage
    {
        
        function getTitle()
        {
            return 'Formats listing';
        }
        
        
        function printContents() {
            $db = connect();

            $query = 'SELECT * FROM format ORDER BY name';
            $result = $db->Execute($query);

            echo '<table border="1">';
            while ($row = $result->FetchRow()) {
                $this->addTableRow($row);
            }
            echo '</table><br>';
        }

        
        /* Adds a row to the displayed table of formats
        */
        function addTableRow(&$row)
        {
            echo "<tr><td><a href=\"format_SHOW.php?id=$row[id]\">$row[name]</a></td>";

            if ($this->userCanEditDB())
            {
                echo "<td><a href=\"format_EDIT.php?id=$row[id]\">Editace</a></td>";
            }
            
            echo "</tr>\n";
        }

    }


    launchPage();

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