itinerary.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. $http_host = $_SERVER['HTTP_HOST'];
  3. include("../../functions.php");
  4. $con = startdb();
  5. if (!checkSession($con)){
  6. header("Location: /index.php");
  7. exit (-1);
  8. }
  9. //Get activity id
  10. $id = mysqli_real_escape_string($con, $_GET['id']);
  11. $q = mysqli_query($con, "SELECT * FROM activity WHERE id = $id;");
  12. //echo "SELECT * FROM activity WHERE id = $id;";
  13. if(mysqli_num_rows($q) == 0){
  14. header("Location: $http_host/actividades/");
  15. exit (-1);
  16. }
  17. else{
  18. $r = mysqli_fetch_array($q);
  19. ?>
  20. <html>
  21. <head>
  22. <meta content="text/html; charset=windows-1252" http-equiv="content-type"/>
  23. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
  24. <title>Nueva actividad - Administracion</title>
  25. <!-- CSS files -->
  26. <link rel="stylesheet" type="text/css" href="/css/ui.css"/>
  27. <link rel="stylesheet" type="text/css" href="/css/actividades.css"/>
  28. <!-- CSS for mobile version -->
  29. <link rel="stylesheet" type="text/css" media="(max-width : 990px)" href="/css/m/ui.css"/>
  30. <link rel="stylesheet" type="text/css" media="(max-width : 990px)" href="/css/m/actividades.css"/>
  31. <!-- Script files -->
  32. <script type="text/javascript" src="script.js"></script>
  33. <script type="text/javascript" src="/script/ui.js"></script>
  34. <script src="../../ckeditor/ckeditor.js"></script>
  35. </head>
  36. <body>
  37. <?php include('../../toolbar.php'); ?>
  38. <div id='content'>
  39. <div class='section'>
  40. <h3 class="section_title">Modificar itinerario</h3>
  41. <form action='additinerary.php' method='post'>
  42. <div class="entry">
  43. <input type='hidden' name='activity' value='<?php echo $id; ?>'/>
  44. <table id='itinerary'>
  45. <?php
  46. $q_place = mysqli_query($con, "SELECT id, name_es FROM place ORDER BY name_es;");
  47. $i = 0;
  48. for ($i = 0; $i < 50; $i ++){
  49. echo "<tr id='itinerary_row_$i' class='itinerary_row'>\n";
  50. echo "<td class='itinerary_cell time'>\n";
  51. echo "<h4>Hora y lugar</h4>\n";
  52. echo "Inicio*:&nbsp<input type='number' maxlength='2' name='sh_$i' id='sh_$i' onChange='showNextRow($i);'/>:<input type='number' maxlength='2' name='sm_$i' id='sm_$i' onChange='showNextRow($i);'/>\n";
  53. echo "<br/>Final:&nbsp<input type='number' maxlength='2' name='eh_$i' id='eh_$i' onChange='showNextRow($i);'/>:<input type='number' maxlength='2' name='em_$i' id='em_$i' onChange='showNextRow($i);'/>\n";
  54. echo "<br/><br/>\n";
  55. echo "Lugar*: <select name='place_$i' id='place_$i' onChange='showNextRow($i);'>\n";
  56. echo "<option value='-1'>SELECCIONA</option>\n";
  57. mysqli_data_seek($q_place, 0);
  58. while ($r_place = mysqli_fetch_array($q_place)){
  59. echo "<option value='$r_place[id]'>$r_place[name_es]</option>\n";
  60. }
  61. echo "</select><br/>\n";
  62. echo "<span id='add_place' class='pointer' onClick='addPlace($i);'>A&ntilde;adir nuevo lugar</span>\n";
  63. echo "</td>\n";
  64. echo "<td class='itinerary_cell itinerary_cell_content'>\n";
  65. ?>
  66. <div id='lang_tabs'>
  67. <table>
  68. <tr>
  69. <td class="pointer lang_tabs_active" id="lang_tab_es" onclick="showLanguage('es');">
  70. Castellano
  71. </td>
  72. <td class="pointer" id="lang_tab_eu" onclick="showLanguage('eu');">
  73. Euskera
  74. </td>
  75. <td class="pointer" id="lang_tab_en" onclick="showLanguage('en');">
  76. Ingl&eacute;s
  77. </td>
  78. </tr>
  79. </table>
  80. </div>
  81. <div id="content_lang_es">
  82. <h4>T&iacute;tulo</h4>
  83. <input type='text' name='title_es_<?php echo($i); ?>' id='title_es_<?php echo($i); ?>' onKeyUp='showNextRow(<?php echo($i); ?>'/>
  84. <h4>Texto</h4>
  85. <textarea name='text_es_<?php echo($i); ?>' id='text_es_<?php echo($i); ?>' onKeyUp='showNextRow(<?php echo($i); ?>);'/></textarea>
  86. </div>
  87. <div id="content_lang_eu" style="display:none;">
  88. <h4>Titulo</h4>
  89. <input type='text' name='title_eu_<?php echo($i); ?>' id='title_eu_<?php echo($i); ?>' onKeyUp='showNextRow(<?php echo($i); ?>'/>
  90. <h4>Textua</h4>
  91. <textarea name='text_eu_<?php echo($i); ?>' id='text_eu_<?php echo($i); ?>' onKeyUp='showNextRow(<?php echo($i); ?>);'/></textarea>
  92. </div>
  93. <div id="content_lang_en" style="display:none;">
  94. <h4>Title</h4>
  95. <input type='text' name='title_en_<?php echo($i); ?>' id='title_en_<?php echo($i); ?>' onKeyUp='showNextRow(<?php echo($i); ?>'/>
  96. <h4>Content</h4>
  97. <textarea name='text_en_<?php echo($i); ?>' id='text_en_<?php echo($i); ?>' onKeyUp='showNextRow(<?php echo($i); ?>);'/></textarea>
  98. </div>
  99. <?php
  100. echo("</td>\n");
  101. echo("</tr>\n");
  102. }
  103. ?>
  104. </table>
  105. <input type='submit' id="save_itinerary" value='Guardar'/>
  106. </div> <!--Entry-->
  107. </form>
  108. </div>
  109. </body>
  110. </html>
  111. <?php } ?>