create_school_calendar.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. // not used??
  4. exit;
  5. require_once '../inc/global.inc.php';
  6. $allow = api_get_configuration_value('extra');
  7. if (empty($allow)) {
  8. exit;
  9. }
  10. $view = $_REQUEST['view'];
  11. Display::display_header($nameTools, "Tracking");
  12. $title = isset($_POST['title']) ? $_POST['title'] : "";
  13. $je = isset($_POST['je']) ? Security::remove_XSS($_POST['je']) : "";
  14. $me = isset($_POST['me']) ? Security::remove_XSS($_POST['me']) : "";
  15. $ye = isset($_POST['ye']) ? Security::remove_XSS($_POST['ye']) : "";
  16. foreach ($_POST as $index => $valeur) {
  17. $$index = Database::escape_string(trim($valeur));
  18. }
  19. $start_time = "$y-$m-$j";
  20. $end_time = "$ye-$me-$je";
  21. // On v�rifie si les champs sont vides
  22. if (empty($title)) {
  23. echo '<font color="red">Attention, vous avez oubliez le nom du calendrier</font>';
  24. }
  25. ?>
  26. <form action="save_school_calendar.php" method="post" name="save_cal">
  27. <table class='data_table'>
  28. <tr>
  29. <th colspan="3">
  30. <?php echo get_lang('edit_save'); ?>
  31. </th>
  32. <tr>
  33. <th><?php echo get_lang('title_calendar'); ?></th>
  34. <th><?php echo get_lang('period'); ?></th>
  35. <th><?php echo get_lang('action'); ?></th>
  36. </tr>
  37. <td>
  38. <input type=texte name=title value=<?php echo "$title"; ?>/>
  39. </td>
  40. <td>
  41. <input SIZE=25 NAME=period
  42. value=<?php echo "$langFrom", ":", "$start_time", "$langTo", "$end_time"; ?>/>
  43. </td>
  44. <?php
  45. $date1 = strtotime($start_time); //Premiere date
  46. $date2 = strtotime($end_time); //Deuxieme date
  47. $nbjour = ($date2 - $date1) / 60 / 60 / 24; //Nombre de jours entre les deux
  48. $nbcol = 2;
  49. echo "<table border='1'><tr>";
  50. if ($i % $nbcol == 0) {
  51. for ($i = 0; $i <= $nbjour; $i++) {
  52. echo "<td><input type='text' NAME='date_case' size='8' value=".date('Y-m-d', $date1)."> ";
  53. $date1 += 60 * 60 * 24; //On additionne d'un jour (en seconde)
  54. echo '<br>';
  55. echo '</td>';
  56. echo "<td><input type='text' NAME='day_number' size='4' value=".$number."/></td>";
  57. echo "<td><input type='text' NAME='d_title' size='4' value=".$title."/></td>";
  58. $sql4 = "INSERT INTO set_module (cal_name,cal_day_num,cal_date)
  59. VALUES ('$title','$number','".date('Y-m-d', $date1)."') ";
  60. Database::query($sql4);
  61. if ($i % $nbcol == ($nbcol - 1)) {
  62. echo "</tr>";
  63. }
  64. }
  65. }
  66. ?>
  67. </tr>
  68. <input type="submit" value="Sauvegarder" name="B1">
  69. </table>
  70. </form>
  71. <?php
  72. Display::display_footer();