Czesc,
Przystapilem do budowy systemu rezerwacji (dla praktyki ofkors)bazujacym na kalendarzu. Znalazlem info nt. budowy kalendarza i przykladowe skrypty. Przerobilem jeden i nie rozumiem ostatniej liniki dlatego prosilbym Sz. kolegow o wyjasnienie. Pytania obok skryptu w "//".
<!DOCTYPE html>
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content=""> <meta name="author" content="Jakub">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
<link rel="shortcut icon" href="/favicon.ico"> <link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="stylesheet" href="stylowy.php" media="screen">
<?php
$headings = array('Pon','Wtr','Srd','Czw','Piat','sob','Nd');
$calendar = '<table border="1" style="width:100%"><tr><td>'.implode('
</td><td>', $headings).'
</td></tr>';
$days_in_the_week = 1;
$niekatywne = array('niekatywne');
$running_day = date('w',mktime(0,0,0,1,1,2016));// Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
$days_in_a_month = date('t',mktime(0,0,0,1,0,2016)); //t -> number of days in a given month
$day_counter=0;
$days_in_the_week= 1;
########################################################### nieaktywne od poczatku miesiaca ###################################################
for ($i=0; $i < $running_day ; $i++) {
$calendar.= '<td class="nieaktywne"></td>';
$days_in_the_week ++;
}
############################################################# pozostale ##################################################
for ($list_day=1; $list_day <= $days_in_a_month ; $list_day++) {
$calendar.='<td class="aktywne">';
$calendar.=$list_day;
if($running_day == 6):
if(($day_counter+1) != $days_in_a_month):
$calendar.= '
<tr class="calendar-row">';
endif;
$running_day = -1;
$days_in_this_week = 0;
endif;
$days_in_the_week++; $running_day++; $day_counter++;
}
echo $calendar;
echo $days_in_a_month;
?>
Co sprawia mi problem to:
for ($list_day=1; $list_day <= $days_in_a_month ; $list_day++) {
$calendar.='<td class="aktywne">';
$calendar.=$list_day;
$calendar.='</td>';
############################ prosilbym o wyltumaczenie ponizszego ###########################
if($running_day == 6):
$calendar.= '</tr>'; // do tego momentu jest logiczne :]
if(($day_counter+1
) != $days_in_a_month): // czyli jezeli wynik day_counter bedzie wiekszy niz $days_in_a_month to wtedy ponizsze nie bedzie wykonane?
$calendar.= '<tr class="calendar-row">';
endif;
$running_day = -1; // Rozujmiem, ze to koresponduje z ponizszymi post-inkrementacjami.
$days_in_this_week = 0;
endif;
$days_in_the_week++; $running_day++; $day_counter++;
}]
Ten post edytował JakubBab 4.12.2015, 17:10:20