Beispiel #1
0
        }
        // Log
        $date =& JFactory::getDate();
        $now = $date->toMySQL();
        $user =& JFactory::getUser();
        $jid_aktion = $user->get('id');
        $aktion = "Ergebnis FE";
        $query = "INSERT INTO #__clm_log " . " ( `aktion`, `jid_aktion`, `sid` , `lid` ,`rnd`,`paar`,`dg`, `datum`) " . " VALUES ('{$aktion}','{$jid_aktion}','{$sid}','{$lid}','{$rnd}','{$paarung}','{$dg}','{$now}') ";
        $db->setQuery($query);
        $db->query();
        // Auswertung der DWZ bei aktivierter Option !
        // Konfigurationsparameter auslesen
        $config =& JComponentHelper::getParams('com_clm');
        $dwz_fe = $config->get('dwz_fe', 0);
        if ($dwz_fe == "1") {
            CLMModelMeldung::dwz($sid, $lid);
        }
        // Ende DWZ
        $msg = "<h1>" . JText::_('RESULT_TIP_POSITIV_SH') . "</h1>";
        if ($mail[0]->mail > 0) {
            $msg = "<h1>" . JText::_('RESULT_TIP_POSITIV') . "</h1>";
        }
        $link = 'index.php?option=' . $option . '&view=runde&liga=' . $lid . '&runde=' . $rnd . '&saison=' . $sid . '&dg=' . $dg . '&Itemid=' . $itemid;
        $mainframe->redirect($link, $msg);
    } else {
        $msg = "<h1>" . JText::_('RESULT_TIP_NEGATIV') . "</h1>";
        JError::raiseWarning(500, $msg);
        $link = 'index.php?option=' . $option . '&view=runde&liga=' . $lid . '&runde=' . $rnd . '&saison=' . $sid . '&dg=' . $dg . '&Itemid=' . $itemid;
        $mainframe->redirect($link, $msg);
    }
}
 function DWZRechner($R0, $Index, $Alter, $Gegner)
 {
     $PTab = array(500, 501, 503, 504, 506, 507, 508, 510, 511, 513, 514, 516, 517, 518, 520, 521, 523, 524, 525, 527, 528, 530, 531, 532, 534, 535, 537, 538, 539, 541, 542, 544, 545, 546, 548, 549, 551, 552, 553, 555, 556, 558, 559, 560, 562, 563, 565, 566, 567, 569, 570, 572, 573, 574, 576, 577, 578, 580, 581, 583, 584, 585, 587, 588, 590, 591, 592, 594, 595, 596, 598, 599, 600, 602, 603, 605, 606, 607, 609, 610, 611, 613, 614, 615, 617, 618, 619, 621, 622, 623, 625, 626, 628, 629, 630, 632, 633, 634, 636, 637, 638, 639, 641, 642, 643, 645, 646, 647, 649, 650, 651, 653, 654, 655, 657, 658, 659, 660, 662, 663, 664, 666, 667, 668, 669, 671, 672, 673, 675, 676, 677, 678, 680, 681, 682, 683, 685, 686, 687, 688, 690, 691, 692, 693, 695, 696, 697, 698, 700, 701, 702, 703, 705, 706, 707, 708, 709, 711, 712, 713, 714, 715, 717, 718, 719, 720, 721, 723, 724, 725, 726, 727, 728, 730, 731, 732, 733, 734, 735, 737, 738, 739, 740, 741, 742, 743, 745, 746, 747, 748, 749, 750, 751, 752, 754, 755, 756, 757, 758, 759, 760, 761, 762, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 827, 828, 829, 830, 831, 832, 833, 834, 835, 835, 836, 837, 838, 839, 840, 841, 841, 842, 843, 844, 845, 846, 847, 847, 848, 849, 850, 851, 852, 852, 853, 854, 855, 856, 856, 857, 858, 859, 860, 860, 861, 862, 863, 863, 864, 865, 866, 867, 867, 868, 869, 870, 870, 871, 872, 873, 873, 874, 875, 875, 876, 877, 878, 878, 879, 880, 880, 881, 882, 883, 883, 884, 885, 885, 886, 887, 887, 888, 889, 889, 890, 891, 891, 892, 893, 893, 894, 895, 895, 896, 897, 897, 898, 898, 899, 900, 900, 901, 902, 902, 903, 903, 904, 905, 905, 906, 906, 907, 908, 908, 909, 909, 910, 910, 911, 912, 912, 913, 913, 914, 914, 915, 915, 916, 917, 917, 918, 918, 919, 919, 920, 920, 921, 921, 922, 922, 923, 923, 924, 924, 925, 925, 926, 926, 927, 927, 928, 928, 929, 929, 930, 930, 931, 931, 932, 932, 933, 933, 934, 934, 934, 935, 935, 936, 936, 937, 937, 938, 938, 938, 939, 939, 940, 940, 941, 941, 941, 942, 942, 943, 943, 943, 944, 944, 945, 945, 945, 946, 946, 947, 947, 947, 948, 948, 948, 949, 949, 950, 950, 950, 951, 951, 951, 952, 952, 952, 953, 953, 953, 954, 954, 954, 955, 955, 955, 956, 956, 956, 957, 957, 957, 958, 958, 958, 959, 959, 959, 960, 960, 960, 961, 961, 961, 961, 962, 962, 962, 963, 963, 963, 963, 964, 964, 964, 965, 965, 965, 965, 966, 966, 966, 966, 967, 967, 967, 968, 968, 968, 968, 969, 969, 969, 969, 970, 970, 970, 970, 970, 971, 971, 971, 971, 972, 972, 972, 972, 973, 973, 973, 973, 973, 974, 974, 974, 974, 975, 975, 975, 975, 975, 976, 976, 976, 976, 976, 977, 977, 977, 977, 977, 977, 978, 978, 978, 978, 978, 979, 979, 979, 979, 979, 980, 980, 980, 980, 980, 980, 981, 981, 981, 981, 981, 981, 982, 982, 982, 982, 982, 982, 982, 983, 983, 983, 983, 983, 983, 983, 984, 984, 984, 984, 984, 984, 984, 985, 985, 985, 985, 985, 985, 985, 986, 986, 986, 986, 986, 986, 986, 986, 987, 987, 987, 987, 987, 987, 987, 987, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 989, 989, 989, 989, 989, 989, 989, 989, 989, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 991, 991, 991, 991, 991, 991, 991, 991, 991, 991, 991, 991, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 1000);
     $LTab = array(0.5 => array(1 => 0, -191, -274, -325, -362, -391, -414, -434, -451, -465, -478, -490, -500, -510, -519, -527, -534, -542, -548, -554), 1 => array(2 => 0, -122, -191, -238, -274, -302, -325, -345, -362, -378, -391, -403, -414, -425, -434, -443, -451, -458, -465), 1.5 => array(2 => 191, 0, -90, -148, -191, -224, -251, -274, -293, -310, -325, -339, -351, -362, -373, -382, -391, -399, -407), 2 => array(3 => 122, 0, -72, -122, -160, -191, -216, -238, -257, -274, -289, -302, -314, -325, -336, -345, -354, -362), 2.5 => array(3 => 274, 90, 0, -60, -104, -138, -167, -191, -212, -230, -246, -260, -274, -286, -297, -307, -316, -325), 3 => array(4 => 191, 72, 0, -51, -90, -122, -148, -171, -191, -208, -224, -238, -251, -263, -274, -284, -293), 3.5 => array(4 => 325, 148, 60, 0, -44, -80, -109, -134, -155, -174, -191, -206, -220, -232, -244, -254, -264), 4 => array(5 => 238, 122, 51, 0, -40, -72, -99, -122, -142, -160, -176, -191, -204, -215, -228, -238), 4.5 => array(5 => 362, 191, 104, 44, 0, -36, -65, -90, -112, -131, -148, -164, -178, -191, -203, -214), 5 => array(6 => 274, 160, 90, 40, 0, -32, -60, -83, -104, -122, -138, -153, -167, -179, -191), 5.5 => array(6 => 391, 224, 138, 80, 36, 0, -30, -55, -77, -96, -114, -130, -144, -157, -169), 6 => array(7 => 302, 191, 122, 72, 32, 0, -27, -51, -72, -90, -107, -122, -136, -148), 6.5 => array(7 => 414, 251, 164, 106, 65, 30, 0, -25, -47, -67, -85, -101, -115, -128), 7 => array(8 => 325, 216, 148, 99, 60, 27, 0, -24, -44, -63, -80, -95, -109), 7.5 => array(8 => 434, 274, 191, 134, 90, 55, 25, 0, -22, -42, -60, -76, -90), 8 => array(9 => 345, 238, 171, 122, 83, 51, 24, 0, -21, -40, -56, -72), 8.5 => array(9 => 451, 293, 212, 155, 112, 77, 47, 22, 0, -20, -37, -53), 9 => array(10 => 362, 257, 191, 142, 104, 72, 44, 21, 0, -19, -36), 9.5 => array(10 => 465, 310, 230, 174, 131, 90, 67, 42, 20, 0, -18), 10 => array(11 => 378, 274, 208, 160, 122, 90, 63, 40, 19, 0), 10.5 => array(11 => 478, 325, 246, 191, 148, 114, 85, 60, 37, 18), 11 => array(12 => 391, 289, 224, 176, 138, 108, 80, 56, 36), 12.5 => array(12 => 490, 339, 260, 206, 164, 130, 101, 76, 53), 12 => array(13 => 403, 302, 238, 191, 153, 122, 95, 72), 12.5 => array(13 => 500, 351, 274, 220, 178, 144, 115, 90), 13 => array(14 => 414, 314, 251, 204, 167, 136, 109), 13.5 => array(14 => 510, 362, 286, 232, 191, 157, 128), 14 => array(15 => 425, 325, 263, 216, 179, 148), 14.5 => array(15 => 519, 373, 297, 244, 203, 169), 15 => array(16 => 434, 336, 274, 228, 191), 15.5 => array(16 => 527, 382, 307, 254, 214), 16 => array(17 => 443, 345, 284, 238), 16.5 => array(17 => 535, 391, 316, 264), 17 => array(18 => 451, 354, 293), 17.5 => array(18 => 542, 399, 325), 18 => array(19 => 458, 362), 18.5 => array(19 => 548, 407), 19 => array(20 => 465), 19.5 => array(20 => 554));
     $n = 0;
     $W = 0;
     $We = 0;
     $Leistung = 0;
     foreach ($Gegner as $G) {
         if ($G[0] == 0) {
             continue;
         }
         if ($G[1] != "1" and $G[1] != "0" and $G[1] != "5") {
             continue;
         }
         $n++;
         if ($R0 > 0) {
             $D = $R0 - $G[0];
             if ($D > sizeof($PTab)) {
                 $P = 1000;
             } else {
                 if ($D >= 0) {
                     $P = $PTab[$D];
                 } else {
                     if ($D < -sizeof($PTab)) {
                         $P = 0;
                     } else {
                         $P = 1000 - $PTab[-$D];
                     }
                 }
             }
             $We += $P;
         }
         if ($G[1] == "1") {
             $W += 1000;
         } else {
             if ($G[1] == "5") {
                 $W += 500;
             }
         }
         $Leistung += $G[0];
     }
     if ($n > 0) {
         $niveau = round($Leistung / $n);
     } else {
         $niveau = 0;
     }
     if ($n > 4) {
         if ($W == 0) {
             $Leistung = $niveau - 677;
         } else {
             if ($W == $n) {
                 $Leistung = $niveau + 677;
             } else {
                 $P = $W / 1000;
                 $Leistung = $niveau + $LTab[$P][$n];
             }
         }
     } else {
         $Leistung = 0;
     }
     if ($R0 > 0) {
         $E = CLMModelMeldung::BerechneEFaktor($R0, $Index, $Alter);
         $Rn = (int) round($R0 + 0.8 * ($W - $We) / ($E + $n));
         $In = $Index + 1;
     } else {
         if ($Leistung > 0 and $n > 4) {
             if ($Leistung >= 800) {
                 $Rn = $Leistung;
             } else {
                 $Rn = (int) round($Leistung / 8 + 700);
             }
             $In = 1;
             $E = 0;
         } else {
             $Leistung = 0;
             if ($n > 0) {
                 $Rn = "Restp.";
                 $In = 0;
                 $E = 0;
             } else {
                 $Rn = $R0;
                 $In = $Index;
                 if (!isset($E)) {
                     $E = 0;
                 }
             }
         }
     }
     $dwz = array($Rn, $In, $W, $n, $We, $Leistung, $E, $niveau);
     if (Return0) {
         if ($Rn == 0) {
             $Rn = Null;
         }
         if ($Rn == 0) {
             $In = Null;
         }
         if ($R0 == 0) {
             $We = Null;
         }
         if ($n == 0) {
             $Leistung = Null;
         }
         if ($R0 == 0) {
             $E = Null;
         }
         if ($n == 0) {
             $Niveau = Null;
         }
     }
     return $dwz;
 }
    if ($finish[$runde + ($dg - 1) * $liga[0]->runden - 1]->meldung == 0) {
        //klkl
        $msg = JText::_('RESULT_DATA_ROUND_UNPUBLISHED');
        $link = "index.php?option=com_clm&view=paarungsliste&saison={$sid}&liga={$lid}";
        $mainframe->redirect($link, $msg);
    }
    // Prüfen ob Datensatz schon vorhanden ist
    $access = $this->access;
    if ($access[0]->gemeldet > 0) {
        $msg = JText::_('RESULT_DATA_ALREADY_EXISTS');
        $link = "index.php?option=com_clm&view=runde&saison={$sid}&liga={$lid}&runde={$runde}&dg={$dg}";
        $mainframe->redirect($link, $msg);
    } else {
        $datum =& JFactory::getDate($liga[0]->datum);
        // Ergebnistext f�r flexibele Punktevergabe holen
        $erg_text = CLMModelMeldung::punkte_text($liga[0]->id);
        // Browsertitelzeile setzen
        $doc =& JFactory::getDocument();
        $daten['title'] = JText::_('RESULT_DATA_RESULT') . ' ' . $liga[0]->name;
        $doc->setHeadData($daten);
        ?>
<div id="clm">
<div id="meldung">
<div class="componentheading"><?php 
        echo JText::_('RESULT_DATA_RESULT');
        ?>
 </div>

<h4><?php 
        echo $liga[0]->name . ', ';
        echo JText::_('RESULT_DATA_ROUND');