PDA

View Full Version : vBulletin CMS Widgets - Upcoming Events


Pages : [1] 2

ngcoders
12-27-2009, 10:00 PM
Upcoming Events

Released 28/12/2009
By Vikas - http://www.ngcoders.com

Installation


Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Upcoming Events. Keep it short as this is what will appear as title on your pages.
Click Save
Click Configure on the right of the new created widget.
Remove the default code that appears. Be sure to not leave behind even a single letter.
Copy and Paste the code that you can find below.
Leave the template name as is (vbcms_widget_execphp_page)
Click Save
Goto Admincp->vBullietin CMS->Layout Manager
Click Go on the Default Layout
Add the Widget to your Layout
Click Save
That's all !!


PHP Code



ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

RickyG
12-28-2009, 12:09 AM
Where is this pulling from?

steven s
12-28-2009, 12:30 AM
Nice start but it's pulling events from 2005. :)

Conner85
12-28-2009, 01:25 AM
I posted a test event for Dec. 28th, 2009 and on the widget it posts the date you posted the event on, not the actual event date.

Example: I posted an event for Dec. 28th, 2009 just now (which is the 27th), and in the widget it says Dec. 27th, 2009.

Is there any way for it to show the real date of the event?

MattZ DSLR
12-28-2009, 01:50 AM
Great future mod
showing events from last year
do you have a fix for it?

ngcoders
12-28-2009, 03:44 AM
Should be fixed now

TheSupportForum
12-28-2009, 05:17 AM
Should be fixed now

any chance of getting this to work in forum blocks as well

this widget doesnt work correctly for CMS due to it only showing date and not event name

Conner85
12-28-2009, 06:30 AM
I'm still getting the date the event was posted, not the date of the event.

Zweeper
12-28-2009, 07:07 AM
nice!!

astrid1
12-28-2009, 08:22 AM
Where do I set the events are a general?

ngcoders
12-28-2009, 08:37 AM
Events can be set in calendar , You can see the event module on my site http://www.roboticsindia.com , It works just fine.

grahamsmythe
12-28-2009, 08:38 AM
Worked a treat for me!

Great mod. Thanks.

astrid1
12-28-2009, 08:47 AM
What must be precisely adjusted? a new calendar with events, or we take the standart calendar ?

RickyG
12-28-2009, 08:53 AM
Still not working right fo rme....
http://www.blackberryboards.com/

SLY LS1
12-28-2009, 11:35 AM
Works perfect..

Cheers

wacodep
12-28-2009, 01:47 PM
Individual events are showing up as occurring the day BEFORE the day they are actually scheduled (e.g., 1/2/09 event shows up as 1/1/09).

But they are showing up correctly on the standard listing on the forum home.

dale09
12-28-2009, 05:47 PM
tagged, very nice

Big-Pete
12-28-2009, 06:26 PM
Just tried this in VB4 gold and there's not a widget type like this
?Choose PHP Direct Execution as Widget's Type

Was the php direct execution widget type removed from the gold release??

Conner85
12-28-2009, 08:06 PM
Just tried this in VB4 gold and there's not a widget type like this


Was the php direct execution widget type removed from the gold release??


I have gold and I have that widget type. Not sure why it wouldn't be showing up in yours.

I'm still having trouble with it showing the date it was posted, rather than the day of the event in the widget.

Bojangles
12-29-2009, 03:36 AM
This will work perfect once the date gets fixed, everything is showing a day behind on the widget from what the event date is set to be.

ngcoders
12-29-2009, 04:23 AM
IT works fine for me , maybe it has to do with the Time setting on your server. The DST setting please look into it.

Conner85
12-29-2009, 05:00 AM
It shouldn't matter what our DST settings are set to (for my problem anyway). The fact of the matter is, when I post an event for .. lets say.. January 1st, 2010, It displays the time the event was posted, not the date of the event.

Radek Klein
12-29-2009, 06:15 AM
Works perfectly on my site, thank you.

wacodep
12-29-2009, 11:21 AM
IT works fine for me , maybe it has to do with the Time setting on your server. The DST setting please look into it.If it had anything to do with the DST or time setting on the server, then the calendar itself (not just the widget, but the vB calendar) would be displaying the events on the wrong date, too.

But it's not.

FYI: All events are showing up correctly on the calendar *and* the server time and DST is set correctly.

imagirlgeek
12-29-2009, 03:35 PM
If it had anything to do with the DST or time setting on the server, then the calendar itself (not just the widget, but the vB calendar) would be displaying the events on the wrong date, too.

But it's not.

FYI: All events are showing up correctly on the calendar *and* the server time and DST is set correctly.

I have the same issue. I have an upcoming event in the calendar scheduled for January 23rd, but on upcoming events it lists January 22nd.

imagirlgeek
12-29-2009, 04:07 PM
Okay, I found something.

If my event is a Single, all day event, it shows up on Upcoming Events a day early.

However, if I change it to a Ranged event (start time and end time), I get an option to change the time zone. It defaults to GMT. I change it to GMT-5 and it displays correctly in Upcoming Events.

I'm not sure why I don't have the option to set a time zone on a Single, all day event. Nor do I understand why vB4 stores it in the database as GMT unless I choose a Ranged event.

Is there anyway to compensate for this?

ngcoders
12-29-2009, 04:22 PM
The GMT setting should have been there in both or should be there in none, only vb4 guys can answer why is it so.

wacodep
12-29-2009, 05:56 PM
The problem appears to be a VB bug.

When setting a "Single, All Day Event", vBulletin still sets a start and end datetime, but the END datetime is being set for the DAY BEFORE the event's start datetime. No idea why it is doing this, but it appears to be a bug.

wacodep
12-29-2009, 06:02 PM
The single day and ranged events seem OK, but the way this widget displays the start and end datetimes for a recurring event is confusing.

If you have an recurring event that occurs once a week for 2 years, it looks like this in the widget:

Event Name X
From 2nd Jan 2010 to 2nd Jan 2012

This makes it look like the event is ranged event, taking place for two years solid, every day.

Recurring events should show up not as a range, but as a single event for each day they occur, such as:

Event Name X
On 2nd Jan 2010

Event Name X
On 9th Jan 2010

Event Name X
On 16th Jan 2010

NickyNet
12-29-2009, 06:45 PM
nice mod! thank you for that!

but just one more info:
recurring events which are setup before "today", will not be shown.

gruftiradio
12-31-2009, 07:35 PM
Can the Widget show the Time of Event, not the date?

S1OPP
01-01-2010, 12:34 PM
Installed and working great.

Q: Is there a simple way to get it to include upcoming birthdays?

NiCForce
01-01-2010, 10:00 PM
I think that some coders already know the answer, but do not show us how?
a friend of mine has been added to my code (or the entire code) =





ob_start();

$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$datefrom = date('j',$event['dateline_from']);
$datefrom = $datefrom+1;
$format = sprintf("On ".$datefrom."th %s",date('M Y',$event['dateline_from']));
} else {
$datefrom = date('j',$event['dateline_from']);
$datefrom = $datefrom + 1;
$dateto = date('j',$event['dateline_to']);
$dateto = $dateto + 1;
$format = sprintf("From ".$datefrom."th %s to ".$dateto."th %s",date('M Y',$event['dateline_from']),date('M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();


Set your GMT time, standard for me + 1 (change it) and it should work.
if a coder could take the data from the + or - GMT time and replacing the code in my (+ 1)then it should work. but what I was thinking. is that the data is taken from a wrong place.

ragtek
01-03-2010, 02:28 PM
You should use the eventcache instead of selecting the events from the database!

Also you don't take care of the showupcoming Option and the calendarpermissions....
Also you should use the vbulletin dateformat instead of hardcoding;)

ngcoders
01-05-2010, 01:27 AM
@ragtek - If all this was documented somewhere so that i could have referenced , Sadly there is none. Also i wrote it for personal use and it server my purpose.

ragtek
01-05-2010, 06:58 AM
@ragtek - If all this was documented somewhere so that i could have referenced , Sadly there is none. Also i wrote it for personal use and it server my purpose.

Yea, i know what you mean.
If i code something for me, i also don't code it "the vB way" (for example i don't creat options,.don't use the permissionsystem,etc..) but if i want to release it here, i have to make it userfriendly.

But because youre users can change the time zone (https://vborg.vbsupport.ru/profile.php?do=editoptions), you should take care of this;)


For timeformating you can use the vbdate function: http://members.vbulletin.com/api/vBulletin/_includes---functions.php.html#functionvbdate

hope that helps:)

ngcoders
01-05-2010, 05:36 PM
Thanks ill keep that in mind , When more vb4 details are available will update accordingly.

oechertigger
01-06-2010, 04:50 PM
Great App! THX

but is there a possibility to change the language of the Datetime Format??
Diplayed is: From 8th Jan 2010 to 8th Jan 2010

I want to have: Am 08.01.2010 von 08:00Uhr bis 20:00Uhr

or: Am 08. Jan. 2010 von 08:00 bis 20:00 Uhr

I use a german board, so i like to have the german dateformat!

I hope someone can help...?


Just found the answer by myself:

ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("Am %s",date('d. M. Y H:i',$event['dateline_from']));
} else {
$format = sprintf("Am %s bis %s",date('d. M. Y H:i',$event['dateline_from']),date('d. M. Y H:i',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

Bitti
01-06-2010, 05:40 PM
Great App! THX

but is there a possibility to change the language of the Datetime Format??
Diplayed is: From 8th Jan 2010 to 8th Jan 2010

I want to have: Am 08.01.2010 von 08:00Uhr bis 20:00Uhr

or: Am 08. Jan. 2010 von 08:00 bis 20:00 Uhr

I use a german board, so i like to have the german dateformat!

I hope someone can help...?

ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("Am %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']));
} else {
$format = sprintf("Vom %s bis %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']), vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

nealohara
01-06-2010, 06:17 PM
Nice. Is there a way of refining this a little?

Let's say we've got a room booked on Thursday the 7th January between 20:00 and 21:00 and we add it to the default calendar. Currently what we get is

Event
7th Jan 2010 to 7th Jan 2010

ideally I'd like it to display as follows:

Event
7th Jan 2010 between 20:00 and 21:00

The dates and times are all stored as variables but I don't want to screw it up :)

Any ideas?

Zweeper
01-06-2010, 09:29 PM
Installed and working great.

Q: Is there a simple way to get it to include upcoming birthdays?


good question

nealohara
01-07-2010, 07:12 AM
Nice. Is there a way of refining this a little?

Let's say we've got a room booked on Thursday the 7th January between 20:00 and 21:00 and we add it to the default calendar. Currently what we get is

Event
7th Jan 2010 to 7th Jan 2010

ideally I'd like it to display as follows:

Event
7th Jan 2010 between 20:00 and 21:00

The dates and times are all stored as variables but I don't want to screw it up :)

Any ideas?

lol, just realised it was already asked :)

Bitti
01-07-2010, 07:25 AM
Nice. Is there a way of refining this a little?

Let's say we've got a room booked on Thursday the 7th January between 20:00 and 21:00 and we add it to the default calendar. Currently what we get is

Event
7th Jan 2010 to 7th Jan 2010

ideally I'd like it to display as follows:

Event
7th Jan 2010 between 20:00 and 21:00

The dates and times are all stored as variables but I don't want to screw it up :)

Any ideas?

ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("<b>Am:</b> %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']));
} else {
$format = sprintf("<b>Vom:</b> %s<br /><b>Bis:</b> %s", vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_from']), vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

voglermc
01-07-2010, 04:25 PM
I can't seem to have it get recurring events listed also. I would also like it to show only the date of the event

sisterhood
01-07-2010, 06:06 PM
THX extra nice Mod

Bitti
01-07-2010, 06:30 PM
I can't seem to have it get recurring events listed also. I would also like it to show only the date of the event

Delete

. ' ' . VB::$vbulletin->options['timeformat']

voglermc
01-07-2010, 09:28 PM
Delete

. ' ' . VB::$vbulletin->options['timeformat']


from where?

winstone
01-07-2010, 11:32 PM
Looking at the way other widgets are getting cached, I think you can implement the same on this one, I've tried to do it myself but didn't have much time to get it all working

from what I have figured, all you need to do is get the widget id, generate the hash key, store the output using the widget id as an index/key, define time to live (ttl), write the whole thing into the cache using "vB_cache" thing, and the rest will be handled by the CMS, I know that because I stored the wrong info into the cache, set 5 as ttl and the widget showed up the first time I loaded the page, the next time it only showed the wrong data I cached

M@tt
01-08-2010, 02:09 PM
I might be getting a little over the top on this one but I would like to have many calendars setup with just the one calendar widget though perhaps where users can choose which calendar is their preferred (times of sporting matches of different codes for example) maybe in their usercp? Just putting it out there :)

Shanj
01-09-2010, 09:32 AM
Is it possible to select events or Hide them from the widget?
Loads of my events are tiny routine things every day or every week.
But for some special dates this would be great.

claudib
01-12-2010, 01:28 AM
I have the problem described that if a one day event is added to calendar for 15th Jan, it shows up in this widget as 14th Jan. I think others had this problem, but I don't see a solution. Please is there a fix for this or an edit I can do to the code? Thanks, Claudia

Easific
01-12-2010, 07:18 AM
Its a good widget to have. Should have been there as default. I do wish that the updated version comes out soon as I would love to run it with 4.0.1

sgthoskins
01-12-2010, 12:36 PM
I have the problem described that if a one day event is added to calendar for 15th Jan, it shows up in this widget as 14th Jan. I think others had this problem, but I don't see a solution. Please is there a fix for this or an edit I can do to the code? Thanks, Claudia

Same issue here. I removed the widget until I can find or figure out a solution.

claudib
01-12-2010, 01:06 PM
Is anyone willing to fix this widget? I am prepared to donate $20 by paypal for a working version of it. Thanks, Claudia

sgthoskins
01-12-2010, 01:27 PM
Is anyone willing to fix this widget? I am prepared to donate $20 by paypal for a working version of it. Thanks, Claudia

+2 I will pp $20 as well.

claudib
01-12-2010, 09:21 PM
Widget is working fine now. We did not need to make any mods to the widget itself.
Our problem was that the date the upcoming events appeared to be offset by one day.

From doing a few tests this was due to the server itself being on the wrong timezone for us. We rang the host and simply asked them to update the time and timezone on the server to our actual timezone, which was 6 hours off.

The date/times for the events are stored as unix timestamps and these get converted using the php date function. As such they will be converted against the actual server time, rather than any setting you might have in vBulletin.

Works a charm, thanks NG.

waynem
01-13-2010, 01:45 PM
It won't work if the time isn't correct, I can't use this unfortunately as it off a day. Needs to take the time from my settings, not the shared host server.

claudib
01-13-2010, 01:58 PM
In the widget code you code force the time offset by adding or subtracting 3600 for every hour you need to offset to each of the unix timestamps. This should produce the same result, and easy enough to add in. Simply change the following:

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

to:

$tz_offset = 3600;
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',($event['dateline_from']+$tz_offset)));
} else {
$format = sprintf("From %s to %s",date('jS M Y',($event['dateline_from']+$tz_offset)),date('jS M Y',($event['dateline_to']+$tz_offset)));
}

nader
01-15-2010, 09:58 AM
i think there is a bug on this script
the current date disappear on the same day it will show the next days

how can fix to show the event of current day?

ShawnV
01-15-2010, 04:21 PM
It would be nice to have a Upcoming Events widget that uses UserGroup permissions and posts calendar information the same way as in the "Whats Going On?"section of the forum.

waynem
01-17-2010, 05:46 PM
I set the offset to 86400 and it seems to work, thanks!

Front Range
01-22-2010, 10:09 PM
Is there a way to make this as a forum block too?

reefland
01-22-2010, 10:52 PM
I have a question. Does anyone know how I could make this show the upcoming 5 as well as the previous 5 events?

Chrissy_Ratbag
01-25-2010, 11:50 AM
Does this link with the Forum Calendar?

SonicGT
01-26-2010, 02:14 PM
Installed this and it appears to be showing all events 1 day ahead of schedule on the calendar, any ideas or thoughts?

Sotonforum.co.u
01-26-2010, 06:48 PM
Just tried this in VB4 gold and there's not a widget type like this


Was the php direct execution widget type removed from the gold release??
It isnt showing up for me either. It's VERY annoying. I hope they fix this soon.

Eq4bits
01-28-2010, 09:22 PM
it's in the dropdown
if you still can't find it try reuploading all the vbCMS files & contents of them (this happened to me and that solved the problem)

Front Range
01-28-2010, 09:43 PM
I set the offset to 86400 and it seems to work, thanks!

That worked for me too.

Installed.

Eq4bits
01-31-2010, 04:47 AM
That worked for me too.

Installed.
What timezone offset you for that to work?

Easific
01-31-2010, 10:40 AM
What timezone offset you for that to work?
Dont know where this is pulling the time from. I am in GMT +5.5, but the calendar worked even for a 5 hour offset value of 18000 seconds. Confusing.

86400 is the offset for 24 hours, so this is not the best way to do it.

ahmedipa
01-31-2010, 04:10 PM
so good hank you very much

Chrissy_Ratbag
02-01-2010, 10:25 AM
I have done this and get the following Parse Error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/rat10541/public_html/forum2010/includes/class_core.php(4033) : eval()'d code on line 14

Can anyone help me please?

buddyheiko
02-01-2010, 03:43 PM
It only worked one time.

I need it with german date / time.

MattZ DSLR
02-02-2010, 01:09 PM
I set the offset to 86400 and it seems to work, thanks!

OK
Where can I set this in widget
my is off by a day

MattZ DSLR
02-02-2010, 01:22 PM
In the widget code you code force the time offset by adding or subtracting 3600 for every hour you need to offset to each of the unix timestamps. This should produce the same result, and easy enough to add in. Simply change the following:

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

to:

$tz_offset = 3600;
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',($event['dateline_from']+$tz_offset)));
} else {
$format = sprintf("From %s to %s",date('jS M Y',($event['dateline_from']+$tz_offset)),date('jS M Y',($event['dateline_to']+$tz_offset)));
}

This worked like a charm when I changed from 3600 to 86400
Thank you

coolhandscoot
02-09-2010, 03:19 AM
Nice, gracias!

hirabenllc
02-09-2010, 02:13 PM
Works, thanks!

khuhner
02-14-2010, 07:22 PM
In vB 4.0.1 I entered an event to occur on March 1st, 2010. In the UPcoming Events block it shows the event occuring on Feb 28th, 2010.

The 2 images below show the correct calendar entry and the second shows the widget showing the wrong date.

way2xtreme
02-15-2010, 12:33 PM
Hello,

How do you make it show up like this instead (without the "On" just simple m-d-y)...

Date, time
Event

Date, time
Event

Date, time
Event

Also, can we set it to pull different calenders?

Thanks

zapiy
02-19-2010, 06:26 PM
can a mini calendar and a Create a new event button be added to this mod?

Cheers

nekiw
02-20-2010, 09:49 AM
what happends if I dont moderate posts on the forum that is assigned to the event module but I do moderate calendar?
will the forum thread be deleted if I moderate the calendar thread and delete it?
curious if I can have that everyone can post on forum, but I can moderate calendars for what that will show up there? and in widget.

khuhner
02-23-2010, 05:03 PM
Where is the developer?

Verionia
02-26-2010, 12:32 AM
What is the code for forum block?

doopz
03-03-2010, 02:14 PM
In vB 4.0.1 I entered an event to occur on March 1st, 2010. In the UPcoming Events block it shows the event occuring on Feb 28th, 2010.

The 2 images below show the correct calendar entry and the second shows the widget showing the wrong date.

Same here. Have events happening before March 28th yet it only seems to show March 28th.

Any solution for this?

edit some debugging:
Query =
SELECT * FROM event WHERE visible = 1 AND (dateline_from > '1267633147' || ( dateline_from > '1267633147' AND dateline_to < '1267633147' )) ORDER BY dateline_from ASC LIMIT 5

seems to be going wrong with the dateline?


edit 2: Hmm I guess this has to do with recurring events.
How do I display these too?



Delete

. ' ' . VB::$vbulletin->options['timeformat']


from where?

Good question, from where?

Chrissy_Ratbag
03-04-2010, 07:44 AM
I get a parsing error, see previous post of mine.

Can anyone help me please?

cindy helmond
03-04-2010, 09:15 AM
thx but needed for forumblock ?
thx

ngcoders
03-05-2010, 01:22 PM
If you are facing wrong time and date of even being displayed ... then it is related to GMT setup of your host / script.

khuhner
03-05-2010, 09:17 PM
Same here. Have events happening before March 28th yet it only seems to show March 28th.

Any solution for this?

edit some debugging:
Query =
SELECT * FROM event WHERE visible = 1 AND (dateline_from > '1267633147' || ( dateline_from > '1267633147' AND dateline_to < '1267633147' )) ORDER BY dateline_from ASC LIMIT 5

seems to be going wrong with the dateline?

From a post in this very thread:

I set the offset to 86400 and it seems to work, thanks!

So you'll need to adjust the offset to what you need.

Kurt

betts02
03-06-2010, 09:07 AM
What is the code for forum block?

I would like also to use this in a forum block, Maybe have it so it fetches a thread title ony ?

I have a gaming site and this would be great to show what matches we have planned

is_it_me
03-06-2010, 09:12 AM
Seems to be working great for me ? http://www.doctorwatson.info

But, I have several different calendars and was wondering if there?s anyway to exclude one in particular from showing up in the widget?

unfv
03-09-2010, 02:11 PM
Installed and working great.

Q: Is there a simple way to get it to include upcoming birthdays?
yeah please, can someone help us with this?

Thanks

Guust
03-11-2010, 05:12 AM
Hi
Firstly, I love the widget and so far it (kind of) works.

The small problem I have is that it does not seem to adjust for my Default Time Zone Offset, which is GMT + 10. So the homepage says an event is on the 10th and the calendar says it is on the 11th depending on the time of day you visit the site.

Check it out here:
http://www.2cv.com.au/content.php
and here
http://www.2cv.com.au/calendar.php?do=getinfo&e=1

Any fixes anybody ?

UPDATE: The answer is in this post: https://vborg.vbsupport.ru/showpost.php?p=1944388&postcount=33
I just replaced the code provided by NGCoders with the code provided by NicForce and all is good!

Chrissy_Ratbag
03-11-2010, 08:04 AM
I get the following parsing error

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/rat10541/public_html/forum2010/includes/class_core.php(4033) : eval()'d code on line 14

Can anyone help?

Blue91
03-14-2010, 06:04 PM
UPDATE: The answer is in this post: https://vborg.vbsupport.ru/showpost.php?p=1944388&postcount=33
I just replaced the code provided by NGCoders with the code provided by NicForce and all is good!

Same here. NicForce's code worked for me. Thanks to both coders.

SimplyJoe
03-26-2010, 08:11 PM
I'm using a hybrid of NicForce's code (formatted to provide the date format that I want), but I noticed that if you are not logged on, the dates are 24 hours ahead (so a July 3rd event will show on July 4), but if you log on, the dates are correct.

here is my code, but I still can figure this out. I don't see anything that tells me to be logged in or not.

ob_start();

// %d
$show_count = 15;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {
$tz_offset = 86400;
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']+$tz_offset));
} else {
$format = sprintf("From %s to %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']), vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

Thanks in advance.

Guust
03-26-2010, 10:45 PM
I'm using a hybrid of NicForce's codeNot that I really understand anything of this, but the major difference between the original code and NicForce's is that the code adds +1 to the date from and the date to. It seems you do not make a time adjustment like that, if I look over your code (not that I understand the coding).
I set it at +1 although my GMT = +10. Maybe the +1 refers to a date (a day) and not an hour.
I also found that when you use an event which covers more than one day, you might have to be creative with the begin and end dates.

SimplyJoe
03-27-2010, 01:13 AM
You are correct, I do not use the plus one, because that was giving me the reverse effect.

karlm
03-30-2010, 05:19 PM
Seems to be working for me, thank you!

Peter Lo
04-02-2010, 08:09 AM
I tried this widget using the default code at Post #1. Setting an event say from 2 April 2010 to 4 April 2010; when 2 April comes (ie today) the whole event no longer appears.

Shouldn't it only disappear after 4th april?

Guust
04-02-2010, 12:46 PM
I tried this widget using the default code at Post #1. Setting an event say from 2 April 2010 to 4 April 2010; when 2 April comes (ie today) the whole event no longer appears.

Shouldn't it only disappear after 4th april?
Use https://vborg.vbsupport.ru/showpost.php?p=1944388&postcount=33 instead

Verionia
04-05-2010, 09:26 PM
No forum widget code?

Peter Lo
04-06-2010, 03:01 AM
I tested this Widget and one downside is that it displays threads even in hidden/private subforums.

Is there a way to disable showing of threads from such forums? For example, it displays bad posts reporting threads and user infraction threads (which shouldn't be the case).

BygoneLI
04-07-2010, 03:02 PM
I cannot for the life of me get it to display the event on the day it is occurring... I live in the US in the eastern time zone, have tried various offsets and nada...

zipperty
04-09-2010, 12:27 PM
Working straight out of the box for me, Thanks for all your hard work.

Wild Bronco
04-12-2010, 12:54 PM
It works for me, but I would like to be able to translate the words in the time format.
The widget is using english rather than my default and translated lang.. Am I overlooking somthing?

From 15th Apr 2010 to 15th Apr 2010

Peter Lo
04-23-2010, 05:46 AM
I tried this widget using the default code at Post #1. Setting an event say from 2 April 2010 to 4 April 2010; when 2 April comes (ie today) the whole event no longer appears.

Shouldn't it only disappear after 4th april?

Use https://vborg.vbsupport.ru/showpost.php?p=1944388&postcount=33 instead

I used the code you linked at #33 instead and now all my events are shown as one day late! Using back that example, if I set an event from 2 to 4 April, it now shows up as 3 to 5 April instead!

Guust
04-24-2010, 11:49 AM
Maybe you do not need the time-offset as per #33?
As for the 1st question, I cannot answer that one, I don't understand the code myself.

doopz
04-25-2010, 10:59 AM
can someone please enlighten me how to list recurring events?

fluidswork
04-25-2010, 04:00 PM
nice , but not working .....................

NashChristian
05-01-2010, 12:49 PM
Hello,

I tried just adding the date syntax in with the date for the event start time. (I'm not showing the date range, I took out the whole 'from/to' portion.) Here is how I want it to display, and how it currently does display (but the time is off by an hour at the moment): Saturday, May 1st, @ 9:00 AM

For some reason, it is calculating this with a GMT of -5, when I have a GMT of -6. Both my admincp, user profile, and my calendar have the right time displayed, just not the widget. I CAN go in and hard code a variable for the hour and subtract one from it, however that still screws up my AM/PM display, etc...

Here is the code I'm using to display the starting date and time:

$format = sprintf("%s",date('l, F jS, @ g:i A',$event['dateline_from']));

How can I get this to calculate the correct time? Why doesn't it display the same time as in the calendar itself? How can I fix this?

Any help would be appreciated.

Thanks!
:D Jeff

claystation
05-02-2010, 06:32 PM
I have one custom field on my calendar. Does anyone know how I could show that data from the custom field, along with the title & date in this widget?
Thanks,
Andy

Kyle Tully
05-08-2010, 02:35 AM
When I "save" the code in the configure page... it doesn't save.

No errors, just doesn't save. The default code keeps reappearing.

Anyone had that happen before?

level8
05-08-2010, 06:43 PM
great widget...
can anyone help with 2 things?
1. How do I add a link at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?
2. Add a small icon image next to all events (https://vborg.vbsupport.ru/external/2011/08/21.gif ).

Any help is much appreciated :)

NashChristian
05-10-2010, 03:14 AM
can someone please enlighten me how to list recurring events?

I don't believe it works for that. It will just show the FIRST occurrence, as far as I can tell.

doopz
05-10-2010, 05:48 AM
I don't believe it works for that. It will just show the FIRST occurrence, as far as I can tell.

Ah, that explains.
Well I'm willing to pay someone who can make it that way, just name your price :)

khuhner
05-10-2010, 11:23 PM
great widget...
can anyone help with 2 things?
1. How do I add a link at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?
2. Add a small icon image next to all events (https://vborg.vbsupport.ru/external/2011/08/21.gif ).

Any help is much appreciated :)

Yet another reason why these types of features should be included as standard VB rather than relying on hacks. Why cant VB figure this out? Other CMS systems already have a rich set of widgets (aka blocks) such as Xoops. It just seems as if there is a lot of room for improvement in the wigget space for modules.

level8
05-11-2010, 10:33 AM
great widget...
can anyone help with 2 things?
1. How do I add a link at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?
2. Add a small icon image next to all events (https://vborg.vbsupport.ru/external/2011/08/21.gif ).

Any help is much appreciated :)

The option 2 isnt super important at the moment just cosmetics really....

but I tried to insert simple html link into the code but wouldnt work .. anyone?

ngcoders
05-14-2010, 07:12 AM
@level8

1. append the link to $output_bits.
2. prepend icon near

<a href="calendar.php?do=getinfo&e=%d">%s</a>


And some css to fix alignment issues.

mattpist
05-16-2010, 05:45 AM
i tried copying and pasting the code into a forum block, but nothing shows up. is there a way to adapt this to forum blocks? thanks!

JesusPokerChile
05-16-2010, 09:21 PM
Any help on recurring events???

vilhiem
05-17-2010, 02:41 AM
ya ... appears to only show the FIRST of a recurring events series. Is there any way to resolve this ...? Thanks! Otherwise, great mod!!!

vilhiem
05-17-2010, 02:59 AM
and ... grrr ... it's off by a day!!! was there something here I missed to fix this ...?

JesusPokerChile
05-19-2010, 01:07 AM
Hi really need help on recurring events!!! PLEASE HELP SOME ONE!

Guust
05-19-2010, 11:12 AM
and ... grrr ... it's off by a day!!! was there something here I missed to fix this ...?
Try this: https://vborg.vbsupport.ru/showpost.php?p=1944388&postcount=33

ssanin
05-19-2010, 11:54 AM
Try this: https://vborg.vbsupport.ru/showp...8&postcount=33

link doesn't work :( mine is off by a day as well.

Guust
05-19-2010, 12:48 PM
link doesn't work :( mine is off by a day as well.Updated the link: https://vborg.vbsupport.ru/showpost.php?p=1944388&postcount=33

ssanin
05-19-2010, 06:00 PM
Thank you very much! Love it :)

level8
05-20-2010, 07:48 AM
@level8

1. append the link to $output_bits.
2. prepend icon near

<a href="calendar.php?do=getinfo&e=%d">%s</a>


And some css to fix alignment issues.
Thanks for the code.. but complete newbie on this type of code.. how/where do I add this into the orginal code above???

schlottkej
06-04-2010, 12:57 AM
What changes need to be made to make this work as a BLOCK in the sidebar?

Leeleemu
06-04-2010, 11:12 AM
What changes need to be made to make this work as a BLOCK in the sidebar?

I second this, would be a great addition :)

In fact is there an area which is dedicated on creating certain forum blocks?

Stadler
06-04-2010, 02:23 PM
Nice widget, but it won't show 'All Day'-events.

To fix this find:$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

and replace it with:$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%1\$d' || ( dateline_from > '%1\$d' AND dateline_to < '%1\$d' ) || (dateline_to = 0 AND DATE(FROM_UNIXTIME(dateline_from)) = DATE(FROM_UNIXTIME(%1\$d)))) ORDER BY dateline_from ASC LIMIT %2\$d",TIMENOW,$show_count);


HTH,
Christian Stadler

schlottkej
06-04-2010, 02:25 PM
I second this, would be a great addition :)

In fact is there an area which is dedicated on creating certain forum blocks?

No, I don't believe there is. Would be great to see one.

Leeleemu
06-05-2010, 08:03 AM
how can fix to show the event of current day?

Anyone, for instance the Cotto v Foreman fight has been on the widget all week but now its come to the day of the fight it has disappeared, therefore, is there any way to keep today's event on the widget?

Stadler
06-05-2010, 10:11 AM
Anyone, for instance the Cotto v Foreman fight has been on the widget all week but now its come to the day of the fight it has disappeared, therefore, is there any way to keep today's event on the widget?
It this an 'All Day'-event? Then check my post (https://vborg.vbsupport.ru/showpost.php?p=2048234&postcount=131) and see if that fixes it for you.

Leeleemu
06-06-2010, 03:25 PM
It this an 'All Day'-event? Then check my post (https://vborg.vbsupport.ru/showpost.php?p=2048234&postcount=131) and see if that fixes it for you.

Sadly no dice. It turns my whole Front page off giving it an error. :confused:

Stadler
06-09-2010, 11:36 PM
Try again. I fixed a typo in my post above. It should work now.

your24hourstore
06-10-2010, 08:59 PM
ahha i just noticed something

the problem only occurs if you don't use ranged events and set an end date ...

to make it work correctly you have to have a starting and ending day.
so the weird thing happens only on single all day events
haven't tried reoccurring yet !
works i figured it out now

installed

Leeleemu
06-13-2010, 09:45 AM
Try again. I fixed a typo in my post above. It should work now.

Nope doesnt work. This is annoying.

Thanks for helping though Stadler. :)

vilhiem
06-13-2010, 02:29 PM
The two issues that seem to persist are:

(1) Getting re-curring events to display after the initial day (even though I have specific date ranges); and
(2) Getting the current day's events to display

Otherwise, it's a great mod and in spite of these issues, I use it on my main page.

Think it's funny that vBulletin does not provide this as a built-in feature (similar to their built-in feature that displays recent posts)

Stadler
06-13-2010, 10:15 PM
Nope doesnt work. This is annoying.

Thanks for helping though Stadler. :)
What 'doesnt work'? Can you please be more specific?

[Edit:]Here's the full code in my widget:ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%1\$d' || ( dateline_from > '%1\$d' AND dateline_to < '%1\$d' ) || (dateline_to = 0 AND DATE(FROM_UNIXTIME(dateline_from)) = DATE(FROM_UNIXTIME(%1\$d)))) ORDER BY dateline_from ASC LIMIT %2\$d",TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php5?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content"> %s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

vilhiem
06-16-2010, 04:00 PM
Are there any other mods out there that may do this and display the events accurately ...?

Webbstre
06-23-2010, 11:18 AM
Copied the code into a Forum Block and it worked perfectly. Thanks!

Eq4bits
06-29-2010, 09:33 PM
My forum has more than one calendar. Is there any way to only pull events from a specific calendar instead of all of them lumped together?

khuhner
07-01-2010, 12:13 AM
This widget doesnt handle reocurring events very well. It lists the beginning and ending date of the range of the event, rather than each instance as one would expect. Anyone have any luck in modifying this?

Eq4bits
07-01-2010, 01:32 AM
Copied the code into a Forum Block and it worked perfectly. Thanks!
I couldn't get it to work this way, perhaps I should have chosen pure text instead of php?

COL NIL SATIS
07-01-2010, 06:15 PM
Copied the code into a Forum Block and it worked perfectly. Thanks!

does this work ???? :confused:

is the block set as

Choose which content type do you want to use:
Pure Text - Display Pure Text content
HTML - Parse HTML code and display
PHP - Parse PHP code and display

LBmtb
07-04-2010, 04:27 PM
Nice, simple, and effective. Thanks :)

COL NIL SATIS
07-07-2010, 09:29 PM
I couldn't get it to work this way, perhaps I should have chosen pure text instead of php?

Tried as PHP but still no luck .......any chance that someone can get this working in a forum sideblock ??? :(

Leeleemu
07-15-2010, 09:44 AM
What 'doesnt work'? Can you please be more specific?

Sorry been away, by not working, I mean when I add your code, once again the day of the event is stated as being the day before, furthermore on the day, the event still disappears.

Anyway, currently with the original code and edit (to make the days the correct one), I have an event for the 1st August 2010 but it is labelling it as on the 32th July? :confused:

rabidkevin
07-23-2010, 03:37 PM
I am petitioning on vbulletin.com to implement this as part of the vbulletin code and release us an upcoming events widget.. everyone please voice your opinion about this here -> http://www.vbulletin.com/forum/showthread.php?358039-Upcoming-Events-CMS-Widget&p=2014317#post2014317

Testing123
07-26-2010, 05:48 AM
Maybe we could kill two birds with one stone (so to speak). Looking at the code line by line, people knowledgeable in php and vB could explain what's going on with that code line. Maybe we could learn a few things and end up with a needed widget. :-)
I'll start, using Stadler's code (I hope you don't mind, Stader).

Please jump in with any/all info and/or insight you can offer and don't hesitate correct any errors with my comments/logic. Thanks!
In php, we use // to make a single-line comment or /* and */ to make a large comment block.
I'll use /*...*/ for my comments as there is a line in the code that uses // and I'm not sure why it's there.
Comments will be placed before (above) the line(s) of code they reference.

-+-+-+-+-+-+-+-+
UPDATE – July 31, 2010
I've edited a few areas in my comments as I've gained a bit more insight into php and the code.
Hope this helps someone. And I really hope others will join in!
-+-+-+-+-+-+-+-+

OK, here we go:

/* Since there is a parentheses after ob_start, this is obviously a function call. */
/* I guess vB needs this to indicate the start of a php widget */

ob_start();


/* What is this used for? // is used to denote a single line comment */
/* (i.e. not processed as part of the program by php interpreter). */
/* It's not indicating anything I can see in the code. */
/* Why is it included? */

// %d

/* Obviously $show_count is a variable, set to a value of 5 as seen */
/* in the set up of the database query line that follows this one. */

$show_count = 5;


/* This sets up a MySQL database query with the results placed in the $query variable. */
/* sprintf is used to write a formatted string to a variable (in this case, $query). */
/* Variables, values, strings, etc. are integrated into the string using */
/* conversion specifications which are passed in as arguments to the */
/* sprintf function. E.g. you can pass in a value and require that value to be an integer. */
/* Apparently, sprintf is commonly used in SQL calls to 'sanitize' the string. */

/* The argument parameters will be inserted at the percent (%) signs in the main string. */
/* In the following line, 2 percent formatters and 2 arguments are used. */
/* The arguments are the variables/strings/etc. that are placed at the end of the line, */
/* separated by commas. */
/* TIMENOW and $show_count are the 2 arguments in the following line. */

/ * %1\$d */
/* This is replaced by the TIMENOW variable and formatted as a signed decimal number. */
/* %1 says to use the first argument and $d says to make it a signed decimal number. */
/* A backslash (\) is used to separate the argument identifier from the format identifier. */

/* %2\$d */
/* This is replaced by the $show_count variable and formatted as a signed decimal number. */
/* %2 says to use the second argument. */

/* || means 'or' in php speak */
/* AND means 'and' in php speak */

/* I still don't (as yet) fully understand the date formatting. */

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%1\$d' || ( dateline_from > '%1\$d' AND dateline_to < '%1\$d' ) || (dateline_to = 0 AND DATE(FROM_UNIXTIME(dateline_from)) = DATE(FROM_UNIXTIME(%1\$d)))) ORDER BY dateline_from ASC LIMIT %2\$d",TIMENOW,$show_count);


/* This fetches the info from the database using the string built */
/* and stored in the $query variable. */
/* The results are stored in the $event_get array variable. */
/* Not sure why it's formatted the way it is. */

$event_get = vB::$db->query_read($query);


/*This sets the variable $output_bits to double quote character. Why is this needed? */

$output_bits = '';


/* While loop. */
/* $event (which is an array, right?) is the variable used */
/* to store the info retrieved in $event_get. */
/* While will loop until the function returns no more data */
/* (function returns 0 or false). */

while($event = vB::$db->fetch_array($event_get)) {


/*if/else conditional. */
/* Again, date formatting. Expanation here is again needed. :-) */

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}


/* sprintf is used again, this time to build a formatted output string. */
/* However, since this is within the loop, doesn't the $output_bits variable */
/* get rewritten each time through the loop? */

/* Wait a sec... the first part of this line is: */
/* $output_bits .= sprintf(' */
/* I notice a dot (.) just before the equals (=) sign. Does this concatenate (add to) */
/* the string with each iteration (instead of rewriting the contents of the variable each time)? */

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php5?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content"> %s</p>
</div>
',$event['eventid'],$event['title'],$format);
}


/* Why is $output equated to $output_bits? */
/* I guess vB internal code uses $output to print out (display) data in the widget, */
/* so a string must be built and then copied to this variable... right? */

$output = $output_bits;


/*This is obviously needed by vB to close the widget and clean up. */
/* ( Companion to ob_start() ). */

ob_end_clean();

Recronin
07-31-2010, 03:28 AM
@ngcoders
OMG I love you, this is exactly what I needed.

sulasno
08-19-2010, 01:45 AM
working in 4.0.6

FatalCure
08-20-2010, 05:26 PM
Can someone convert this code to a forum block? If I try using the existing code in a forum block I get the following error.

Fatal error: Class 'vB' not found in /home/public_html/includes/block/html.php(95) : eval()'d code on line 9

ProFifaLeagues
08-20-2010, 05:44 PM
Be good to have it in the Forum blocks as well :)

ragtek
08-20-2010, 06:48 PM
same code just add at the end
return $output;

FatalCure
08-21-2010, 08:54 PM
same code just add at the end
return $output;

I still get Fatal error: Class 'vB' not found in /home/public_html/includes/block/html.php(95) : eval()'d code on line 9

ragtek
08-21-2010, 08:57 PM
what's your code?

FatalCure
08-22-2010, 12:40 AM
what's your code?

ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;


ob_end_clean();
return $output;


in a forum block as php.

FatalCure
08-23-2010, 03:41 AM
Also single day events do not show if the event is that day, it would be good if it showed the entire day the event was on.

betts02
08-23-2010, 07:16 AM
Been waiting for this to be made to work in a forum block, hope it can be sorted

ragtek
08-23-2010, 07:37 AM
ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;


ob_end_clean();
return $output;


in a forum block as php.

As i said, it's working fine for me.

betts02
08-23-2010, 07:59 AM
vb4.0.5 and not even showing up, tried the code you posted but for some reason nothing at all shows up

EDIT :

Confirms it works BUT....

It does not show the event on the day, it only shows the events leading up to the date, and not on the date of the event

The dates are moxed up, I posted a test event for tomorrow, yet this shows it for today

ragtek
08-23-2010, 08:09 AM
Yea, just wanted to write the same^^

TransAmDan
08-23-2010, 01:32 PM
How about Repeated events. It doesn't appear to show them.

The regular Calendar is here:- http://forum2.solent-renegades.co.uk/calendar.php we have a club night every other Tuesday.

However it doesn't show up on your widget:- http://forum2.solent-renegades.co.uk/content.php

Great mod by the way. It was just what I needed. I haven't started learning PHP yet, I've come from an ASP / VB background. PHP looks simple enough but at this point I wont be looking into modifying your code.

FatalCure
08-23-2010, 02:39 PM
Anyone know what could be causing my error?

sulasno
08-24-2010, 04:32 PM
can this widget include holidays?

bassmonkeys
08-28-2010, 08:26 PM
the mod works all good, except - what several users wrote - the events of the actual day are not displayed.

i have browsed the whole discussion and did not find a solution - if anyone can help that would be great!

FatalCure
08-30-2010, 04:56 AM
the mod works all good, except - what several users wrote - the events of the actual day are not displayed.

i have browsed the whole discussion and did not find a solution - if anyone can help that would be great!

Yep this would be great.

FatalCure
09-10-2010, 03:58 AM
bump

doopz
09-10-2010, 02:18 PM
How about we all put our heads together and donate some money for someone to make a proper mod with all the needs we have?

In any case if there is a coder out here with knowledge of vbulletin coding who can make a custom event schedule, please contact me using the PM system. Paid.

khuhner
09-11-2010, 02:08 AM
It seems as if this module either has issues with repeating events or the cache or both. In the attachment you'll see the circled event that occurred on Sept 8, yet today Sept 10th the event is still being shown.

As for this

How about we all put our heads together and donate some money for someone to make a proper mod with all the needs we have?

In any case if there is a coder out here with knowledge of vbulletin coding who can make a custom event schedule, please contact me using the PM system. Paid.

I'd ask, why we should we pay for a mod that should really be included in the core vB as part of the product?

FatalCure
09-11-2010, 10:15 AM
How about we all put our heads together and donate some money for someone to make a proper mod with all the needs we have?

In any case if there is a coder out here with knowledge of vbulletin coding who can make a custom event schedule, please contact me using the PM system. Paid.

Will donate $50 here.

khuhner
09-23-2010, 11:49 PM
It seems as if this module either has issues with repeating events or the cache or both. In the attachment you'll see the circled event that occurred on Sept 8, yet today Sept 10th the event is still being shown.

As for this



I'd ask, why we should we pay for a mod that should really be included in the core vB as part of the product?

BUMP

I rely heavily on recurring events. Any luck in getting this fixed?

Kurt

FatalCure
09-24-2010, 07:28 PM
Anyone know what I could do to troubleshoot my problem, on the cms page it works fantastically, however if I add it into a forum block it tells me...

Fatal error: Class 'vB' not found in /home/public_html/includes/block/html.php(95) : eval()'d code on line 9

Is there something I could change in my server config that would be causing this? I've tried disabling all plugins etc and have had no luck.

khuhner
09-26-2010, 01:49 PM
Do the developers (ngcoders) for this mod ever log into vb.org anymore? It's quite frustrating that a seemingly easy widget and one that most people would use has so many limitations and MINIMAL developer support.

This is yet another reason to have widgets officially provided with VB (not as a hack or mod!) as part of the offering. That way they will work, we can track enhancements and lastly and most importantly it will be supported. Most other mature CMS portals have a ton of prepackaged widgets.

What does everyone else think?

doopz
09-26-2010, 05:17 PM
We need people putting more attention to it at vbulletin.com, this way it will get more priority. So I have been told :)

khuhner
10-02-2010, 08:31 PM
We need people putting more attention to it at vbulletin.com, this way it will get more priority. So I have been told :)

I hear ya! I actually logged several bugs in their tracker including one that was extensive overhaul of the calendar. Now we wait...

Kurt

NashChristian
10-05-2010, 04:31 AM
VOTE NOW! (http://tracker.vbulletin.com/browse/VBIV-7656)

vB has been taking their sweet time developing a corporate solution for this Calendar Widget. It has been logged in Jira, but there have only been TWO votes so far and it appears to have been deprioritized.

Please log into Jira and VOTE FOR THIS! It will only take you a minute: http://tracker.vbulletin.com/browse/VBIV-7656

A number of customer have asked for a calendar widget that will access the current site calendar. That is distinct from the current cms calendar widget that displays dates on which articles have been published. Wayne also feels this should get a high priority.

VOTE NOW! (http://tracker.vbulletin.com/browse/VBIV-7656)

khuhner
10-05-2010, 04:44 PM
vB has been taking their sweet time developing a corporate solution for this Calendar Widget. It has been logged in Jira, but there have only been TWO votes so far and it appears to have been deprioritized.

Please log into Jira and VOTE FOR THIS! It will only take you a minute: http://tracker.vbulletin.com/browse/VBIV-7656

I hear you on the Calendar. It's really pitiful. I voted for your Jira. I also entered in a Jira a long time ago, would everyone vote for that one as well?

http://tracker.vbulletin.com/browse/VBIV-7072

NashChristian
10-05-2010, 05:37 PM
I hear you on the Calendar. It's really pitiful. I voted for your Jira. I also entered in a Jira a long time ago, would everyone vote for that one as well?

http://tracker.vbulletin.com/browse/VBIV-7072

Voted! I cross-referenced the two requests as well.

theoutlawed
10-08-2010, 02:41 AM
Nice widget, but it won't show 'All Day'-events.

To fix this find:$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

and replace it with:$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%1\$d' || ( dateline_from > '%1\$d' AND dateline_to < '%1\$d' ) || (dateline_to = 0 AND DATE(FROM_UNIXTIME(dateline_from)) = DATE(FROM_UNIXTIME(%1\$d)))) ORDER BY dateline_from ASC LIMIT %2\$d",TIMENOW,$show_count);


HTH,
Christian Stadler

Thank you this fixed my issues. Been combing through this thread post by post and this is what fixed it for me.

Mark4865
10-11-2010, 02:00 PM
Hello,

Stupid question but I run 3 different event calendars, so if I create 3 different upcoming event widgets with 3 diffrent titles, how do I make each widget only check the right calendar for events??

khuhner
10-11-2010, 02:24 PM
Hello,

Stupid question but I run 3 different event calendars, so if I create 3 different upcoming event widgets with 3 diffrent titles, how do I make each widget only check the right calendar for events??

Actually not a stupid question. There's a lot of requests about enhancing the Calendar, as it currently provides very little in the way of configuration, features, etc.

You'll need to submit an enhancement request to get any changes to the calendar (or other products). I'd suggest doing that on vb.com, not here. There are at least two outstanding extensive calendar enhancement request in the Tracker. I submitted this one:

http://tracker.vbulletin.com/browse/VBIV-7072

and here's the other:

http://tracker.vbulletin.com/browse/VBIV-7656

I'd recommend adding your requirement to either/both (via comments) and be sure to 'vote' for each. The more peoiple vote the more likely it'll get assigned to a developer!


Kurt

Mark4865
10-11-2010, 03:26 PM
thanks for quick response Kurt, does this current widget in this post allow me to run 3 calendars with 3 different titled widgets and if so how do I get the correct one to know which calendar to take events off.??

khuhner
10-11-2010, 10:03 PM
thanks for quick response Kurt, does this current widget in this post allow me to run 3 calendars with 3 different titled widgets and if so how do I get the correct one to know which calendar to take events off.??

Well, if you read the detail of the Jira items, there isnt anything in there for support for multiple calendars. I would like that too, and I would strongly recommend you add your comments and suggestions directly to the Jira on vb.com rather than posting here.

Here are the two items:

http://tracker.vbulletin.com/browse/VBIV-7072
http://tracker.vbulletin.com/browse/VBIV-7656


Kurt

Eduardo Leon
10-11-2010, 10:12 PM
this work like a widget ..

this is right ?

well i try to use this in my forum ... !

mse2k
10-22-2010, 03:50 PM
This is my code. It shows all upcomming events and the events on the actually day. But it shows not only 2 how in $show_count, it shows all. Can you help me. THX

ob_start();


// %d
$show_count = 2;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event

WHERE visible = 1
AND (dateline_from >= '%d' || dateline_to >= '%d' )

ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("Am %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']));
} else {
$format = sprintf("Vom %s <br>bis %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']), vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

miata.shark
11-30-2010, 01:06 AM
How can I manage repeated events?
i.e. I want to display "each tuesday" for a repeated meeting

I set an if about recurring and then I should pick the recuroption............ but how can I treat something like "1|4"?

khuhner
12-01-2010, 12:46 PM
How can I manage repeated events?
i.e. I want to display "each tuesday" for a repeated meeting

I set an if about recurring and then I should pick the recuroption............ but how can I treat something like "1|4"?

Unfortunately the mod doesnt do that. There has been several items added to the bug Tracker on vb.com that are related to your problem. I strongly encourage everyone to vote for BOTH items as many sites require more sophisticated Calendar support.

http://tracker.vbulletin.com/browse/VBIV-7072
http://tracker.vbulletin.com/browse/VBIV-7656


Kurt

level8
12-30-2010, 03:01 PM
please help with one more bit of info :)

by default it list the NAME/DATE... I have a custom field (a website link) to fill in when people add an event. I can get a third line to display (below code) but what to I do to make the info in this field appear in the link?

code I have used is:
<p class="cms_widget_post_content" style="font-size:9px; margin-bottom:5px"><a href="#">homepage</a></p>
</div>
What would I need to change the # to to make the info in my customfieldid=2 appear???

any help appreciated.

Mark4865
01-30-2011, 12:24 PM
Is there a way to get the event to still show on the day it is taking place and only go away the day after

JimboSlice
01-30-2011, 02:10 PM
This is my code. It shows all upcomming events and the events on the actually day. But it shows not only 2 how in $show_count, it shows all. Can you help me. THX

I have looked at cant find the cause, if someone else can help that would be great.

JimboSlice
02-11-2011, 05:00 PM
Can someone fix mse2k code so it doesnt show all events?

JimboSlice
02-16-2011, 11:17 AM
does anyone have one of these that works correctly with vb 4.1.x?

ngcoders
02-16-2011, 04:17 PM
does anyone have one of these that works correctly with vb 4.1.x?

Yep it works fine.

JimboSlice
02-16-2011, 05:18 PM
the dates are always a day off, or doesnt show todays events, only future.

alexm
02-23-2011, 09:43 AM
doesnt show todays events, only future.

Is there a way to get the event to still show on the day it is taking place and only go away the day after

I think there is an error in the SQL query. It needs greater than or equal and less than or equal operators to include the current day, and the part for ranged events the operators were the wrong way round.

Try replacing the query with this:

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '%1\$d' || ( dateline_from <= '%1\$d' AND dateline_to >= '%1\$d' ) || (dateline_to = 0 AND DATE(FROM_UNIXTIME(dateline_from)) = DATE(FROM_UNIXTIME(%1\$d)))) ORDER BY dateline_from ASC LIMIT %2\$d",TIMENOW,$show_count);

This should display all day events before and on the day they are happening, and ranged events before and WHILE they are happening.

Alex

ash50210
02-24-2011, 06:57 AM
HI all,

after spend time reading all thread from pg 1 until 14 finally i was successfully made it happen. Thanks to all that contribute the idea here. so i would like to share the coding as per below:

----------------------------------------------------------------------------------------------------------------------

ob_start();

// %d
$show_count = 100;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '%1\$d' || ( dateline_from <= '%1\$d' AND dateline_to >= '%1\$d' ) || (dateline_to = 0 AND DATE(FROM_UNIXTIME(dateline_from)) = DATE(FROM_UNIXTIME(%1\$d)))) ORDER BY dateline_from ASC LIMIT %2\$d",TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();
return $output;
---------------------------------------------------------------------------------------------------------------------
This code suppose can show u all range of events.
cheers!

JimboSlice
02-24-2011, 11:51 AM
the dates are all wrong when its displayed on my page. In fact, tomorrows events show as happening today and the date listed is todays date, instead of tomorrows.

Ruhl49
02-26-2011, 03:49 PM
Still one day off, i.e. it's on the calendar for the 27th, but the "Upcoming Events" widget shows "26th Feb 2011"...

jgt58
02-26-2011, 03:57 PM
same here , had to disable

jgt58
02-26-2011, 04:15 PM
I think that some coders already know the answer, but do not show us how?
a friend of mine has been added to my code (or the entire code) =





ob_start();

$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$datefrom = date('j',$event['dateline_from']);
$datefrom = $datefrom+1;
$format = sprintf("On ".$datefrom."th %s",date('M Y',$event['dateline_from']));
} else {
$datefrom = date('j',$event['dateline_from']);
$datefrom = $datefrom + 1;
$dateto = date('j',$event['dateline_to']);
$dateto = $dateto + 1;
$format = sprintf("From ".$datefrom."th %s to ".$dateto."th %s",date('M Y',$event['dateline_from']),date('M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();


Set your GMT time, standard for me + 1 (change it) and it should work.
if a coder could take the data from the + or - GMT time and replacing the code in my (+ 1)then it should work. but what I was thinking. is that the data is taken from a wrong place.

guys , just fyi , this code fixed my block.

lsgworldl
02-27-2011, 06:39 AM
after i added this all i got was a white screen to my site

otterag
03-01-2011, 05:20 PM
first i want to say that is a great mod. i have a few questions though.
- Is there a way to change the information that is displayed in the widget box. instead of having it show the date ranges of the event i would like to see it display the Date of the next event upcoming along with the day of the week and the start time

Example
Currently it shows
"Name of Event"
"From 4th March 2011 to 4th July 2011"

What i would like it to show would be
"Name of Event"
"Friday, March 4th @ 3:00pm"

wonderfulwat
03-28-2011, 05:52 AM
I have this on the cms homepage (www.WonderfulWaterloo.com), but I'd like to know how I can have it show up on the forumdisplay template. For example, I want it to show up on this page: www.wonderfulwaterloo.com/election

mmcguire
04-26-2011, 10:16 PM
guys , just fyi , this code fixed my block.

Thank you, this worked perfectly.

tomsch
04-28-2011, 11:32 PM
ok I know why we are having troubles with some of the dates being a day behind.

In my opinion there is a bug in the calendar. when you post a range event is puts in a time zone entry and if DST is active.

a single event does not.

i will be posting a bug report for this.

as a work around just add the missing data to the fields and all works well

does any know how to use the utz and dst fields to adjust our times??

tomsch
04-29-2011, 12:20 AM
ob_start();
global $db,$vbulletin;

// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
} else {
$format = sprintf("From %s to %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true),vbdate('jS M Y',$event['dateline_to'],false,true,false,true));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();


see if this work around solves the problem

tomsch
05-05-2011, 12:20 AM
ob_start();
global $db,$vbulletin;

// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
} else {
$format = sprintf("From %s to %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true),vbdate('jS M Y',$event['dateline_to'],false,true,false,true));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();



in this widget the %d is the placeholder for todays date.

can anyone tell me where the placeholder is being set to the date??

tomsch
05-05-2011, 11:17 PM
answered my own question sorta

Please test this version out i beleive it account for DST and time zones


ob_start();
global $db,$vbulletin;

$mydate3 = mktime(0, 0, 0, 5, 4, 2011);
// %d
$show_count =10;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '$mydate3' || ( dateline_from >= '$mydate3' AND dateline_to <= '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
} else {
$format = sprintf("From %s to %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true),vbdate('jS M Y',$event['dateline_to'],false,true,false,true));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

Gholsie
05-06-2011, 06:02 PM
Just tried tomsch's last version and the dates are showing correctly.

Gholsie
05-06-2011, 06:02 PM
Guys, is there a way I can show a link at the end of the widget that says "More..." and it has a link to my calendars?

billstelling
05-14-2011, 06:04 PM
I have tried all the ones everyone has posted and can't get ant to show at all. just nothing. I can switch it to text and it will show it then, as text of couse, but when set to php I get nothing..

129072

TheChief
05-14-2011, 06:42 PM
All installed and working correctly

Installed as per the code in tomsch's post

tomsch
05-14-2011, 11:54 PM
I have tried all the ones everyone has posted and can't get ant to show at all. just nothing. I can switch it to text and it will show it then, as text of couse, but when set to php I get nothing..

129072

you should create a

PHP Direct Execution widget and paste the code in my earlier post

TheChief
05-15-2011, 04:43 PM
I'm after showing dates & times in English.....this is the current code in use:

ob_start();

// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("<b>Am:</b> %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']));
} else {
$format = sprintf("<b>Vom:</b> %s<br /><b>Bis:</b> %s", vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_from']), vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

thanks

tomsch
05-15-2011, 05:18 PM
I'm after showing dates & times in English.....this is the current code in use:

ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("<b>Am:</b> %s", vbdate(VB::$vbulletin->options['dateformat'],$event['dateline_from']));
} else {
$format = sprintf("<b>Vom:</b> %s<br /><b>Bis:</b> %s", vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_from']), vbdate(VB::$vbulletin->options['dateformat'] . ' ' . VB::$vbulletin->options['timeformat'],$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

thanks

this code has problems in the query use the code found in this post it will solve some of them


https://vborg.vbsupport.ru/showpost.php?p=2192476&postcount=211

TheChief
05-15-2011, 05:41 PM
Alas, this code shows up all the old data which i dont want displayed

tomsch
05-16-2011, 08:23 PM
Alas, this code shows up all the old data which i dont want displayed

old data??? what are you trying to do?

TheChief
05-16-2011, 09:55 PM
What I'm after is the upcoming events to be displayed.

And (if ranged) the start and end times

In english

No historical events to be displayed

Sorry to be a pain in the ass

tomsch
05-16-2011, 10:20 PM
ok the code in my earlier post does that. how ever it only displays the date are you say you want the time displayed also??

TheChief
05-17-2011, 05:06 AM
If you could that'd be great :)

TheChief
05-17-2011, 05:13 AM
This is the code i'm currently using.......


ob_start();

$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$datefrom = date('j',$event['dateline_from']);
$datefrom = $datefrom+1;
$format = sprintf("On ".$datefrom."th %s",date('M Y',$event['dateline_from']));
} else {
$datefrom = date('j',$event['dateline_from']);
$datefrom = $datefrom + 1;
$dateto = date('j',$event['dateline_to']);
$dateto = $dateto + 1;
$format = sprintf("From ".$datefrom."th %s to ".$dateto."th %s",date('M Y',$event['dateline_from']),date('M Y',$event['dateline_to']));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><center><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p></center>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();


This does everything but the time..............and it seems to remove a planned event for the day as soon as the clock turns midnight (i.e. if there is a meet planned for the 17th May then as the clocks turn from 23:59 (tues) - 00:00 (weds) the event is removed

tomsch
05-18-2011, 12:15 AM
ob_start();
global $db,$vbulletin;

$mydate3 = mktime(0, 0, 0, date("m"), date("d"), date("Y"));

// %d
$show_count =10;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '$mydate3' || ( dateline_from >= '$mydate3' AND dateline_to <= '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
} else {
$format = sprintf("From %s to %s",vbdate('D M jS Y h:i:s A',$event['dateline_from'],false,true,false,true),vbdate('jS M Y h:i:s A',$event['dateline_to'],false,true,false,true));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;


this will display the times for the Range events. But there is a small catch when you enter the range event leave the time zone setting to GMT.

i left off the time for the all day event as its always the same time because of the way its stored.

i also fixed a bug in my code the mydate3 variable was commented out for my fixed date.

TheChief
05-19-2011, 05:29 AM
Thanks for this..............fantastic stuff

Works perfect and is exactly what i was after

Have a huge bag of kudos :)

TransAmDan
05-27-2011, 01:40 PM
first i want to say that is a great mod. i have a few questions though.
- Is there a way to change the information that is displayed in the widget box. instead of having it show the date ranges of the event i would like to see it display the Date of the next event upcoming along with the day of the week and the start time

Example
Currently it shows
"Name of Event"
"From 4th March 2011 to 4th July 2011"

What i would like it to show would be
"Name of Event"
"Friday, March 4th @ 3:00pm"

I'm having the same issue and also looking for a solution to this.

top dogs 360
06-15-2011, 09:11 PM
ob_start();
global $db,$vbulletin;

$mydate3 = mktime(0, 0, 0, date("m"), date("d"), date("Y"));

// %d
$show_count =10;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '$mydate3' || ( dateline_from >= '$mydate3' AND dateline_to <= '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
} else {
$format = sprintf("From %s to %s",vbdate('D M jS Y h:i:s A',$event['dateline_from'],false,true,false,true),vbdate('jS M Y h:i:s A',$event['dateline_to'],false,true,false,true));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;


this will display the times for the Range events. But there is a small catch when you enter the range event leave the time zone setting to GMT.

i left off the time for the all day event as its always the same time because of the way its stored.

i also fixed a bug in my code the mydate3 variable was commented out for my fixed date.

Two issues, 1) if you leave the time zone to GMT it looks good for the widget but the actual Event shows the event 7 hours behind. Obviously the event creator is GMT -7. Isn't there a way to incorporate a offset time zone in the code?
2) The code is working fine but it shows all events in the widget not the 10 as the cutoff is set for. Can that be fixed?

top dogs 360
06-15-2011, 09:52 PM
Okay this works for me and should fix anyone's problem whether it is ranged events or single day events or the 1 day early problem.


ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

$tz_offset = 86400;
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('M jS Y',($event['dateline_from']+$tz_offset)));
} else {
$format = sprintf("From %s to %s",date('h:i A M jS Y',($event['dateline_from'])),date('h:i A M jS Y',($event['dateline_to'])));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

It is set to cut off at 5 events, you can adjust that via $show_count = 5.

It has a timezone offset of 1 day via seconds for the 1 day early issue here $tz_offset = 86400

Its format for date is set to Time, Date, Month, and Year via here $format = sprintf("From %s to %s",date('h:i A M jS Y',($event['dateline_from']+$tz_offset)),date('h:i A M jS Y',($event['dateline_to'])));.

And here for the all day events that do not include time of day ; $format = sprintf("On %s",date('M jS Y',($event['dateline_from']+$tz_offset)));
} else {


I am still debating on dropping the Year form the widget since 99% of the time the next 5 events are in the same year anyway. To do that simply drop the Y from the M jS Y or h:i A M jS Y


See it live, 3rd block from the top on the right column. http://xboxhounds.com

I'm simply an amateur but I'm learning with as I go.

Mooff
06-15-2011, 11:25 PM
You can customize the date however you want, see the php documentation:
http://www.php.net/manual/en/function.date.php

The time offset should be in the database-query, not in your output date.

As for showing Users their local time. I thought about changeing the widget that way, but then i think i can't use the cms-widget-cache anymore on this particular widget. I just can't imagine the widget beeing created for multiple timezones in the cache. ;)
Second issue with local time is the utc-column in the event-db-table. You need to correct for that value as well, depending on which timezone the user chose upon adding the event.


---------------------------------

Thanks to the creator of the widget. Great work, great idea. :)

tomsch
06-16-2011, 12:13 AM
ob_start();
global $db,$vbulletin;


$mydate = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
$show_count =10;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from >= '$mydate' || ( dateline_from >= '$mydate' AND dateline_to <= '$mydate' )) ORDER BY dateline_from ASC LIMIT $show_count");

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
} else {
$format = sprintf("From %s to %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true),vbdate('jS M Y',$event['dateline_to'],false,true,false,true));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();


ok good catch on the limit not work its fixed in this version i'm cleaning up the code a little to make it easier to setup.

htan68
06-16-2011, 02:06 PM
@tomsch
Thank you, this works for my page with +8 timezone.

Eq4bits
06-24-2011, 05:08 PM
Okay this works for me and should fix anyone's problem whether it is ranged events or single day events or the 1 day early problem.


ob_start();


// %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to < '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

$tz_offset = 86400;
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('M jS Y',($event['dateline_from']+$tz_offset)));
} else {
$format = sprintf("From %s to %s",date('h:i A M jS Y',($event['dateline_from'])),date('h:i A M jS Y',($event['dateline_to'])));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

It is set to cut off at 5 events, you can adjust that via $show_count = 5.

It has a timezone offset of 1 day via seconds for the 1 day early issue here $tz_offset = 86400

Its format for date is set to Time, Date, Month, and Year via here $format = sprintf("From %s to %s",date('h:i A M jS Y',($event['dateline_from']+$tz_offset)),date('h:i A M jS Y',($event['dateline_to'])));.

And here for the all day events that do not include time of day ; $format = sprintf("On %s",date('M jS Y',($event['dateline_from']+$tz_offset)));
} else {

I used the above code but the current date & it's events are not showing; just the next day's date & it's events. Any ideas?

tomsch
06-24-2011, 10:26 PM
I used the above code but the current date & it's events are not showing; just the next day's date & it's events. Any ideas?

yes use the last code i posted its working for all cases

Eq4bits
06-25-2011, 01:51 AM
Thanks muchly. Don't know how I missed that post, I *thought* I'd read all 16 pages ;)
Would you happen to know of a way to either put the 'from/to' *above* the 'event'? Or maybe a horizontal bar/separator between each event in the list? I've been playing with it but no luck.

Eq4bits
06-25-2011, 04:21 AM
Ugh. Hate to bug ya but.... everything is working/showing properly *except* the 'to' date... it's showing 1 day extra.
i.e. date range is 12:01 AM July 1 2011 to 11:59 PM July 7 2011
yet in widget it's showing as From Fri Jul 1st 2011 to 8th Jul 2011

tomsch
06-26-2011, 07:12 PM
Ugh. Hate to bug ya but.... everything is working/showing properly *except* the 'to' date... it's showing 1 day extra.
i.e. date range is 12:01 AM July 1 2011 to 11:59 PM July 7 2011
yet in widget it's showing as

thanks for the bug report i'll get it resolved shortly.

i also added to my version the ability to have and image that is in the event to be displayed with each item.

i also added the capability to add a divideing line between events i just need a horizontal line image of the right size.

Eq4bits
06-26-2011, 10:14 PM
Another question....
If an event say lasts a week and the 'current' date/time is during that week (but after the 'start' date/time) the event isn't showing even though the event isn't 'completed'.

Eq4bits
06-26-2011, 10:20 PM
https://vborg.vbsupport.ru/external/2011/06/12.png
Here is a horizontal line that is 2px x 150px
If it needs to be a different dimension let me know ;)

tomsch
06-26-2011, 11:21 PM
Another question....
If an event say lasts a week and the 'current' date/time is during that week (but after the 'start' date/time) the event isn't showing even though the event isn't 'completed'.

another good catch

thanks

tomsch
06-26-2011, 11:34 PM
ok the range events not displaying is fixed in this version


ob_start();
global $db,$vbulletin;


$mydate = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
$show_count =10;

$query = sprintf(" SELECT * FROM ".TABLE_PREFIX."event
WHERE visible = 1
AND (dateline_from >= '$mydate' || (dateline_from >= '$mydate' AND dateline_to <= '$mydate' ) || ('$mydate' BETWEEN dateline_from AND dateline_to))
ORDER BY dateline_from ASC LIMIT $show_count");

$event_get = vB::$db->query_read($query);

$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {

if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true));
} else {
$format = sprintf("From %s to %s",vbdate('D M jS Y',$event['dateline_from'],false,true,false,true),vbdate('jS M Y',$event['dateline_to'],false,true,false,true));
}

$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

Eq4bits
06-27-2011, 07:12 AM
Awesome, tomsch! Thanks bunches!.
I added the horizontal line to mine like this:
<p class="cms_widget_post_content">%s<br><img src="images/hz-line.png"></p>

toxin
06-29-2011, 04:01 PM
Range events are working, but when there's a recurring event the widget only displays the range.

I have created a recurring event. The range is starting Jan 01, ending Dec 31 and the event is 1st Sunday of every month.

The event is listed, but the widget just displays this:

My Event
From Sat Jan 1st 2011 to 31st Dec 2011

And because the range started Jan 1st, this event is always at the top of the list.

rcull
07-02-2011, 02:38 AM
I just tried this code and got the following error:

Parse error: syntax error, unexpected T_STRING in /home/teambuic/public_html/forums/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 32

Thanks

tomsch
07-02-2011, 12:01 PM
[QUOTE=rcull;2215721]I just tried this code and got the following error:

Parse error: syntax error, unexpected T_STRING in /home/teambuic/public_html/forums/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 32

Thanks[/Q

sounds like you either have a cut and paste error or the widget configured wrong

rcull
07-02-2011, 12:59 PM
Thanks,
It was a cut and paste error!

kylek
07-31-2011, 08:53 PM
Awesome, tomsch! Thanks bunches!.
I added the horizontal line to mine like this:
<p class="cms_widget_post_content">%s<br><img src="images/hz-line.png"></p>


Where would you add this to the code? Looking for either a line between events or just a space.

Thanks tomsch for all your input you have added!

level8
08-17-2011, 06:21 PM
wow great updates thanks for making this even better... is it possible to add a generic icon next to each post?
if so where would you insert the code?

level8
08-17-2011, 06:29 PM
great widget...
can anyone help with 2 things?
1. How do I add a link at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?
2. Add a small icon image next to all events (https://vborg.vbsupport.ru/external/2011/08/21.gif ).

Any help is much appreciated :)

this is what i need help on :)

XrayHead
10-01-2011, 08:30 AM
Hi All

Anyone know how to lose the stupid PHP icon in the upper top left?

https://vborg.vbsupport.ru/external/2011/10/77.png