Merhabalar,
yaptıgım takvim scriptinde eğer ayın 1 i pazara denk geliyorsa ayın 1 ini göstermiyor. Örnegin scriptte 1 mayıs gözükmüyor sizce neden olabilir?
Kodlar:
yaptıgım takvim scriptinde eğer ayın 1 i pazara denk geliyorsa ayın 1 ini göstermiyor. Örnegin scriptte 1 mayıs gözükmüyor sizce neden olabilir?
Kodlar:
PHP:
<?php
function baslangictarih($ay,$yil,$aysayisi,$tekalan,$datagunler,$gundatadizitbu,$yayindizitbu) {
if (!empty($ay))
{
$cMonth = $ay;
$cYear = $yil;
}
else
{
$cMonth = date("n");
$cYear = date("Y");
}
?>
<table>
<tr>
<?php
$monthNames = Array("Aylar","Ocak", "Subat", "Mart", "Nisan", "Mayis", "Haziran", "Temmuz", "Agustos", "Eylul", "Ekim", "Kasim", "Aralik");
for ($y = 0; $y < $aysayisi; $y++) {
?>
<td valign="top">
<table width="100%" border="0" cellpadding="2" cellspacing="2" valign="top">
<tr align="center">
<td colspan="7" bgcolor="#999999" style="color:#000000"><strong><?php echo $monthNames[$cMonth].' '.$cYear; ?></strong></td>
</tr>
<tr>
<td align="center" bgcolor="#999999" style="color:#000000"><strong>P</strong></td>
<td align="center" bgcolor="#999999" style="color:#000000"><strong>S</strong></td>
<td align="center" bgcolor="#999999" style="color:#000000"><strong>Ç</strong></td>
<td align="center" bgcolor="#999999" style="color:#000000"><strong>P</strong></td>
<td align="center" bgcolor="#999999" style="color:#000000"><strong>C</strong></td>
<td align="center" bgcolor="#999999" style="color:#000000"><strong>C</strong></td>
<td align="center" bgcolor="#999999" style="color:#000000"><strong>P</strong></td>
</tr>
<?php
//Yeni sene
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday)-1; $i++) {
if(($i % 7) == 0 ) echo "<tr>\n";
if($i < $startday-1) echo "<td></td>\n";
else
{
$tt = ($i - $startday + 2)."-".$cMonth."-".$cYear.' 00:01:00';
$tt = strtotime($tt);
if($tekalan>0) {
if(in_array($tt,$datagunler)) {
if(in_array($tt,$gundatadizitbu)) { $secim = ' checked=checked'; } else { $secim =""; }
//Temp
$kontrol=0;
$sayi = count($gundatadizitbu);
for ($zz = 0; $zz < $sayi; $zz++) {
if($yayindizitbu[$zz]['yayinlandi']==0 and $yayindizitbu[$zz]['tarih']==$tt) {$kontrol=1;}
}
if ($kontrol==1){
$arkaplan="red"; $disabled = '';} else {$arkaplan="red"; $disabled = ' disabled=disabled';}
//temp
} else { $disabled = ''; $arkaplan="green";$secim =""; }
} else {
if(in_array($tt,$gundatadizitbu)) { $secim = ' checked=checked'; } else { $secim =""; }
$arkaplan="white"; $disabled ="";$secim=$secim; }
//temp
$kontrol=0;
$sayi = count($gundatadizitbu);
for ($zz = 0; $zz < $sayi; $zz++) {
if($yayindizitbu[$zz]['yayinlandi']==1 and $yayindizitbu[$zz]['tarih']==$tt) {$kontrol=1;}
}
if ($kontrol==1){ $disabled =" disabled=disabled";}
//temp
echo "<td align='center' bgcolor=$arkaplan valign='middle' height='20px'>". ($i - $startday + 2) .'<input type="checkbox" value="'.($i - $startday + 2)."-".$cMonth."-".$cYear.'"'.$disabled.$secim.' name="tarihler[]">'."</td>\n";
if(($i % 7) == 6 ) echo "</tr>\n";
}
}
?>
</table>
</td>
<?php
$cMonth = $cMonth + 1;
//Yıl kontrol
if ($cMonth == 13 ) {
$cMonth = 1;
$cYear = $cYear + 1;
}
//Yıl kontrol
//alta in
if($y%2==0) { echo "</tr><tr>"; }
//alta in
}
?>
</tr></table>
<?php
}
?>