PageRenderTime 35ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/tournament2/disqualify.php

http://lansuite.googlecode.com/
PHP | 74 lines | 2 code | 0 blank | 72 comment | 0 complexity | a0ecb4f0745a73f082f92b4a12d49e34 MD5 | raw file
Possible License(s): LGPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /* // Disquallifiy droped, due to errors
  3. $teamid = $_GET["teamid"];
  4. include_once("modules/mail/class_mail.php");
  5. $mail = new mail();
  6. $team = $db->qry_first("SELECT teams.name, t.name AS t_name, teams.leaderid, teams.tournamentid
  7. FROM %prefix%t2_teams AS teams
  8. LEFT JOIN %prefix%tournament_tournaments AS t ON t.tournamentid = teams.tournamentid
  9. WHERE (teams.teamid = %int%)
  10. ", $teamid);
  11. if (!$team['tournamentid']) $func->error(t('Das ausgewählte Turnier existiert nicht'));
  12. else switch ($_GET["step"]){
  13. // Disqualify-Question
  14. default:
  15. $func->question(str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t('Soll das Team \'%NAME%\' wirklich im Turnier \'%T%\' disqualifiziert werden?HTML_NEWLINEDiese Aktion kann nicht mehr rückgängig gemacht werden!'))), "index.php?mod=tournament2&action=disqualify&step=2&teamid=$teamid");
  16. break;
  17. // Disqualify
  18. case 2:
  19. $db->qry("UPDATE %prefix%t2_teams SET disqualified='1' WHERE (teamid = %int%)", $teamid);
  20. include_once("modules/tournament2/class_tournament.php");
  21. $tfunc = new tfunc;
  22. $team2['teamid'] = 1;
  23. while ($team2['teamid']){
  24. $team2 = $db->qry_first("SELECT games1.gameid AS gid1, games2.gameid AS gid2, teams1.teamid
  25. FROM %prefix%t2_games AS games1
  26. INNER JOIN %prefix%t2_games AS games2 ON (games1.round = games2.round) AND ((games1.position + 1) = games2.position) AND (games1.tournamentid = games2.tournamentid)
  27. LEFT JOIN %prefix%t2_teams AS teams1 ON (games1.leaderid = teams1.leaderid) AND (games1.tournamentid = teams1.tournamentid)
  28. LEFT JOIN %prefix%t2_teams AS teams2 ON (games2.leaderid = teams2.leaderid) AND (games2.tournamentid = teams2.tournamentid)
  29. WHERE ((games1.position / 2) = FLOOR(games1.position / 2))
  30. AND (games1.score = 0) AND (games2.score = 0)
  31. AND ((teams1.teamid = %int%) OR (teams2.teamid = %int%))
  32. ", $teamid, $teamid);
  33. if ($team2['teamid']){
  34. // Set score to default win for opponent
  35. if ($cfg["t_default_win"] == 0) $cfg["t_default_win"] = 2;
  36. if ($team2['teamid'] == $teamid) {
  37. $score1 = 0;
  38. $score2 = $cfg["t_default_win"];
  39. } else {
  40. $score1 = $cfg["t_default_win"];
  41. $score2 = 0;
  42. }
  43. $tfunc->SubmitResult($team['tournamentid'], $team2['gid1'], $team2['gid2'], $score1, $score2, addslashes(str_replace("%NAME%", $team['name'], t('Defaultwin. Team \'%NAME%\' wurde Disqualifiziert.'))));
  44. }
  45. }
  46. $func->log_event(str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t('Das Team \'%NAME%\' wurde im Turnier \'%T%\' disqualifiziert'))), 1, t('Turnier Teamverwaltung'));
  47. $mail->create_sys_mail($team['leaderid'], str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t_no_html('Dein Team \'%NAME%\' wurde im Turnier \'%T%\' disqualifiziert'))), str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t_no_html('Ein Admin hat soeben dein Team \'%NAME%\' im Turnier \'%T%\' disqualifiziert. Damit nimmst du nicht mehr teil.'))));
  48. $func->confirmation(str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t('Das Team \'%NAME%\' wurde erfolgreich im Turnier \'%T%\' disqualifiziert'))), "index.php?mod=tournament2");
  49. break;
  50. // Un-Disqualify
  51. case 10:
  52. $db->qry("UPDATE %prefix%t2_teams SET disqualified='0' WHERE (teamid = %int%)", $teamid);
  53. $func->log_event(str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t('Die Disqualifikation des Teams \'%NAME%\' im Turnier \'%T%\' wurde zurückgenommen'))), 1, t('Turnier Teamverwaltung'));
  54. $mail->create_sys_mail($team['leaderid'], str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t_no_html('Die Disqualifikation deines Teams \'%NAME%\' wurde zurückgenommen'))), str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t_no_html('Ein Admin hat gerade die Disqualifikation deines Teams \'%NAME%\' im Turnier \'%T%\' zurückgenommen. Kannst du wieder am Turnier teilnehmen.'))));
  55. $func->confirmation(str_replace("%NAME%", $team['name'], str_replace("%T%", $team['t_name'], t('Die Disqualifikation des Teams \'%NAME%\' im Turnier \'%T%\' wurde erfolgreich zurückgenommen. Achte darauf, dass alle Ergebnise, die durch die Disqualifizierung automatisch eingetragen wurden, immernoch eingetragen sind. Um diese zu korrigieren, kannst du die betreffenden Spiele einfach mit neuen Ergebnisen überschreiben.'))), "index.php?mod=tournament2");
  56. break;
  57. }
  58. */
  59. ?>