<?php
        session_start();

        if(file_exists("./funkce.php")) {
                include("./funkce.php");
        } else {
                die("Soubor <b>funkce.php</b> nebyl nalezen!");
        }
        je_admin();
        echo hlavicka("Administrace | Uživatelé fóra", TRUE);
        echo logo();
        echo menu();

        echo "\n\t<div id=\"navigace\">Administrace - Uživatelé fóra</div>\n\t<div id=\"obsah\">\n\t\t<div id=\"uzivatele_pismena\">\n\t\t\t";

        echo "Zadajte svůj vlastní filtr pre filtrovanie užívaťeľov  --> <a href=\"filtr.php\" title=\"Registrace\"><strong>Filtr</strong></a>";
        echo "\n\n\t\t</div>\n\t\t<table class=\"uzivatele\" cellspacing=\"0\" cellpadding=\"0\">
        <form action=\"welcome.php\" method=\"get\"> <tr class=\"uzivatele_hlavicka\">
                                <td><a href=\"uzivatele.php?sort=ID\">ID</a></td>
                                <td><a href=\"uzivatele.php?sort=JMENO\">Jméno uživatele</a></td>
                                <td align=\"center\"><a href=\"uzivatele.php?sort=EMAIL\">Email</a></td>
                                <td align=\"center\"><a href=\"uzivatele.php?sort=PRISPEVOK\">Príspevek</a></td>
                                <td align=\"center\"><a href=\"uzivatele.php?sort=TEMA\">Založených témat</a></td>
                                <td align=\"center\"><a href=\"uzivatele.php?sort=ZALOZEN\">Založen</a></td>                              
                                <td align=\"center\"><a href=\"uzivatele.php?sort=TYP\">Typ</a></td></form> 
                        </tr>\n";
                        
        if (isset($_GET["sort"])) { 
                        switch ($_GET["sort"]) {
                           case "ID":$query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele ORDER BY id;"); break;
                           case "JMENO": $query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele ORDER BY jmeno;"); break;
                           case "EMAIL": $query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele ORDER BY email;"); break;
                           case "PRISPEVOK":$query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele ORDER BY prispevku DESC;"); break;
                           case "TEMA": $query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele ORDER BY temat DESC;"); break;
                           case "ZALOZEN": $query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele ORDER BY zalozen;"); break;
                           case "TYP": $query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele ORDER BY userType;"); break;
                           } 
                          }
                        else {
                             $query = dotaz("SELECT id,jmeno,email,prispevku,temat,zalozen,userType FROM forum_uzivatele;");
                             };
        

        
      
        $i = 0;
        while($row = mysql_fetch_array($query)) {
                if($i % 2) { $class = ""; } else { $class = " class=\"uzivatele tr_2\""; }
                echo "\t\t\t<tr".$class.">
                                <td class=\"center\">$row[0]</td>
                                <td class=\"uzivatele_hlavni\"><a href=\"profil.php?uzivatel=".$row[id]."\" title=\"Profil uživatele\">$row[1]</a></td>
                                <td align=\"center\">$row[2]</td>\n
                                <td align=\"center\">$row[3]</td>\n
                                <td align=\"center\">$row[4]</td>\n
                                <td align=\"center\">$row[5]</td>\n
                                <td align=\"center\">$row[6]</td>\n";
        };       
        echo "\t\t</table>\n\t</div>\n";//.$paticka;       
       
       
       
     
     
        
?>