Ok heres my little contribution. It's a quick and dirty fix but it's the only way I could think to do it using the current structure and not knowing any sql didn't help. I really need a book.
Ok in index.php replace
Quote:
// vbPortal mini calendar - by wajones
if ($showcalendar) {
$year = date('Y');
$doublemonth = vbdate('m',time());
$month = date('n');
$day = '1';
$today = vbdate('m-d',time());
$events=$DB_site->query("SELECT eventdate,subject,eventid,public FROM calendar_events WHERE eventdate LIKE '$year-$doublemonth-%' AND ((userid='$bbuserinfo[userid]' AND public='0') OR (public='1'))");
while ($event=$DB_site->fetch_array($events)) {
if ($showtodaysevents AND $event[eventdate]==vbdate('Y-m-d',time())) {
$eventsubject = htmlspecialchars($event['subject']);
if ($event['public']=='1') {
$todaysevents .= "<li><a href=\"$bburl/calendar.php?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]\"><smallfont color=\"{calpubliccolor}\">$eventsubject</smallfont></a></li>";
}
if ($event['public']=='0') {
$todaysevents .= "<li><a href=\"$bburl/calendar.php?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]\"><smallfont color=\"{calprivatecolor}\">$eventsubject</smallfont></a></li>";
}
eval("\$eventstoday = \"".gettemplate('index_calendar_todaysevents')."\" ;");
}
}
if (!$bbuserinfo['startofweek']) {
$bbuserinfo['startofweek'] = '1';
}
|
with
Quote:
if ($showcalendar) {
$year = date('Y');
$doublemonth = vbdate('m',time());
$month = date('n');
$day = '1';
$today = vbdate('m-d',time());
$events=$DB_site->query("SELECT eventdate,subject,eventid,public FROM calendar_events WHERE eventdate LIKE '$year-$doublemonth-%' AND ((userid='$bbuserinfo[userid]' AND public='0') OR (public='1')) ORDER BY eventdate");
while ($event=$DB_site->fetch_array($events)) {
$thetime = time();
for ($i = 0; $i < 14; $i++) {
if ($showtodaysevents AND $event[eventdate]==vbdate('Y-m-d',$thetime)) {
$eventsubject = htmlspecialchars($event['subject']);
if ($event['public']=='1') {
$todaysevents .= "<li><a href=\"$bburl/calendar.php?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]\"><smallfont color=\"{calpubliccolor}\">$eventsubject</smallfont></a></li>";
}
if ($event['public']=='0') {
$todaysevents .= "<li><a href=\"$bburl/calendar.php?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]\"><smallfont color=\"{calprivatecolor}\">$eventsubject</smallfont></a></li>";
}
eval("\$eventstoday = \"".gettemplate('index_calendar_todaysevents')."\" ;");
}
$thetime = $thetime + 86400;
}
}
if (!$bbuserinfo['startofweek']) {
$bbuserinfo['startofweek'] = '1';
}
$enddate = time() + 1209600;
$doublemonth = vbdate('m',$enddate);
$year = vbdate('Y',$enddate);
$events=$DB_site->query("SELECT eventdate,subject,eventid,public FROM calendar_events WHERE eventdate LIKE '$year-$doublemonth-%' AND ((userid='$bbuserinfo[userid]' AND public='0') OR (public='1')) ORDER BY eventdate");
while ($event=$DB_site->fetch_array($events)) {
$thetime = time();
for ($i = 0; $i < 14; $i++) {
if ($showtodaysevents AND $event[eventdate]==vbdate('Y-m-d',$thetime)) {
$eventsubject = htmlspecialchars($event['subject']);
if ($event['public']=='1') {
$todaysevents .= "<li><a href=\"$bburl/calendar.php?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]\"><smallfont color=\"{calpubliccolor}\">$eventsubject</smallfont></a></li>";
}
if ($event['public']=='0') {
$todaysevents .= "<li><a href=\"$bburl/calendar.php?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]\"><smallfont color=\"{calprivatecolor}\">$eventsubject</smallfont></a></li>";
}
eval("\$eventstoday = \"".gettemplate('index_calendar_todaysevents')."\" ;");
}
$thetime = $thetime + 86400;
}
}
if (!$bbuserinfo['startofweek']) {
$bbuserinfo['startofweek'] = '1';
}
$year = date('Y');
$doublemonth = vbdate('m',time());
$events=$DB_site->query("SELECT eventdate,subject,eventid,public FROM calendar_events WHERE eventdate LIKE '$year-$doublemonth-%' AND ((userid='$bbuserinfo[userid]' AND public='0') OR (public='1')) ORDER BY eventdate");
while ($event=$DB_site->fetch_array($events)) {}
|
Then just alter the index_calendar_todaysevents template to read something like
Next fortnight's events
instead of
Today's events
And that should work fine.
BUT this horrid work around adds two more queries to your home page and is generally horrid. Now can someone with some skill and time turn that code into something pretty please?
All credit to wajones for the original code for me to hack about though. Thank you.
(working demo at
http://www.zclub.net 
)