Canlendar-Tools The CanlendarTools provides utility-functions to the ILIAS-Calendar-Project like mapping weekdays for german calendars or comparing dates. More...
Public Member Functions | |
getMonth ($month) | |
getShortMonth ($month) | |
getMappedWeekday ($wday) | |
getMappedShortWeekday ($wday) | |
getWeekday ($wday) | |
getShortWeekday ($wday) | |
getNumOfDays ($month, $year) | |
getNumOfDaysTS ($timestamp) | |
getFirstWeekday ($month, $year=0) | |
getBeginningDay ($chosenDateTS) | |
addLeadingZero ($number) | |
getWeek ($ts) | |
compareTSYear ($ts1, $ts2) | |
compareTSMonth ($ts1, $ts2) | |
compareTSDate ($ts1, $ts2) | |
compareTSHour ($ts1, $ts2) | |
compareTSMinute ($ts1, $ts2) | |
getSubstr ($str, $stop=1, $appointment) | |
isNumeric ($str) | |
Data Fields | |
$months | |
$shortMonths | |
$weekdays | |
$shortWeekdays | |
$daymapping = array(7,1,2,3,4,5,6) |
Canlendar-Tools The CanlendarTools provides utility-functions to the ILIAS-Calendar-Project like mapping weekdays for german calendars or comparing dates.
version 1.0
Definition at line 16 of file class.ilCalendarTools.php.
ilCalendarTools::addLeadingZero | ( | $ | number | ) |
Definition at line 110 of file class.ilCalendarTools.php.
{ if ($number < 10) return "0".$number; else return $number; }
ilCalendarTools::compareTSDate | ( | $ | ts1, | |
$ | ts2 | |||
) |
Definition at line 140 of file class.ilCalendarTools.php.
{ $tsa1 = getdate($ts1); $tsa2 = getdate($ts2); if ( $tsa1["year"] == $tsa2["year"] && $tsa1["mon"] == $tsa2["mon"] && $tsa1["mday"] == $tsa2["mday"]) return TRUE; else return FALSE; }
ilCalendarTools::compareTSHour | ( | $ | ts1, | |
$ | ts2 | |||
) |
Definition at line 151 of file class.ilCalendarTools.php.
{ $tsa1 = getdate($ts1); $tsa2 = getdate($ts2); if ( $tsa1["year"] == $tsa2["year"] && $tsa1["mon"] == $tsa2["mon"] && $tsa1["mday"] == $tsa2["mday"] && $tsa1["hours"] == $tsa2["hours"]) return TRUE; else return FALSE; }
ilCalendarTools::compareTSMinute | ( | $ | ts1, | |
$ | ts2 | |||
) |
Definition at line 163 of file class.ilCalendarTools.php.
{ $tsa1 = getdate($ts1); $tsa2 = getdate($ts2); if ( $tsa1["year"] == $tsa2["year"] && $tsa1["mon"] == $tsa2["mon"] && $tsa1["mday"] == $tsa2["mday"] && $tsa1["hours"] == $tsa2["hours"] && $tsa1["minutes"] == $tsa2["minutes"]) return TRUE; else return FALSE; }
ilCalendarTools::compareTSMonth | ( | $ | ts1, | |
$ | ts2 | |||
) |
Definition at line 130 of file class.ilCalendarTools.php.
{ $tsa1 = getdate($ts1); $tsa2 = getdate($ts2); if ( $tsa1["year"] == $tsa2["year"] && $tsa1["mon"] == $tsa2["mon"] ) return TRUE; else return FALSE; }
ilCalendarTools::compareTSYear | ( | $ | ts1, | |
$ | ts2 | |||
) |
Definition at line 121 of file class.ilCalendarTools.php.
{ $tsa1 = getdate($ts1); $tsa2 = getdate($ts2); if ($tsa1["year"] == $tsa2["year"]) return TRUE; else return FALSE; }
ilCalendarTools::getBeginningDay | ( | $ | chosenDateTS | ) |
Definition at line 103 of file class.ilCalendarTools.php.
{ if(date("w", $chosenDateTS) == 1) return $chosenDateTS; else return strtotime("last Monday", $chosenDateTS); }
ilCalendarTools::getFirstWeekday | ( | $ | month, | |
$ | year = 0 | |||
) |
Definition at line 94 of file class.ilCalendarTools.php.
{ if ($year == 0) $year=date("Y"); $weekdayFirstDay = date("w", mktime(0,0,0,$month,1,$year)); if ($weekdayFirstDay == 0) $weekdayFirstDay = 7; return $weekdayFirstDay; }
ilCalendarTools::getMappedShortWeekday | ( | $ | wday | ) |
Definition at line 74 of file class.ilCalendarTools.php.
{
return $this->shortWeekdays[$this->daymapping[$wday]];
}
ilCalendarTools::getMappedWeekday | ( | $ | wday | ) |
Definition at line 70 of file class.ilCalendarTools.php.
{
return $this->weekdays[$this->daymapping[$wday]];
}
ilCalendarTools::getMonth | ( | $ | month | ) |
Definition at line 62 of file class.ilCalendarTools.php.
{
return $this->months[$month];
}
ilCalendarTools::getNumOfDays | ( | $ | month, | |
$ | year | |||
) |
Definition at line 86 of file class.ilCalendarTools.php.
{ return date("t", mktime(0,0,0,$month,1,$year)); }
ilCalendarTools::getNumOfDaysTS | ( | $ | timestamp | ) |
Definition at line 90 of file class.ilCalendarTools.php.
{ return date("t", $timestamp); }
ilCalendarTools::getShortMonth | ( | $ | month | ) |
Definition at line 66 of file class.ilCalendarTools.php.
{
return $this->shortMonths[$month];
}
ilCalendarTools::getShortWeekday | ( | $ | wday | ) |
Definition at line 82 of file class.ilCalendarTools.php.
{
return $this->shortWeekdays[$wday];
}
ilCalendarTools::getSubstr | ( | $ | str, | |
$ | stop = 1 , |
|||
$ | appointment | |||
) |
Definition at line 176 of file class.ilCalendarTools.php.
{ if (strlen($str) > $stop) $str = substr($str, 0, $stop-3)."..."; if (!(strpos($str, "<i>[E]</i>") === false) || !(strpos($str, "<i>[M]</i>") === false)) { $link = $str; } else { $link = "<a href=\"cal_edit_entry.php?aid=".$appointment->getAppointmentId()."&ts=".$appointment->getStartTimestamp()."\" target=\"bottom\">".$str."</a>"; } return $link; }
ilCalendarTools::getWeek | ( | $ | ts | ) |
Definition at line 117 of file class.ilCalendarTools.php.
{ return date("W", $ts); }
ilCalendarTools::getWeekday | ( | $ | wday | ) |
Definition at line 78 of file class.ilCalendarTools.php.
{
return $this->weekdays[$wday];
}
ilCalendarTools::isNumeric | ( | $ | str | ) |
Definition at line 189 of file class.ilCalendarTools.php.
{ $isNumeric = 0; for ($i=0;$i<strlen($str);$i++) { switch($str{$i}) { case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": $isNumeric++; break; } } return ($isNumeric == strlen($str)); }
ilCalendarTools::$daymapping = array(7,1,2,3,4,5,6) |
Definition at line 60 of file class.ilCalendarTools.php.
ilCalendarTools::$months |
array(1 => "Januar", 2 => "Februar", 3 => "März", 4 => "April", 5 => "Mai", 6 => "Juni", 7 => "Juli", 8 => "August", 9 => "September", 10 => "Oktober", 11 => "November", 12 => "Dezember")
Definition at line 18 of file class.ilCalendarTools.php.
ilCalendarTools::$shortMonths |
array(1 => "Jan", 2 => "Feb", 3 => "Mrz", 4 => "Apr", 5 => "Mai", 6 => "Jun", 7 => "Jul", 8 => "Aug", 9 => "Sep", 10 => "Okt", 11 => "Nov", 12 => "Dez")
Definition at line 31 of file class.ilCalendarTools.php.
ilCalendarTools::$shortWeekdays |
array(1 => "Mo", 2 => "Di", 3 => "Mi", 4 => "Do", 5 => "Fr", 6 => "Sa", 7 => "So")
Definition at line 52 of file class.ilCalendarTools.php.
ilCalendarTools::$weekdays |
array(1 => "Montag", 2 => "Dienstag", 3 => "Mittwoch", 4 => "Donnerstag", 5 => "Freitag", 6 => "Samstag", 7 => "Sonntag",)
Definition at line 44 of file class.ilCalendarTools.php.