PDA

View Full Version : ported the upcoming events hack


Pages : [1] 2 3 4 5

Dragon_IBA
05-16-2004, 12:47 PM
I take absolutely no credit for this hack. All credit goes to the original author Tom M. The original hack thread can be found here (http://www.vbadvanced.com/forum/showthread.php?t=131)

I hope he will forgive me for beating him to this but i really needed to get this to work with the new CMPS.

Hopefully I did this well enough that you will not have problems with it, because i am by no means a php guru, so dont ask me for a bunch of support on this.

Dragon_IBA

r00t3d
05-16-2004, 05:05 PM
tnx for this :D

Our Sponsors
 

dafreak
05-18-2004, 07:30 PM
thanks :)

Tom M
05-18-2004, 09:42 PM
Thanks for doing this. I've been out of town for a few days and it will also be a while before I convert over to CMPS.

Our Sponsors
 

Dragon_IBA
05-19-2004, 08:46 AM
Ironic - I port it now i have troubles. Warning to all... as soon as I unistalled vbadvanced this stopped working. not sure why, I am still searching. Anyone else have this problem?

PixelFX
05-19-2004, 01:23 PM
hows it work with a clean install though ? I'm assuming your talking about the warning if you uninstall vbadvanced 1.1?

Tom M
05-19-2004, 02:36 PM
It will still require the code changes to functions.php as well as the templates it relies on. My guess at the moment would be you lost the templates it uses.

Dragon_IBA
05-19-2004, 11:02 PM
Well after several hours of banging my head against the desk, I figured out. lol :cool:

Had to update the change of phrasing in the functions.php file to accomodate the new version.

I have updated the instructions file in the first post, but in a nut shell here it is:

in functions.php find:

if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showcalendar']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))

replace with:

if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showevents']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))

hope this helps others out too...

allhandl
05-20-2004, 12:19 AM
Anyone have an ideas how I can get the upcoming events into a module block so I can place it in the center column of vbacmps
?

-Chef-
06-05-2004, 03:28 AM
Anyone have an ideas how I can get the upcoming events into a module block so I can place it in the center column of vbacmps
?
This would be a helpful modification.

EDIT:
allhandl, this can be done pretty easily. You could just shift Mini Calendar over to the center but I needed the mini where it was on the home page but a center one on a new page.
Keep in mind I am a noob but this is how I got it to display.

1. Go to "Edit Modules" and click on the "Mini Calendar".
See all the settings. It might be easier to intead of clicking "Mini Calendar" to instead right click and select "Open in new window" and you can work off that.

2. Back in regular CP, now click "Add Module". Now duplicate everything that was in "Edit Mini Calendar" except Module Title: ( name the new module something like "Center Column Calendar") and make sure the column field is set to "Center" then save.

3. Now you will have that calendar and events available as a center module and when you activate it per page, you can just unselect the regular right side one so that you don't have two calendars.

Personally, I did this on a new page "events" (index.php?page=events) and disabled ALL the right side modules and it even spaned all the over and looks quite nice. (see attached) Hope this works out for you.

bluesteel
06-06-2004, 07:00 AM
*installed* thanks!

I have a minor problem, in that the events seem to show up in the order that they were entered, rather than by date (see attached, last event should be up the top)
Can anybody help with this?
Thanks.

Tom M
06-09-2004, 12:39 PM
This is a "bug" in vBulletin that actually works as designed. You can get them to display in date order by changing your options on Forum Home Page Options -> Upcoming Event Type from "Group by Event" to "Group by Date".

When set to Group by Event the events display in the order they were entered (eventid) as opposed to being sorted by the event date - which make a whole lot more sense.

bluesteel
06-09-2004, 12:49 PM
Thanks for that Tom. Cheers!

Al

Itworx4me
06-09-2004, 05:40 PM
Having problems with this hack. Its not pulling the events or linking the calendar dates. Any idea's??? I have reinstalled this hack many times but it just doesn't seem to work right.

RetroDreams
06-14-2004, 05:36 PM
How do you make it pull events from say, the next 30 or 60 days?

Tom M
06-19-2004, 02:12 PM
You will need to change the number of days via the ACP at Forum Home Page Options -> Display Calendar Events. Simply set the value to the number of days of lookahead you wish displayed.

Tom M
06-19-2004, 02:14 PM
Did you make the modifications needed to the functions.php file? Do events listed on the regular calendar show up as links in the mini-calendar?

RetroDreams
06-21-2004, 01:54 AM
Thanks! Works great!

Can see in action at http://www.ka-alumni.org

Watson
06-30-2004, 08:23 AM
I get this error

Parse error: parse error in /home/webcust/cwatson/watp/forums/modules/minicalendar.php on line 175

I take it I have added the code to my minicalender.php wrong, can anyone tell me whats up, here is the full code of the above mentioned file


<?php
// ++=========================================================================++
// || vBadvanced CMPS 1.0.0 ||
// || © 2003-2004 vBadvanced.com & PlurPlanet, LLC - All Rights Reserved ||
// || This file may not be redistributed in whole or significant part. ||
// || http://vbadvanced.com ||
// ++ ========================================================================+
// ######################### Calendar #########################
if ($vba_options['portal_calendarid'])
{
require_once('./includes/functions_calendar.php');

if ($vba_options['portal_calendarid'] != -1)
{
$calendarinfo = verify_id('calendar', $vba_options['portal_calendarid'], 0, 1);
}
if ($bbuserinfo['startofweek'] > 7 OR $bbuserinfo['startofweek'] < 1)
{
$bbuserinfo['startofweek'] = $calendarinfo['startofweek'];
}

$today = getdate(TIMENOW - $vboptions['hourdiff']);
$today['month'] = $vbphrase[strtolower($today['month'])];
$year = $today['year'];
$month = $today['mon'];

$usertoday = array('firstday' => gmdate('w', gmmktime(0, 0, 0, $month, 1, $year)), 'month' => $month, 'year' => $year,);

if ($calendarinfo)
{
$calendarinfo = array_merge($calendarinfo, convert_bits_to_array($calendarinfo['options'], $_CALENDAROPTIONS));
$calendarinfo = array_merge($calendarinfo, convert_bits_to_array($calendarinfo['holidays'], $_CALENDARHOLIDAYS));

$range = array();

$range['frommonth'] = $month;
$range['fromyear']= $year;
$range['nextmonth'] = $month;
$range['nextyear'] = $year;

$eventcache = cache_events($range);
}
if ($vba_options['portal_calendarid'] == -1)
{
$calendarinfo['showweekends'] = 1;
}

$show['dontshowweek'] = true;

$calendarbits = construct_calendar_output($today, $usertoday, $calendarinfo, 0, '');

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_calendar') . '";');

unset($calendarinfo, $eventcache, $calendarbits, $usertoday, $range);
}

// ### TODAY'S EVENTS #################################################
if ($vboptions['showevents'])
{
require_once('./includes/functions_calendar.php');

$future = gmdate('n-j-Y' , TIMENOW + 43200 + (86400 * ($vboptions['showevents'] - 1)));
$eventstore = unserialize($datastore['eventcache']);

if (!is_array($eventstore) OR $future != $eventstore['date'])
{
// Need to update!
require_once('./includes/functions_databuild.php');
$eventstore = build_events();
DEVDEBUG('Updated Events');
}

unset($eventstore['date']);
$events = array();
$eventcount = 0;
foreach ($eventstore AS $eventid => $eventinfo)
{
$offset = iif (!$eventinfo['utc'], $bbuserinfo['tzoffset'], $bbuserinfo['timezoneoffset']);
$eventinfo['dateline_from_user'] = $eventinfo['dateline_from'] + $offset * 3600;
$eventinfo['dateline_to_user'] = $eventinfo['dateline_to'] + $offset * 3600;
$gettime = TIMENOW - $vboptions['hourdiff'];
$iterations = 0;

if ($bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWCALENDAR OR $eventinfo['holidayid'])
{
if ($eventinfo['userid'] == $bbuserinfo['userid'] OR $bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWOTHERSEVENT OR $eventinfo['holidayid'])
{
while ($iterations < $vboptions['showevents'])
{
$todaydate = getdate($gettime);
if (cache_event_info($eventinfo, $todaydate['mon'], $todaydate['mday'], $todaydate['year']))
{
if (!$vboptions['showeventtype'])
{
$events["$eventinfo[eventid]"][] = $gettime;
}
else
{
$events["$gettime"][] = $eventinfo['eventid'];
}
$eventcount++;
}
$iterations++;
$gettime += 86400;
}
}
}
}

if (!empty($events))
{
ksort($events, SORT_NUMERIC);
foreach($events AS $index => $value)
{
$pastevent = 0;
$pastcount = 0;
unset($eventdates, $comma, $daysevents);
if (!$vboptions['showeventtype'])
{ // Group by Event // $index = $eventid
foreach($value AS $key => $dateline)
{
if (!isset($comma))
{
$firstdate = $lastdate = $dateline;
}
else
{
$lastdate = $dateline;
}
$comma = ', ';
$eventinfo = $eventstore["$index"];
}
$eventdates = vbdate($vboptions['dateformat'], $firstdate, false, true, false);
if ($firstdate <> $lastdate)
{
$eventdates .= ' to ' . vbdate($vboptions['dateformat'], $lastdate, false, true, false);
}
if ($eventinfo['holidayid'])
{
$callink = "$vboptions[blockbullet] " . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&amp;holidayid=$eventinfo[holidayid]\">" . $vbphrase['holiday_title_' . $eventinfo['varname']] . "</a>";
}
else
{
$callink = "$vboptions[blockbullet] " . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&amp;e=$eventinfo[eventid]&amp;c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
}
}
else
{ // Group by Date
$comma = "$vboptions[blockbullet] ";
$eventdate = vbdate($vboptions['dateformat'], $index, false, true, false);
foreach($value AS $key => $eventid)
{
$eventinfo = $eventstore["$eventid"];
if ($eventinfo['holidayid'])
{
$daysevents .= $comma . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&amp;holidayid=$eventinfo[holidayid]\">" . $vbphrase['holiday_title_' . $eventinfo['varname']] . "</a>";
}
else
{
$daysevents .= $comma . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&amp;e=$eventinfo[eventid]&amp;c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
}
$comma = "<br>$vboptions[blockbullet] ";
}
}
eval('$eventstoday .= "' . fetch_template('adv_calendar_todaysevents') . '";');
}
// memory saving
unset($events, $eventstore);
}
else
{
$eventstoday .= "<tr><td class=\"alt2\" colspan=\"7\" align=\"center\"><span class=\"smallfont\">No events scheduled in<br>the next $vboptions[showevents] days.</span></td></tr>";
}
}
Just above this line:

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_calendar') . '";');
?>

Watson
07-02-2004, 09:52 AM
*bump

Still looking for help on this anyone please :D

FleaBag
07-02-2004, 12:52 PM
Installed and working nicely, cheers I had been missing this.

bandit
07-02-2004, 01:25 PM
there seems to be a problem with my functions.php file...

i can't find the line of code listed for this hack


if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showcalendar']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))



i have something very similar in functions.php but i'm not sure exactly how to change it to make this hack work... i've tried several things, but each try has returned a "Fatal error" message.

here's what that section of code in functions.php looks like on mine:

if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))




you see... my functions.php doesn't have 'adv_index' in it, just 'index'

any help is very appreciated.

-jeff

wasser
07-02-2004, 01:26 PM
watson, you don't just add the code to the minicalendar.php. the instructions state:

Step #1: Open minicalendar.php (forum/modules/minicalendar.php)

Add the following:

[included code]

Just above this line:

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_calendar') . '";');

you are supposed to place all the included code above the stated line.

Watson
07-05-2004, 06:42 PM
thanks for that wasser, I didnt notice I had done that :D

Watson

wasser
07-05-2004, 09:45 PM
glad ya got it sorted. =)

lunchbox
07-31-2004, 02:22 AM
Alright... Today is July 31st, I have an event on August 2nd. When i change the upcoming event span to 3 or more days ahead, the upcoming events block is empty. If it's set to display upcoming events in 1 day, i get the message "No events scheduled in the next 1 days.", and the same if i put in 2 days. What is the problem that when an event is coming up and is located in the 'upcoming time span' that the block on my CMPS doesn't display? I see the "Upcoming Events" title row, but the row that displays the events is blank, no error, no text, not even there. I've toggled with different options and nothing has changed... any help?

Lizard King
08-04-2004, 12:01 AM
I have my calender seen like this in cmps (attached pic)
Why it includes another line with this week events in ? It messes the style

cogimo
08-07-2004, 01:57 PM
Hi
The hack worked fine however I am getting two titles for upcoming events

Take a look

http://www.wearesurvivors.com

Frankenberrie
08-10-2004, 04:42 PM
Anyone have an idea how to make it show upcoming events for the current day.. If there are events for today, it does not show them on the uncoming event list!

Swanny231
08-11-2004, 05:50 PM
You are the man Sweet..

amykhar
08-17-2004, 12:34 PM
I have my calender seen like this in cmps (attached pic)
Why it includes another line with this week events in ? It messes the style

In the new template, it needs to be colspan="8" instead of colspan="7"

Amy

oldfan
08-27-2004, 10:25 PM
worked great, thanks
Does/can it show birthdays too?

Fargo
08-28-2004, 08:49 AM
is there any way to extend this and have it show upcoming events strictly for the current month?

My wife and I use the calendar to remind us of bills that are due/paid & my son's head start schedule...

hani
08-28-2004, 10:37 AM
Hi people
I think am missing something here, I did everything a la instruction file, but how can I add this module to show on CMPS?

Please forgive my ignorace as I am but a new comer to this VB world

Thanx

mholtum
08-28-2004, 11:07 AM
Edit modules, activate

hani
08-28-2004, 11:37 AM
Here is my module settings:

title: events
Identifier: Blank
File: None
Template: todaysevents
Active: yes
Column: Right
Disp Order: 2
bla bla bla :)

:( its not showing

hani
08-30-2004, 03:45 AM
Nevermind
I found out that I was altering template in a different style (what if one has 50 styles? dose he have to change each and every template?)

Anyway it works fine, thanx to all who helped, and also to those who were asking questions as they trigger new ideas at times :)

Now
Can I use the module in my main CMPS index to show events of tody, while in a didicated event page show the months events or nDays evets.

I know people can go to the calendar itself, but listing events is easier for most people I guess

Thanx again

all the best

Hani

djnth
08-30-2004, 05:40 AM
I'm not finding this line in my functions.php file for version 3.03 I've found something very similar. got any updated code? Thanks!!

Nth


Well after several hours of banging my head against the desk, I figured out. lol :cool:

Had to update the change of phrasing in the functions.php file to accomodate the new version.

I have updated the instructions file in the first post, but in a nut shell here it is:

in functions.php find:

if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showcalendar']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))

replace with:

if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showevents']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))

hope this helps others out too...

swantonio
08-30-2004, 03:41 PM
I compliment very useful beautiful istallato it

oldfan
09-02-2004, 11:49 PM
any word on birthdays ?

Watson
09-03-2004, 12:30 AM
using 3.0.3 and cant get upcoming events to show up, worked ok when I used this on my old boards running 3.0.1

Any help please

Watson

Samir
09-06-2004, 03:57 PM
I'm not finding this line in my functions.php file for version 3.03 I've found something very similar. got any updated code? Thanks!!

Nth

I've run into the same problem. Here's my line from 3.0.3:


if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index') OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))


Looking at it, I'm thinking it may work anyways. But I'm hesitant to try it.

Samir
09-06-2004, 04:28 PM
Hey bluesteel, how did you do this? Mind sharing the code?

-peace-
09-15-2004, 07:17 PM
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showcalendar']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))

if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showevents']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))



When I do this - I get my whole site is - doing this !!!!

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in c:\inetpub\wwwroot\vb\includes\functions.php on line 1887

Fatal error: Call to undefined function: is_browser() in c:\inetpub\wwwroot\vb\global.php on line 93

This is strange cause all your doing is changing a word from showcalendar to showevents. Why am I getting this error??????????

Here is my functions and my global file. Is there anything wrong with them?

Samir
09-16-2004, 12:08 AM
What version of vb do you have? For 3.0.3, I just didn't do the change and left it stock. See my post above for my line of code that works.

-peace-
09-16-2004, 09:36 AM
I got the latest.

I did just what you said and it works now. Didnt change anything.

Hmmm, why do they say to change it when its not needed to be changed. :confused:

At least its working now. :)

Samir
09-16-2004, 11:48 AM
Glad it worked for you. :) I think in previous versions (3.0.1/2) the code might have looked like that but in 3.0.3 they revised it and the installation instructions just haven't been updated for 3.0.3.

hani
09-19-2004, 03:23 AM
Hi people
If I set my events days to lookup events to 7, and I have a ranged event spaning 3 days, it will show 3 times, can I prevent that? I want it only to show once only.

Also, where can I remove the date f the event, in cas the ranged events show several times, I'll set the events for one day, and as the day is today, I dont need the date to show.

Am I speking English :|

regards

pdatotaal
09-25-2004, 12:32 AM
Thanks for the hack, works great with vb 3.03...

Samir
09-25-2004, 03:45 PM
Hi people
If I set my events days to lookup events to 7, and I have a ranged event spaning 3 days, it will show 3 times, can I prevent that? I want it only to show once only.

Also, where can I remove the date f the event, in cas the ranged events show several times, I'll set the events for one day, and as the day is today, I dont need the date to show.

Am I speking English :|

regards
I'm looking for some similar functionality. See this post:
http://www.vbadvanced.com/forum/showpost.php?p=13470&postcount=43