View Full Version : Mini Calendar
potocki99
01-09-2008, 12:24 PM
I know there are a couple of Mod's for a mini calendar, but they are outdated and I can't get them to work.
Any idea if there is a way to maybe take the minicalendar on the calendar.php page and move it, or copy it and put it on the forumhome?
I looked into the VBAdvanced, but that is way more than what I want to do with my board at this time.
Thanks!
CNibbana
01-17-2008, 03:30 AM
I feel your pain.
The mini calendar of old that shows the actual VB calendar on a non-VB page, complete with links to events, etc. is something I have wanted for a long time. I would love to see this mod but don't have the capability to figure it out myself (I tried).
Hopefully someone out there with the skills will make it happen!
Shanj
01-18-2008, 01:44 AM
Would like to display a mini calendar in my side column.
I know the cms do it but I prefer to just select items I want and stick them in.
I'm using Ultimate Side Columns and it adds on to the navbar template.
Also want a hierarch calendar, top as now, 2nd level viewable by usergroup, 3rd lever private for oneself. Lower levels get feed from upper level/s.
mikelangelo2005
11-16-2008, 07:23 AM
I also look for the same :confused:
greetings,
Trady
05-26-2009, 05:37 PM
Also looking for this...
T.
Dulce
07-29-2009, 04:35 PM
has this been made anywhere yet?
Vector76
08-11-2009, 04:29 AM
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
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
require_once('./global.php');
I put
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).
<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).
Vector76
08-11-2009, 02:07 PM
I made a mistake and didn't notice that the weekday abbreviations (S, M, T, W, T, F, S) were not showing up along the top row. I finally figured out what was causing that: the phrase group that's loaded needs to include 'calendar'. And the $phrasegroups variable needs to be updated before global.php is included.
So for example at the top of index.php you'll see:
$phrasegroups = array('holiday');
which needs to be
$phrasegroups = array('holiday', 'calendar');
in order for the days to show up.
There's probably a nice clean way to do this in vbulletin that is more modular and doesn't involve editing code in as many places, but for me this is now working.
Front Range 4x4
09-30-2009, 06:07 PM
Thanks, this works well on 3.8.
And 1
10-06-2009, 02:58 AM
Thanks
Front Range 4x4
10-07-2009, 07:55 PM
It doesn't work in 3.8 in all browsers afterall.
CNibbana
10-08-2009, 12:49 AM
I made a mistake and didn't notice that the weekday abbreviations (S, M, T, W, T, F, S) were not showing up along the top row. I finally figured out what was causing that: the phrase group that's loaded needs to include 'calendar'. And the $phrasegroups variable needs to be updated before global.php is included.
So for example at the top of index.php you'll see:
$phrasegroups = array('holiday');
which needs to be
$phrasegroups = array('holiday', 'calendar');
in order for the days to show up.
There's probably a nice clean way to do this in vbulletin that is more modular and doesn't involve editing code in as many places, but for me this is now working.
Thanks for piecing this together! It works very well.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.