CheckConfig($function, $args) && $this->CheckLogin("read")) {
if (!$PHP_SELF) {
global $PHP_SELF;
}
if (!$date) {
$date=time();
}
// calculate first weekday of this month
$date_arr=getdate($date);
$starttime=mktime(0,0,0,$date_arr["mon"],1,$date_arr["year"]);
$monthstart=getdate($starttime);
$firstweekday=$monthstart["wday"];
$endtime=mktime(0,0,0,$date_arr["mon"]+1,1,$date_arr["year"])-1;
$monthend=getdate($endtime);
$monthsize=$monthend["mday"];
// is startdate in the current month -> highlight today.
$today=getdate();
if ($today["year"]==$date_arr["year"] && $today["mon"]==$date_arr["mon"]) {
$current=$today["mday"];
}
$highlight=$date_arr["mday"];
// now populate the month with all entries.
function AddDay($from, $to, $priority, $path, $name, $summary) {
global $ARCurrent;
if ($from<=$to) {
$from_arr=getdate($from);
if ($from_arr["hours"]<12) {
$ARCurrent->daylist[$from_arr["mday"]][0]="1";
} else {
$ARCurrent->daylist[$from_arr["mday"]][1]="1";
}
}
}
for ($i=1; $i<=$monthend["mday"]; $i++) {
$ARCurrent->daylist[$i][0]="0";
$ARCurrent->daylist[$i][1]="0";
}
unset($ARBeenHere["populate"]);
$this->populate($starttime, $endtime, $data->min_priority["day"], "system.add.time.phtml","timefunc=AddDay&from=$starttime&to=$endtime");
?>
 |
"> |
|
"> |
 |
 |
 |
 |
 |
 |
 |
 |
dir->images."dot.gif\" width=\"32\" height=\"20\" border=\"0\" alt=\"-$i\">";
}
for ($i=1; $i<=$monthsize; $i++) {
$idate=mktime(0,0,0,$date_arr["mon"],$i,$date_arr["year"]);
if ($i==$highlight) {
echo " ";
} else {
echo " | ";
}
echo " dir->images."calendar/calmon".$ARCurrent->daylist[$i][0].$ARCurrent->daylist[$i][1].".gif\" align=\"right\">";
echo "";
if ($i==$current) {
echo "$i";
} else {
echo "$i";
}
echo " | \n";
if ((($i+$firstweekday)%7)==0) { // end of the week, next row
echo " ";
if ($i<$monthsize) { // only start a new row if there are more days
echo "\n";
}
}
}
$date_arr=getdate(mktime(0,0,0,$date_arr["mon"]+1,1,$date_arr["year"]));
$firstweekday=$date_arr["wday"]; // first week day of next month
if ($firstweekday) { // if first weekday is sunday, then don't display empty line
for ($i=1; $i<(8-$firstweekday); $i++) {
echo " dir->images."dot.gif\" width=\"32\" height=\"20\" border=\"0\" alt=\"$i\"> | ";
}
}
?>
|
 |