Subversion-Projekte lars-tiefland.niewerth

Revision

Revision 31 | Revision 33 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php
        //Kalender generieren
        function calendar($an_id, $f_id, $y=0, $m=0)
        {
                if ($y===0)
                {
                        $y=date("Y");
                }
                if ($m===0)
                {
                        $m=date("n");
                }
                $t_date=date("d.m.Y");
                var_dump($t_date);
                global $smarty;
                $smarty->assign("title","Termine Schritt 2 - Kalender");
                setLocale(LC_ALL,"de_DE");
                $mode=(isset($_GET["mode"]))?$_GET["mode"]:"";
                $smarty->assign("mode",$mode);
                $Month = new Calendar_Month_Weeks($y, $m);
                $m_d=new Calendar_Decorator_Textual($Month);
                $u_d=new Calendar_Decorator_Uri($Month);
                $u_d->setFragments("jahr", "monat", "tag");
                $Month->build();
                
                $cal="<table>";
                $cal.="<tr><th colspan=8>
                <form action=termine.php>
                        <input type='hidden' name='mode' value='calendar'>
                        <input type='hidden' name='an_id' value='$an_id'>
                        <input type='hidden' name='f_id' value='$f_id'>
                        <input type='hidden' name='monat' value='$m'>
                        <input type='hidden' name='jahr' value='".$u_d->prevYear()."'>
                        <input class='liteoption' type='submit' value='<<'>
                </form>
                
                <form action=termine.php>
                        <input type='hidden' name='mode' value='calendar'>
                        <input type='hidden' name='an_id' value='$an_id'>
                        <input type='hidden' name='f_id' value='$f_id'>
                        <input type='hidden' name='monat' value='".$u_d->prevMonth()."'>
                        <input type='hidden' name='jahr' value='".(($m==1)?$u_d->prevYear():$y)."'>
                        <input class='liteoption' type='submit' value='<'>
                </form>
                &nbsp;&nbsp;".$m_d->thisMonthName()." ".$y."&nbsp;&nbsp;
                <form action=termine.php>
                        <input type='hidden' name='mode' value='calendar'>
                        <input type='hidden' name='an_id' value='$an_id'>
                        <input type='hidden' name='f_id' value='$f_id'>
                        <input type='hidden' name='monat' value='".$u_d->nextMonth()."'>
                        <input type='hidden' name='jahr' value='".(($m==12)?$u_d->nextYear():$y)."'>
                        <input class='liteoption' type='submit' value='>'>
                </form>
                
                <form action=termine.php>
                        <input type='hidden' name='mode' value='calendar'>
                        <input type='hidden' name='an_id' value='$an_id'>
                        <input type='hidden' name='f_id' value='$f_id'>
                        <input type='hidden' name='monat' value='$m'>
                        <input type='hidden' name='jahr' value='".$u_d->nextYear()."'>
                        <input class='liteoption' type='submit' value='>>'>
                </form>
                </th></tr>";
                $tage=Calendar_Decorator_Textual::weekdayNames();
                $cal.="<tr><th>KW#</th>";
                for ($tag=1; $tag < 8; $tag++)
                {
                        $cal.="<th>".$tage[$tag %7]."</th>";
                }
                $cal.="</tr>";
                while ($Week = $Month->fetch()) 
                {
                        $kw=$Week->thisWeek('n_in_year');
                        $Week->build();
                        $cal.="<tr><td>$kw</td>";
                        while ($Day = $Week->fetch())
                        {
                                if ($Day->isEmpty()) 
                                {
                                        $cal.="<td>&nbsp;</td>";
                                }
                                else
                                {
                                        if($Day->thisDay().".$m.$y"==$today_date)
                                        {
                                                $cal.="<td class='cal-today'>";
                                        }
                                        else
                                        {
                                                $cal.="<td>";
                                        }
                                        $cal.="<a href='termine.php?mode=end&amp;an_id=$an_id&amp;f_id=$f_id&amp;jahr=".$Month->thisYear()."&amp;monat=".$Month->thisMonth()."&amp;tag=".$Day->thisDay()."'>".$Day->thisDay()."</a></td>";
                                }

                                if ($Day->isLast()) 
                                {
                                        $cal.="</tr>";
                                }
                        }
                }

                $cal.="</table>";
                $smarty->assign("cal",$cal);
                $smarty->display("calendar.tpl");
        }
?>