/admin/index.php

https://github.com/MrMEEE/dommerbord · PHP · 142 lines · 106 code · 31 blank · 5 comment · 10 complexity · c3c704f003945435281e75547a9eb192 MD5 · raw file

  1. <?php
  2. if(!file_exists("connect.php")){
  3. ob_start();
  4. header( "Location: setup.php" );
  5. ob_flush();
  6. }
  7. require("config.php");
  8. require("connect.php");
  9. $config=mysql_fetch_assoc(mysql_query("SELECT * FROM config WHERE id = '1'"));
  10. if (($config['klubadresse']=="") || ($config['klubpath']=="") || ($config['klubnavn']=="")){
  11. ob_start();
  12. header( "Location: configuration.php" );
  13. ob_flush();
  14. }
  15. require_once("commonFunctions.php");
  16. require("checkConfig.php");
  17. require("checkLogin.php");
  18. require("todo.class.php");
  19. require("theme.php");
  20. if(!mysql_num_rows(mysql_query("SELECT * FROM `teams` WHERE `name` = '-'"))){
  21. mysql_query("INSERT INTO `teams` (`id`, `name`) VALUES ('9999','-')");
  22. }
  23. $viewgames="default";
  24. if(isset($_GET["view"])){
  25. $viewgames=$_GET["view"];
  26. }
  27. // Select all the todos, ordered by positions
  28. switch ($viewgames) {
  29. case "default":
  30. $query = mysql_query("SELECT * FROM `games` WHERE CURDATE() <= `date` AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  31. $query2 = mysql_query("SELECT * FROM `games` WHERE `date` = '0000-00-00' AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  32. break;
  33. case "unassigned":
  34. $query = mysql_query("SELECT * FROM `games` WHERE CURDATE() <= `date` AND `status` = 1 AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  35. $query2 = mysql_query("SELECT * FROM `games` WHERE `date` = '0000-00-00' AND `status` = 1 AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  36. break;
  37. case "moved":
  38. $query = mysql_query("SELECT * FROM `games` WHERE CURDATE() <= `date` AND `status` = 2 AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  39. $query2 = mysql_query("SELECT * FROM `games` WHERE `date` = '0000-00-00' AND `status` = 2 AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  40. break;
  41. case "cancelled":
  42. $query = mysql_query("SELECT * FROM `games` WHERE CURDATE() <= `date` AND `status` = 3 AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  43. $query2 = mysql_query("SELECT * FROM `games` WHERE `date` = '0000-00-00' AND `status` = 3 AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  44. break;
  45. case "all":
  46. $query = mysql_query("SELECT * FROM `games` WHERE `homegame`= 1 ORDER BY `date`,`time` ASC ");
  47. $query2 = mysql_query("SELECT * FROM `games` WHERE `date` = '0000-00-00' AND `homegame`= 1 ORDER BY `date`,`time` ASC ");
  48. break;
  49. }
  50. $todos = array();
  51. // Filling the $todos array with new ToDo objects:
  52. if(mysql_num_rows($query2)){
  53. while($row = mysql_fetch_assoc($query2)){
  54. $todos[] = new ToDo($row);
  55. }
  56. }
  57. if(mysql_num_rows($query)){
  58. while($row = mysql_fetch_assoc($query)){
  59. $todos[] = new ToDo($row);
  60. }
  61. }
  62. getThemeHeader();
  63. getThemeTitle("Dommerplan");
  64. require("menu.php");
  65. ?>
  66. <center><table>
  67. <tr>
  68. <td width=300>
  69. <li style="color: #80FF99;list-style: square;font-size: 22px;"><font color="000000" size="2px">Kamp med påsatte bord/dommere</font></li>
  70. </td>
  71. <td width=300>
  72. <li style="color: #FFD633;list-style: square;font-size: 22px;"><font color="000000" size="2px">Kamp der mangler bord/dommere</font></li>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td>
  77. <li style="color: #FF9980;list-style: square;font-size: 22px;"><font color="000000" size="2px">Ændret/Flyttet kamp</font></li>
  78. </td>
  79. <td>
  80. <li style="color: #1B9DE3;list-style: square;font-size: 22px;"><font color="000000" size="2px">Aflyst kamp</font></li>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td>
  85. <li style="color: #ff6501;list-style: square;font-size: 22px;"><font color="000000" size="2px">Udsat kamp</font></li>
  86. </td>
  87. <td>
  88. </td>
  89. </tr>
  90. </table>
  91. </center>
  92. <ul class="todoList">
  93. <?php
  94. // Looping and outputting the $todos array. The __toString() method
  95. // is used internally to convert the objects to strings:
  96. //ToDo::changeTeam(2,1,1);
  97. foreach($todos as $item){
  98. echo $item;
  99. }
  100. ?>
  101. </ul>
  102. </div>
  103. <!-- This div is used as the base for the confirmation jQuery UI POPUP. Hidden by CSS. -->
  104. <div id="dialog-confirm" title="Delete TODO Item?">Er du sikker at du vil slette den kamp??</div>
  105. <!-- Including our scripts -->
  106. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  107. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
  108. <script type="text/javascript" src="js/script.js"></script>
  109. <?php
  110. getThemeBottom();
  111. ?>