Subversion-Projekte lars-tiefland.em_wm

Revision

Revision 107 | Revision 131 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?
        require ("include/common.php");
        $smarty->assign("title", $common["final_result"]);
        $smarty->caching = true;
        $smarty->cache_lifetime = 86400;
        define("CACHE_ID", $u_loc . "|0");
        if (!$smarty->is_cached("result.tpl", CAHCE_ID))
        {
                if ($config->type == "WC")
                {
                        $sql = "SELECT * FROM games WHERE g_type IN (5,6)";
                }
                else
                {
                        $sql = "SELECT * FROM games WHERE g_type IN (4)";
                }
                $res = $db->query($sql);
                if (DB::isError($res))
                {
                        $smarty->assign("meld", $common["an_error_occured"]);
                        $smarty->assign("db_meld", $res->getUserInfo());
                        $smarty->assign("error", true);
                        $smarty->display("meld.tpl");
                }
                else
                {
                        if ($config->type == "WC")
                        {
                                while ($row = $res->fetchRow())
                                {
                                        $g_id = $row["g_id"];
                                        $g_type = $row["g_type"];
                                        $t_id1 = $row["g_m1"];
                                        $t_id2 = $row["g_m2"];
                                        $g_g1 = $row["g_g1"];
                                        $g_g2 = $row["g_g2"];
                                        $t1 = new Team($t_id1);
                                        $t2 = new Team($t_id2);
                                        $t_name1 = $t1->t_name;
                                        $t_name2 = $t2->t_name;
                                        if ($g_type == 5)
                                        {
                                                $champion3 = ($g_g1 > $g_g2) ? $t_name1 : $t_name2;
                                                $champion4 = ($g_g1 < $g_g2) ? $t_name1 : $t_name2;
                                        }
                                        else
                                        {
                                                $champion1 = ($g_g1 > $g_g2) ? $t_name1 : $t_name2;
                                                $champion2 = ($g_g1 < $g_g2) ? $t_name1 : $t_name2;
                                        }
                                }
                        }
                        else
                        {
                                $row = $res->fetchRow();
                                $g_id = $row["g_id"];
                                $g_type = $row["g_type"];
                                $t_id1 = $row["g_m1"];
                                $t_id2 = $row["g_m2"];
                                $g_g1 = $row["g_g1"];
                                $g_g2 = $row["g_g2"];
                                $t1 = new Team($t_id1);
                                $t2 = new Team($t_id2);
                                $t_name1 = $t1->t_name;
                                $t_name2 = $t2->t_name;
                                $champion1 = ($g_g1 > $g_g2) ? $t_name1 : $t_name2;
                                $champion2 = ($g_g1 < $g_g2) ? $t_name1 : $t_name2;
                                $champion3 = $champion4 = "Gibt es bei einer EM NICHT!";
                        }
                        $smarty->assign("champion1", $champion1);
                        $smarty->assign("champion2", $champion2);
                        $smarty->assign("champion3", $champion3);
                        $smarty->assign("champion4", $champion4);
                }
        }
        $smarty->display("result.tpl", CACHE_ID);
?>