123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Document</title>
- @yield('styles')
- </head>
- <body>
- <?php
- $date=date("Y-m-d");
- $sd = explode("-", $date);
- $year = $sd[0];
- $month = $sd[1];
- $day = $sd[2];
-
- $dayofmonth = date('t',
- mktime(0, 0, 0, $month, 1, $year));
-
- $todate = "$year-$month-$dayofmonth";
- $fromdate = "$year-$month-01";
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $day_count = 1;
-
- $num = 0;
- for($i = 0; $i < 7; $i++)
- {
-
- $dayofweek = date('w',
- mktime(0, 0, 0, $month, $day_count, $year));
-
- $dayofweek = $dayofweek - 1;
- if($dayofweek == -1) $dayofweek = 6;
- if($dayofweek == $i)
- {
-
-
-
- $week[$num][$i] = $day_count > 9 ? $day_count : '0'.$day_count;
- $day_count++;
- }
- else
- {
- $week[$num][$i] = "";
- }
- }
-
- while(true)
- {
- $num++;
- for($i = 0; $i < 7; $i++)
- {
- $week[$num][$i] = $day_count > 9 ? $day_count : '0'.$day_count;
- $day_count++;
-
-
- if($day_count > $dayofmonth) break;
- }
-
-
- if($day_count > $dayofmonth) break;
- }
-
-
-
- echo '<table id="calendar">';
-
- $rusdays = array('ПН','ВТ','СР','ЧТ','ПТ','СБ','ВС');
- $rusmonth = array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');
- echo '<thead>
- <tr>
- <td onclick="monthf(\'prev\');"><</td>
- <td colspan="5">'.$rusmonth[$month-1].', '.$year.'</td>
- <td onclick="monthf(\'next\');">></td>
- </tr>';
- echo '<tr>';
- foreach ($rusdays as $rusday){
- echo '<td>'.$rusday.'</td>';
- }
- echo '</tr>';
- echo '</thead>';
-
- for($i = 0; $i < count($week); $i++)
- {
- echo "<tr>";
- for($j = 0; $j < 7; $j++)
- {
- if(!empty($week[$i][$j]))
- {
-
- if($week[$i][$j]==$day)
- {
- echo '<td class="today">';
- }
- else
- {
- echo '<td>';
- }
-
- echo '<a href="'.route('user.date', [$uss->id, $year.'-'.$month.'-'.$week[$i][$j]]).'">'.$week[$i][$j].'</a>';
- echo '</td>';
- }
- else echo "<td> </td>";
- }
- echo "</tr>";
- }
- ?>
- @yield('map')
- <script>
- var mon = parseInt("<?php echo $month; ?>");
- console.log('sdfsdfsdfsdf', mon);
- var year = parseInt(<?php echo $year; ?>);
- function monthf(pn){
- if (pn == 'next'){
- mon++;
- }else if (pn == 'prev'){
- mon--;
- }else{
- alert('Неправильный параметр');
- return false;
- }
- if (mon > 12){
- year ++;
- mon = 1;
- }
- if (mon < 1){
- year --;
- mon = 12;
- }
- if ((mon < 10) && (mon >= 1)){
- mon = '0'+mon;
- }
- var nextDate = year+'-'+mon+'-00';
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- </script>
- @yield('scripts')
- </body>
|