vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - Upcoming Events (https://vborg.vbsupport.ru/showthread.php?t=231365)

ngcoders 12-27-2009 10:00 PM

Upcoming Events
 
1 Attachment(s)
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

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'] == )
     {
         
$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

Quote:

Originally Posted by ngcoders (Post 1940005)
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
Quote:

?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

Quote:

Originally Posted by Big-Pete (Post 1940699)
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

Quote:

Originally Posted by ngcoders (Post 1941200)
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

Quote:

Originally Posted by wacodep (Post 1941438)
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) =




PHP 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'] == 
     { 
$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

Quote:

Originally Posted by ngcoders (Post 1947454)
@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, you should take care of this;)


For timeformating you can use the vbdate function: http://members.vbulletin.com/api/vBu...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:

Quote:

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

Quote:

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...?
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'] == )
{
$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?


All times are GMT. The time now is 06:28 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01702 seconds
  • Memory Usage 1,867KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete