WackoWiki : Dev/PatchesHacks/DayScheduler

Action: DayScheduler


{{dayscheduler}}

/actions/dayscheduler.php
<?php
// This script was developed by G. Michael Bowen for a SSHRC research project using wikka wiki.
// This action complements the scheduler.php action showing the day schedule for that user.
// DaySchedule Version 1c -- Jan 6, 2005
// This action should be placed on a page called "DaySchedule" to work with the scheduler.
// Code copyright GMBowen. Released to public domain under GPL. Modify, improve, change as you wish.

$month = (!isset($_GET['month'])) ? date("n",mktime()) : $_GET['month'];   
// $monthname = $month;
$tmpd getdate(mktime(0,0,0,$month,1,$year));
$monthname $tmpd["month"];
$year = (!isset($_GET['year'])) ? date("Y",mktime()) : $_GET['year'];
$today = (!isset($_GET['day'])) ? date("d",mktime()) : $_GET['day'];
$site_base $this->GetConfigValue("base_url");
$thispage=$this->GetPageTag();
$lastday getLastDayofMonth($month,$year);

/*== get the last day of the month ==*/
function getLastDayofMonth($mon,$year)
{
  for (
$tday=28$tday <= 31$tday++)
  {
    
$tdate getdate(mktime(0,0,0,$mon,$tday,$year));
    if (
$tdate["mon"] != $mon) break;
  }
$tday--;
return 
$tday;
}

// gets username
$username $this->GetUserName();
$user $username;

$dayschedule $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$today."' AND month='".$month."' AND year='".$year."'");
$printout str_replace("\n""<HR></TD></TR><TR ALIGN='left'><TD>"$dayschedule[dayschedule]);   
$printowner $username."'s Termine und Aufgaben f&uuml;r ";
?>
<div align="center">
<center>      <a href="<?php echo $this->href("""""day="); echo (($today-1)<1) ? $lastday $today-?>&amp;year=<?php echo $year?>&amp;month=<?php echo $month?>">&lt;&lt;</a>
        <b><? echo "$printowner$monthname $today, $year:"?></b>
        <a href="<?php echo $this->href("""""day="); echo (($today+1)>$lastday) ? $today+?>&amp;year=<?php echo $year?>&amp;month=<?php echo $month?>">&gt;&gt;</a>

<TABLE class='box' width='600' border='1' CELLSPACING='1' CELLPADDING='7' BGCOLOR='#DDccbb'>
   <TR>
      <TD>
<P><TABLE class='box' width='100%' border='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#ffffff'>
   <TR ALIGN='left'>
      <TD>
         <P>
<?
if ($user $this->GetUser())
{
    if(!empty(
$printout))
        {
        echo 
$printout;
        }
        else
        {
        echo 
"There are no entries on this day.";
        }
}
else
{
echo 
"<em>Der Kalender funktioniert nur bei angemeldeten Nutzern.</em>";
}
?>
</P>
      </TD>
   </TR>
</TABLE>
      </TD>
   </TR>
</TABLE>
<center><a href=<? echo $site_base?>ScheDuler&amp;<? echo "month=".$month."&amp;day=".$today."&amp;year=".$year?>><small>Monats&uuml;bersicht</small></a>
&nbsp;|&nbsp;
<a href=<? echo $site_base?>MonthSchedule&amp;<? echo "month=".$month."&amp;day=".$today."&amp;year=".$year?>><small>Monatskalender</small></a></center>
</center></div>

To Do