Guest User

Untitled

a guest
Aug 15th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. <input style=" width:200px; height:27px;
  2. position:absolute; left:50%;top:15%;z-index:2; margin-left:-130px; " id="monthToday" name="dateList" type="month">
  3. <script>
  4. document.getElementById('monthToday').valueAsDate = new Date();
  5. </script>
  6. <input style="margin:auto; width:40px; height:30px;
  7. position:absolute; left:50%;top:15%;z-index:2; margin-left:90px; " type="submit" value="ok">
  8.  
  9. <?php
  10.  
  11. if(isset($_POST['dateList'])){
  12. $inp_inf = $_POST['dateList'];
  13.  
  14. }else{
  15. $inp_inf = date('Y-m-d');
  16. }
  17.  
  18.  
  19. $date = new DateTime($inp_inf);
  20. $car_year = $date->format('Y') ; // 2018
  21. $car_month = $date->format('m') ; // 1-12 текущий месяц
  22.  
  23. $allcells = "<tr><td style='margin:auto;height:50px; font-weight:bold' colspan='32'align='center'>ДАТА ТАБЛИЦЫ $inp_inf </td></tr>";
  24. $tablheader = "$allcells<tr><td style='width:200px;font-weight:bold; vertical-align: top'>Имя</td>"; // построение таблицы
  25.  
  26. $i = 0;
  27. $w = "-" ;
  28. $day_w = 0 ;
  29.  
  30. while($i++ < $date->format('t')) {
  31.  
  32.  
  33. $car_data = $car_year."-".$car_month."-".$i." 01:01:01" ;
  34. $tmp_data = strtotime($car_data);
  35. $day_w = date("N",$tmp_data);
  36.  
  37. if($day_w==1) {$w = "Пн" ;}
  38. if($day_w==2) {$w = "Вт" ;}
  39. if($day_w==3) {$w = "Ср" ;}
  40. if($day_w==4) {$w = "Чт" ;}
  41. if($day_w==5) {$w = "Пт" ;}
  42. if($day_w==6) {$w = "Сб" ;}
  43. if($day_w==7) {$w = "Вс" ;}
  44.  
  45.  
  46.  
  47.  
  48. $tablheader = $tablheader."<td style='width:200px; vertical-align: top'>".$i." / ".$w."</td>" ;
  49.  
  50. }
  51.  
  52. // ЗАПИСЬ В ДВУХМЕРНОМ МАССИВЕ НАЧАЛО----------------------------------------------------------------------------------------------------------------------------
  53.  
  54. $row = 3;// количество строк
  55. $col = $i + 1;// кол. столбиков
  56. $n [0] = "Андрей";
  57. $n [1] = "Олег";
  58. $n [2] = "Володя";
  59. $n [3] = "Дима";
  60.  
  61.  
  62.  
  63.  
  64. $tablheader = $tablheader."</tr>";
  65. echo $tablheader;
  66.  
  67. ?>
Add Comment
Please, Sign In to add comment