PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/lmo-cal.php

https://bitbucket.org/creativepioneers/lmo
PHP | 142 lines | 109 code | 12 blank | 21 comment | 43 complexity | 9396177c5d38e53c3efede09e033b32b 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. $lmo_termine=array_filter($mterm[$st-1],"filterZero"); //Nullwerte filtern
  39. if (!empty($lmo_termine)) {
  40. $datum = explode('.', strftime("%d.%m.%Y",min($lmo_termine)));
  41. $lmo_month_prev = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]." -1 month");
  42. $lmo_month_this = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]);
  43. $lmo_month_next = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]." +1 month");
  44. } else {
  45. $lmo_month_prev = strtotime("-1 month");
  46. $lmo_month_this = strtotime("now");
  47. $lmo_month_next = strtotime("+1 month");
  48. }
  49. }
  50. //Datenformate generieren
  51. if ($lmo_month_this != -1) {
  52. if (!isset($cal)) {
  53. $cal = strftime("%m%Y", $lmo_month_this);
  54. }
  55. if (strlen($cal) > 4) { //Monatsanzeige
  56. $ma = strftime("%m%Y", $lmo_month_prev);
  57. $mc = strftime("%m%Y", $lmo_month_next);
  58. $md = strftime("%B %Y", $lmo_month_this);
  59. $ml = strftime("%Y", $lmo_month_this);
  60. $mj = " ".$me[intval(strftime("%m", $lmo_month_this))]." ".strftime("%Y", $lmo_month_this);
  61. $dat1 = getdate(strtotime("1".$mj));
  62. $erster = $dat1['wday'];
  63. } else { //Jahresanzeige
  64. $ma = strftime("%Y", $lmo_month_prev);
  65. $mc = strftime("%Y", $lmo_month_next);
  66. $md = strftime("%Y", $lmo_month_this);
  67. $mj = " ".strftime("%Y", $lmo_month_this);
  68. }
  69. }
  70. if (strlen($cal) > 4) { //Monatsanzeige
  71. $lmo_arrays=32;
  72. $lmo_daterule="%B %Y";
  73. $lmo_daterule2="%d";
  74. } else { //Jahresanzeige
  75. $lmo_arrays=13;
  76. $lmo_daterule="%Y";
  77. $lmo_daterule2="%m";
  78. }
  79. $lmo_stlink = array_pad(array(), $lmo_arrays, '');
  80. for($j = 0; $j < $anzst; $j++) {
  81. $lmo_stlink_title = array_pad(array(), $lmo_arrays, '');
  82. for($i = 0; $i < $anzsp; $i++) {
  83. if (!empty($mterm[$j][$i]) && strftime($lmo_daterule, $mterm[$j][$i]) == $md) { //konkretes Spieldatum vorhanden
  84. $a = intval(strftime($lmo_daterule2, $mterm[$j][$i]));
  85. if (($teama[$j][$i] != 0) && ($teamb[$j][$i] != 0)) {
  86. if (!empty($lmo_stlink_title[$a])) {
  87. $lmo_stlink_title[$a] = $lmo_stlink_title[$a].", &#10;";
  88. } else {
  89. $lmo_stlink_title[$a] = ($j+1).". ".$text[2].": &#10;";
  90. }
  91. $lmo_stlink_title[$a] = $lmo_stlink_title[$a].$teams[$teama[$j][$i]]." - ".$teams[$teamb[$j][$i]];
  92. }
  93. }
  94. }
  95. //Spieltagsdatum
  96. if (!empty($datum1[$j])) {
  97. $datum = explode('.', $datum1[$j]);
  98. $lmo_stdatum1 = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]);
  99. } else {
  100. $lmo_stdatum1 = '';
  101. }
  102. if (!empty($datum2[$j])) {
  103. $datum = explode('.', $datum2[$j]);
  104. $lmo_stdatum2 = strtotime($datum[0]." ".$me[intval($datum[1])]." ".$datum[2]);
  105. } else {
  106. $lmo_stdatum2 = '';
  107. }
  108. $z=array_filter($lmo_stlink_title,"filterZero");
  109. if (!empty($lmo_stdatum1) && empty($z) && strftime($lmo_daterule, $lmo_stdatum1) == $md) { //Nur Von... vorhanden
  110. $a = intval(strftime($lmo_daterule2, $lmo_stdatum1));
  111. $lmo_stlink_title[$a] = ($j+1).". ".$text[2]." &#10;(".$text[155].")";
  112. if (!empty($lmo_stdatum2) && $lmo_stdatum2>$lmo_stdatum1) { //Von ... bis ... vorhanden
  113. for($k = $a; $k <= intval(strftime($lmo_daterule2, $lmo_stdatum2)); $k++) {
  114. $lmo_stlink_title[$k] = ($j+1).". ".$text[2]." &#10;(".$text[155].")";
  115. }
  116. }
  117. }
  118. if (!empty($lmo_stdatum2) && empty($z) && strftime($lmo_daterule, $lmo_stdatum2) == $md) { //Nur ...Bis vorhanden
  119. $a = intval(strftime($lmo_daterule2, $lmo_stdatum2));
  120. $lmo_stlink_title[$a] = ($j+1).". ".$text[2]." &#10;(".$text[155].")";
  121. }
  122. //Links generieren
  123. for($i = 0; $i < count($lmo_stlink_title); $i++) {
  124. if (!empty($lmo_stlink_title[$i])) {
  125. $lmo_stlink[$i] = $lmo_stlink[$i]."&nbsp;&nbsp;<a href=\"".$addr.($j+1)."\" title=\"".$lmo_stlink_title[$i]."\">".($j+1).". ".$text[145]."</a><br>";;
  126. }
  127. }
  128. } //for $anzst
  129. include(PATH_TO_LMO."/lmo-showcal.php");
  130. }?>