I have developed a patch to templates/modules/mod-calendar.tpl (for version 1.7.4) to allow you to control the focus date of the Group Calendar from the Calendar module.
The calendar module controls other aspects of Tikiwiki by adding day
, mon
, and year
parameters to the Wiki page. Unfortunately, the group calendar is not amenable to control by these parameters. Instead, it expects a todate
parameter, whose value is a Unix date (made with mktime()
), rather than day, month and year numbers. This patch adds a todate
parameter to the URLs produced by the calendar module.
It's a relatively simple patch of only a few lines.
Editorial comment: This is probably not the best way to achieve the objective. Ideally, there should probably be some uniform parameter structure imposed over the calendar and other wiki features so that a single set of calendar module parameters could be used by all of them. I was simply too timid to overhaul the tiki-calendar.php
code to use day
, mon
, and year
.
*** mod-calendar.tpl.orig 2003-12-18 16:26:51.000000000 -0600 --- mod-calendar.tpl 2003-12-19 11:22:49.000000000 -0600 *************** *** 40,45 **** --- 40,48 ---- unset($query["day"]); unset($query["mon"]); unset($query["year"]); + // squash the todate, too, in case you're looking at the + // calendar. [2003/12/18:rpg] + unset($query["todate"]); $father=$parsed["path"]; if (count($query)>0) { $first=1; *************** *** 61,66 **** --- 64,70 ---- } else { $todaylink=$father."day=".date("d")."&mon=".date("m")."&year=".date("Y"); } + $todaylink = $todaylink . "&todate=" .time(); {/php} <div class="box"> <div class="box-title" style="margin:0px;">{tr}Calendar{/tr}</div> *************** *** 122,127 **** --- 126,135 ---- } print( "<td class=\"fc\" align=\"center\">" ); $url = $father."day=$pval&mon=$mon&year=$year"; + // now add a timestamp todo argument to the query so that + // a calendar page can be navigated. [2003/12/19:rpg] + $rpgtime=mktime(12, 0, 0, $mon, $pval, $year); + $url = $url . "&todate=$rpgtime"; print( "<a class=\"$classval\" href=\"$url\">$val</a></td>"); } print("</tr>");