I put something together that appears to work. Basically I took a very carefully chosen few lines from calendar.php, just enough to get the mini calendar to work. Here's the php in its entirety:
PHP Code:
<?php
require_once(DIR . '/includes/functions_calendar.php');
$today = getdate(TIMENOW - $vbulletin->options['hourdiff']);
$vbulletin->GPC['month'] = $today['mon'];
$vbulletin->GPC['year'] = $today['year'];
$usertoday = array(
'firstday' => gmdate('w', gmmktime(0, 0, 0, $month, 1, $year)),
'day' => $vbulletin->GPC['day'],
'month' => $vbulletin->GPC['month'],
'year' => $vbulletin->GPC['year'],
);
// NOTE! Hard-coded for calendar number 1!
$vbulletin->GPC['calendarid'] = 1;
$calendarinfo = verify_id('calendar', $vbulletin->GPC['calendarid'], 1, 1);
$getoptions = convert_bits_to_array($calendarinfo['options'], $_CALENDAROPTIONS);
$calendarinfo = array_merge($calendarinfo, $getoptions);
$geteaster = convert_bits_to_array($calendarinfo['holidays'], $_CALENDARHOLIDAYS);
$calendarinfo = array_merge($calendarinfo, $geteaster);
$eventrange = array();
$eventrange['frommonth'] = $vbulletin->GPC['month'];
$eventrange['fromyear']= $vbulletin->GPC['year'];
$eventrange['nextmonth'] = $vbulletin->GPC['month'];
$eventrange['nextyear'] = $vbulletin->GPC['year'];
$eventcache = cache_events($eventrange);
$minimonth = construct_calendar_output($today, $usertoday, $calendarinfo);
?>
I named this file cal.php.
Then within index.php (i wanted it on the main page only), right after
PHP Code:
require_once('./global.php');
I put
PHP Code:
require_once('./cal.php');
Then the last step is, within the template, wherever you want the mini calendar to appear, place this (the same fragment that appears on the monthly calendar).
HTML Code:
<table class="tborder" cellpadding="2" cellspacing="$stylevar[cellspacing]" border="0" width="170">
$minimonth
</table>
So, to summarize:
1. copy the php code into a file, cal.php and put that file in the main forum directory
2. add php code to require_once this file, in the file where you want to use the mini calendar
3. add the <table> fragment including $minimonth to your template.
Note, I don't really understand how the multiple calendars work, or the access control for calendars, so this is hard-coded to always display calendar 1.
If someone else wants to turn this into an official "mod" then by all means go ahead.
Attached is a screen shot (I put it on the FAQ page first so as not to disrupt the forum during development).