Subversion-Projekte lars-tiefland.niewerth

Revision

Revision 25 | Revision 35 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php
        require("include/common.php");
        $smarty->assign("title","Wochenübersicht");
        $d=intval(isset($_GET["tag"])?$_GET["tag"]:date("d"));
        $m=intval(isset($_GET["monat"])?$_GET["monat"]:date("m"));
        $y=intval(isset($_GET["jahr"])?$_GET["jahr"]:date("Y"));
        $w=new Calendar_Week($y,$m,$d);
        $w->build();
        setLocale(LC_ALL,"de_DE");
        $mode=(isset($_GET["mode"]))?$_GET["mode"]:"";
        $smarty->assign("mode",$mode);
        $Month = new Calendar_Month_Weekdays($y, $m);
        $m_d=new Calendar_Decorator_Textual($Month);
        $u_d=new Calendar_Decorator_Uri($w);
        $u_d->setFragments("jahr", "monat", "tag");
        $nw=$w->nextWeek('array');
        $pw=$w->prevWeek('array');
        $cal="<table>";
        $cal.="<tr><th colspan=8>
        <form action=wochen.php>
                <input type='hidden' name='tag' value='$d'>
                <input type='hidden' name='monat' value='$m'>
                <input type='hidden' name='jahr' value='".$u_d->prevYear()."'>
                <input class='liteoption' type='submit' value='<<<' title='Ein Jahr zurück'>
        </form>
        
        <form action=wochen.php>
                <input type='hidden' name='tag' value='$d'>
                <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='<<' title='Einen Monat zurück'>
        </form>
        
        <form action=wochen.php>
                <input type='hidden' name='tag' value='".$pw["day"]."'>
                <input type='hidden' name='monat' value='".$pw["month"]."'>
                <input type='hidden' name='jahr' value='".$pw["year"]."'>
                <input class='liteoption' type='submit' value='<' title='Eine Woche zurück'>
        </form>

        &nbsp;&nbsp;".$m_d->thisMonthName()." ".$y."&nbsp;&nbsp;
        <form action=wochen.php>
                <input type='hidden' name='tag' value='".$nw["day"]."'>
                <input type='hidden' name='monat' value='".$nw["month"]."'>
                <input type='hidden' name='jahr' value='".$nw["year"]."'>
                <input class='liteoption' type='submit' value='>' title='Eine Woche vor'>
        </form>

        <form action=wochen.php>
                <input type='hidden' name='tag' value='$d'>
                <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='>>' title='Einen Monat vor'>
        </form>
                
        <form action=wochen.php>
                <input type='hidden' name='tag' value='$d'>
                <input type='hidden' name='monat' value='$m'>
                <input type='hidden' name='jahr' value='".$u_d->nextYear()."'>
                <input class='liteoption' type='submit' value='>>>' title='Ein Jahr vor'>
        </form>
        
        </th></tr>";
        $tage=Calendar_Decorator_Textual::weekdayNames();
        $cal.="<tr><th>KW#</th>";
        $kw=$w->thisWeek('n_in_year');
        for ($tag=1; $tag < 8; $tag++)
        {
                $cal.="<th>".$tage[$tag %7]."</th>";
        }
        $cal.="</tr><tr><td width='10'>$kw</td>";
        while ($Day = $w->fetch()) 
        {
                        if ($Day->isEmpty()) 
                        {
                                $cal.="<td>&nbsp;</td>";
                        }
                        else
                        {
                                $cal.='<td width="14%" valign="top"><b>'.$Day->thisDay()."</b>";
                                $termine=Termin::Liste(date("Y-m-d",mktime(0,0,0,$Day->thisMonth(),$Day->thisDay(),$Day->thisYear())));
                                if (is_array($termine))
                                {
                                        foreach ($termine as $termin)
                                        {
                                                $cal.="<br>".$termin["an"]." bei <br>" . $termin["firma"]."
                                                <form action='del.php'>
                                                        <input type='hidden' name='id' value='".$termin["t_id"]."'>
                                                        <img src='images/topic_delete.gif' ondblclick='javascript:submit(this)'>
                                                        <input type='hidden' name='tag' value='".$Day->thisDay()."'>
                                                        <input type='hidden' name='monat' value='".$Day->thisMonth()."'>
                                                        <input type='hidden' name='jahr' value='".$Day->thisYear()."'>
                                                </form>
                                                <br>";
                                        }
                                }
                                $cal.="</td>";
                        }

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

                $cal.="</table>";
                $smarty->assign("d",$d);
                $smarty->assign("m",$m);
                $smarty->assign("y",$y);
                $smarty->assign("cal",$cal);
                $smarty->display("wochen.tpl");
?>