Skip to content
Snippets Groups Projects
pages.php 2.83 KiB
Newer Older
  • Learn to ignore specific revisions
  • Manuel Herrmann's avatar
    Manuel Herrmann committed
    <?php
    
    
    Tim Repke's avatar
    Tim Repke committed
    require_once("../frameworks/medoo.php");
    require_once("../config.inc.php");
    
    
    Manuel Herrmann's avatar
    Manuel Herrmann committed
    function page_stuff()
    {
        global $text;
        $text .= "Übersichtsseite";
    }
    
    function page_list()
    {
    
    Tim Repke's avatar
    Tim Repke committed
        global $text, $headers, $admin_db;
    
    Tim Repke's avatar
    Tim Repke committed
        $headers =<<<END
        <link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" />
        <script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="../view/js/jquery.dataTables.min.js"></script>
    END;
    
    Manuel Herrmann's avatar
    Manuel Herrmann committed
        $text .= "Meldeliste";
    
    Tim Repke's avatar
    Tim Repke committed
        $columns = array(
            "bachelor_id",
            "fahrt_id",
            "forname",
            "sirname",
            "pseudo",
            "antyp",
            "abtyp",
            "anday",
            "abday",
            "comment",
            "studityp"
        );
        $columnFunctions = array(
            "Anmelde-ID" => function($person) { return $person["bachelor_id"]; },
            "FahrtID" => function($person) { return $person["fahrt_id"]; },
            "Name" => function($person) { return $person["forname"]." ".$person["sirname"]." (".$person["pseudo"].")"; },
            "Anreisetyp" => function($person) { return ""; },
            "Abreisetyp" => function($person) { return ""; },
            "Anreisetag" => function($person) { return ""; },
            "Abreisetag" => function($person) { return ""; },
            "Kommentar" => function($person) { return ""; },
            "StudiTyp" => function($person) { return ""; }
        );
    
    
        $text .=<<<END
        <table id="mlist">
            <thead>
                <tr>
    
    Tim Repke's avatar
    Tim Repke committed
    END;
        foreach($columnFunctions as $key => $value)
        {
            $text .= "<th>".$key."</th>";
        }
        $text .=<<<END
    
                </tr>
            </thead>
            <tbody>
    
    Tim Repke's avatar
    Tim Repke committed
    END;
        // TODO: generate table content
    
        $people = $admin_db->select('bachelor',$columns);
        foreach($people as $person) {
        	$text .= "<tr>";
        	foreach($columnFunctions as $key => $value)
            {
                $text .= "<td>".$value($person)."</td>";
            }
        	$text .= "</tr>";
        }
    
        $text .=<<<END
    
            </tbody>
        </table>
        <script type='text/javascript'>
            $(document).ready(function(){
                $('#mlist').dataTable({});
            });
        </script>
    END;
    
    
    function page_404($pag)
    
    Manuel Herrmann's avatar
    Manuel Herrmann committed
    {
        global $text;
    
        $text .='
            <div style="background-color:black; color:antiquewhite; font-family: \'Courier New\', Courier, monospace;height: 100%; width: 100%;position:fixed; top:0; padding-top:40px;">
                $ get-page '.$pag.'<br />
                404 - page not found ('.$pag.')<br />
                $ <blink>&#9611;</blink>
            </div>';
    
    
    function page_notes(){
    
        require_page("pages_notes.php");
    }
    
    function page_mail(){
        require_page("pages_mail.php");
    }
    
    function page_cost(){
        require_page("pages_cost.php");
    }
    
    function require_page($page){
        if(!@file_exists($page) ) {
            page_404($page);
        } else {
            require_once $page;
        }
    
    Manuel Herrmann's avatar
    Manuel Herrmann committed
    ?>