PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/lmo-kocal.php

https://bitbucket.org/creativepioneers/lmo
PHP | 167 lines | 133 code | 12 blank | 22 comment | 52 complexity | f7d0df85a7868266c7d5136d39962cef MD5 | raw file
Possible License(s): GPL-2.0
  1. <?
  2. /** Liga Manager Online 4
  3. *
  4. * http://lmo.sourceforge.net/
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * REMOVING OR CHANGING THE COPYRIGHT NOTICES IS NOT ALLOWED!
  17. *
  18. */
  19. if ($file != "") {
  20. $addk = $_SERVER['PHP_SELF']."?action=cal&amp;file=".$file."&amp;cal=";
  21. $addr = $_SERVER['PHP_SELF']."?action=results&amp;file=".$file."&amp;st=";
  22. $me = array("0", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  23. $mb = strftime("%m%Y", strtotime("now"));
  24. $cal=isset($_GET['cal'])?$_GET['cal']:null;
  25. //Anzeigezeitraum festlegen
  26. if (isset($cal)) { //Zeitraum vorgegeben
  27. if (strlen($cal) > 4) {
  28. $lmo_month_prev = strtotime("1 ".$me[intval(substr($cal, 0, 2))]." ".substr($cal, 2)." -1 month");
  29. $lmo_month_this = strtotime("1 ".$me[intval(substr($cal, 0, 2))]." ".substr($cal, 2));
  30. $lmo_month_next = strtotime("1 ".$me[intval(substr($cal, 0, 2))]." ".substr($cal, 2)." +1 month");
  31. } else {
  32. $lmo_month_prev = strtotime("1 ".$me[1]." ".substr($cal, 2)." -1 year");
  33. $lmo_month_this = strtotime("1 ".$me[1]." ".substr($cal, 2));
  34. $lmo_month_next = strtotime("1 ".$me[1]." ".substr($cal, 2)." +1 year");
  35. }
  36. } else {
  37. $lmo_termine = array();
  38. for($n = 0; $n < $modus[$st-1]; $n++) {
  39. $lmo_termine=array_filter($mterm[$st-1][$n],"filterZero"); //Nullwerte filtern
  40. }
  41. if (!empty($lmo_termine)) {
  42. $datum = explode('.', strftime("%d.%m.%Y",min($lmo_termine)));
  43. $lmo_month_prev = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]." -1 month");
  44. $lmo_month_this = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]);
  45. $lmo_month_next = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]." +1 month");
  46. } else {
  47. $lmo_month_prev = strtotime("-1 month");
  48. $lmo_month_this = strtotime("now");
  49. $lmo_month_next = strtotime("+1 month");
  50. }
  51. }
  52. //Datenformate generieren
  53. if ($lmo_month_this != -1) {
  54. if (!isset($cal)) {
  55. $cal = strftime("%m%Y", $lmo_month_this);
  56. }
  57. if (strlen($cal) > 4) { //Monatsanzeige
  58. $ma = strftime("%m%Y", $lmo_month_prev);
  59. $mc = strftime("%m%Y", $lmo_month_next);
  60. $md = strftime("%B %Y", $lmo_month_this);
  61. $ml = strftime("%Y", $lmo_month_this);
  62. $mj = " ".$me[intval(strftime("%m", $lmo_month_this))]." ".strftime("%Y", $lmo_month_this);
  63. $dat1 = getdate(strtotime("1".$mj));
  64. $erster = $dat1['wday'];
  65. } else { //Jahresanzeige
  66. $ma = strftime("%Y", $lmo_month_prev);
  67. $mc = strftime("%Y", $lmo_month_next);
  68. $md = strftime("%Y", $lmo_month_this);
  69. $mj = " ".strftime("%Y", $lmo_month_this);
  70. }
  71. }
  72. if (strlen($cal) > 4) { //Monatsanzeige
  73. $lmo_arrays=32;
  74. $lmo_daterule="%B %Y";
  75. $lmo_daterule2="%d";
  76. } else { //Jahresanzeige
  77. $lmo_arrays=13;
  78. $lmo_daterule="%Y";
  79. $lmo_daterule2="%m";
  80. }
  81. $lmo_stlink = array_pad(array(), $lmo_arrays, '');
  82. for($j = 0; $j < $anzst; $j++) {
  83. $lmo_stlink_title = array_pad(array(), $lmo_arrays, '');
  84. //Bezeichnungen generieren
  85. $anzsp = $anzteams/2;
  86. if ($j == $anzst-1) {
  87. $text2 = $text[364];
  88. $text1 = $text[374];
  89. } elseif($j == $anzst-2) {
  90. $text2 = $text[362];
  91. $text1 = $text[373];
  92. } elseif($j == $anzst-3) {
  93. $text2 = $text[360];
  94. $text1 = $text[372];
  95. } elseif($j == $anzst-4) {
  96. $text2 = $text[358];
  97. $text1 = $text[371];
  98. } else {
  99. $text1 = ($j+1).". ".$text[370];
  100. $text2 = ($j+1).". ".$text[376];
  101. }
  102. for($i = 0; $i < $anzsp; $i++) {
  103. for($n = 0; $n < $modus[$j]; $n++) {
  104. if (!empty($mterm[$j][$i][$n]) && strftime($lmo_daterule, $mterm[$j][$i][$n]) == $md) { //konkretes Spieldatum vorhanden
  105. $a = intval(strftime($lmo_daterule2, $mterm[$j][$i][$n]));
  106. if (($teama[$j][$i] != 0) && ($teamb[$j][$i] != 0)) {
  107. if (!empty($lmo_stlink_title[$a])) {
  108. $lmo_stlink_title[$a] = $lmo_stlink_title[$a].", &#10;";
  109. } else {
  110. $lmo_stlink_title[$a] = $text1.": &#10;";
  111. }
  112. $lmo_stlink_title[$a] = $lmo_stlink_title[$a].$teams[$teama[$j][$i]]." - ".$teams[$teamb[$j][$i]];
  113. if ($modus[$j] > 1) {
  114. $lmo_stlink_title[$a] = $lmo_stlink_title[$a]." &#10;(".($n+1).". ".$text[375].")";
  115. }
  116. }
  117. }
  118. }
  119. }
  120. //Spieltagsdatum
  121. if (!empty($datum1[$j])) {
  122. $datum = explode('.', $datum1[$j]);
  123. $lmo_stdatum1 = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]);
  124. } else {
  125. $lmo_stdatum1 = '';
  126. }
  127. if (!empty($datum2[$j])) {
  128. $datum = explode('.', $datum2[$j]);
  129. $lmo_stdatum2 = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]);
  130. } else {
  131. $lmo_stdatum2 = '';
  132. }
  133. $z=array_filter($lmo_stlink_title,"filterZero");
  134. if (!empty($lmo_stdatum1) && empty($z) && strftime($lmo_daterule, $lmo_stdatum1) == $md) { //Nur Von... vorhanden
  135. $a = intval(strftime($lmo_daterule2, $lmo_stdatum1));
  136. $lmo_stlink_title[$a] = ($j+1).". ".$text[2]." &#10;(".$text[155].")";
  137. if (!empty($lmo_stdatum2) && $lmo_stdatum2>$lmo_stdatum1) { //Von ... bis ... vorhanden
  138. for($k = $a; $k <= intval(strftime($lmo_daterule2, $lmo_stdatum2)); $k++) {
  139. $lmo_stlink_title[$k] = ($j+1).". ".$text[2]." &#10;(".$text[155].")";
  140. }
  141. }
  142. }
  143. if (!empty($lmo_stdatum2) && empty($z) && strftime($lmo_daterule, $lmo_stdatum2) == $md) { //Nur ...Bis vorhanden
  144. $a = intval(strftime($lmo_daterule2, $lmo_stdatum2));
  145. $lmo_stlink_title[$a] = ($j+1).". ".$text[2]." &#10;(".$text[155].")";
  146. }
  147. //Links generieren
  148. for($i = 0; $i < count($lmo_stlink_title); $i++) {
  149. if (!empty($lmo_stlink_title[$i])) {
  150. $lmo_stlink[$i] = $lmo_stlink[$i]."&nbsp;&nbsp;<a href=\"".$addr.($j+1)."\" title=\"".$lmo_stlink_title[$i]."\">".($j+1).". ".$text[145]."</a><br>";;
  151. }
  152. }
  153. } //for $anzst
  154. include(PATH_TO_LMO."/lmo-showcal.php");
  155. }?>