Public Member Functions | |
| ilMiniCal () | |
| show ($month, $year) | |
Data Fields | |
| $ilias | |
| $tpl | |
| $lng | |
| $cal_month | |
| $cal_year | |
| $cal | |
Definition at line 39 of file class.ilMiniCal.php.
| ilMiniCal::ilMiniCal | ( | ) |
| ilMiniCal::show | ( | $ | month, | |
| $ | year | |||
| ) |
Definition at line 63 of file class.ilMiniCal.php.
References $_GET, $cal, $cal_month, $cal_year, $counter, and $x.
{
$cal_month = $month;
$cal_year = $year;
$cal_day = date(j);
$lastday = strftime("%d", mktime (0,0,0,$cal_month,0,$cal_year)); // was last month's last day the 30rd, 31st, ...?
$firstday = strftime ("%u", mktime(0,0,0,$cal_month,1,$cal_year)) - 2; // which day is this month's first day ? (Monday,...)
$startday = $lastday - $firstday;
if ($lastday != 31 || $cal_month == "8" || $cal_month == "1")
{
$days_in_month = 31; // decide how many days the actual month has
}
else
{
if ($cal_month != 02)
{
$days_in_month = 30;
}
else
{
if ($cal_year % 4 == 0)
{
$days_in_month = 29; // decide we're about to display a leap year and need to adjust the number of days
}
else
{
$days_in_month = 28;
}
}
}
$next = $cal_year + 1;
$last = $cal_year - 1;
$next_ts = mktime (0,0,0,$cal_month,1,$next); // timestamps for displaying day views for next and last year button
$last_ts = mktime (0,0,0,$cal_month,1,$last);
// beginning of html-code for table
$cal = "<table tableborder='1' rules='none' frame='box' bgcolor='#FFFFFF' style='margin-right: 10px;'><tr><td><a href=\"dateplaner.php?app=".$_GET["app"]."&month=$cal_month&year=$last×tamp=$last_ts\"> < </a></td> <td align=\"center\" colspan=\"6\">".$this->lng->txt("short_".$cal_month)." $cal_year </td><td> <a href=\"dateplaner.php?app=".$_GET["app"]."&month=$cal_month&year=$next×tamp=$next_ts\"> > </a> </td></tr>\n";
$cal = $cal."<tr><td></td>";
for($i = 1; $i <= 12; $i++)
{
if ($i <= 9)
{
$tmp = "0".$i; // standardizes content of $tmp to two digits representing months
}
else
{
$tmp = $i;
}
$ts = mktime (0,0,0,$tmp,1,$cal_year); // create timestamps to enable dayviews for months in actual year
$cal = $cal."<td><a href=\"dateplaner.php?app=".$_GET["app"]."&month=".$tmp."&year=".$cal_year."×tamp=".$ts."\">".$this->lng->txt("short_".$tmp)."</td>";
if ($i == 6) $cal = $cal."<td></td></tr> \n <tr><td></td>";
}
$cal = $cal."<td></td></tr> \n ";
// html code for displaying days of week using ilias lng-module
$cal = $cal."<tr bgcolor='#AAAAAA'><td >".$this->lng->txt("wk_short")."</td><td>".$this->lng->txt("Mo_short")."</td><td>".$this->lng->txt("Tu_short")."</td><td>".$this->lng->txt("We_short")."</td>";
$cal = $cal."<td>".$this->lng->txt("Th_short")."</td><td>".$this->lng->txt("Fr_short")."</td><td>".$this->lng->txt("Sa_short")."</td><td>".$this->lng->txt("Su_short")."</td></tr>";
$kw = strftime ("%V", mktime(0,0,0,$cal_month,1,$cal_year)); // get actual number of week to start with
$counter = 1; // general counter; calendar will always dislpay 42 days
$day = 1; // variable needed for displaying first week, if first week is split into different month
$ts_week = mktime (0,0,0,$cal_month,1,$cal_year); // timestamp that contains the week and is updated every loop inside brackets
// loop to generate html-code for actual weeks and days in month
for ($x = 1; $x <= 6; $x++)
{
$cal = $cal. " <tr><td bgcolor='#AAAAAA'><a href=\"dateplaner.php?app=week&month=".$cal_month."&year=".$cal_year."×tamp=".$ts_week."\">$kw</td> ";
$ts_week = strtotime ("+1 week", $ts_week );
if ($x == 1)
{
$tmp = $startday;
while ($tmp <= $lastday)
{
$cal = $cal." <td> $tmp</td> "; // displays days in old month if first day in month isn't Monday
$tmp++;
$counter++;
}
$empty_string ="";
while ($counter <=7)
{
$ts_day = mktime (0,0,0, $cal_month, $day, $cal_year); // timestamps to display different day views
if ($day == $cal_day&& $cal_month == date (m) && $cal_year == date (Y)) $empty_string = " bgcolor='FF8000'";
// html-code for table entry and according link
$cal = $cal." <td ".$empty_string."><a href=\"dateplaner.php?app=day&month=".$cal_month."&year=".$cal_year."×tamp=".$ts_day."\">$day</a></td> ";
$day++;
$tmp++;
$counter++;
$empty_string ="";
}
if ($kw >= 52 ) $kw = 0; // adjusts week numbers if you display january or december
$day = 1; // resets variable...
}
else
{
for ($c = 7 - $firstday + ($x-2) * 7; $c <= 6 - $firstday + ($x-1) *7 && $counter <= 42; $c++) // c represents the actual day in month
{
if ($c <= $days_in_month)
{
$ts_day = mktime (0,0,0, $cal_month, $c, $cal_year); // timestamps to display different day views
if ($c == $cal_day && $cal_month == date (m) && $cal_year == date (Y)) $empty_string = " bgcolor='FF8000'";
// html-code for table entry and according link
$cal = $cal. "<td ".$empty_string."><a href=\"dateplaner.php?app=day&month=".$cal_month."&year=".$cal_year."×tamp=".$ts_day."\"> $c</a></td>";
$counter++;
$empty_string ="";
}
else // clause displays days that belong to next month
{
$cal = $cal. "<td> $day</td>";
$day++;
$counter++;
}
}
}
$cal = $cal. "</tr> \n "; // complete table row
$kw++; // update weeknumber
}
$cal = $cal." </table>"; // complete table
return $cal;
}
| ilMiniCal::$cal |
Definition at line 48 of file class.ilMiniCal.php.
Referenced by show().
| ilMiniCal::$cal_month |
Definition at line 46 of file class.ilMiniCal.php.
Referenced by show().
| ilMiniCal::$cal_year |
Definition at line 47 of file class.ilMiniCal.php.
Referenced by show().
| ilMiniCal::$ilias |
Definition at line 42 of file class.ilMiniCal.php.
Referenced by ilMiniCal().
| ilMiniCal::$lng |
Definition at line 44 of file class.ilMiniCal.php.
Referenced by ilMiniCal().
| ilMiniCal::$tpl |
Definition at line 43 of file class.ilMiniCal.php.
Referenced by ilMiniCal().
1.7.1