Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Upcoming Events Details »»
Upcoming Events
Version: 1.00, by ngcoders ngcoders is offline
Developer Last Online: Sep 2012 Show Printable Version Email this Page

Category: vBulletin CMS Widgets - Version: 4.0.0 Rating:
Released: 12-27-2009 Last Update: Never Installs: 348
Auto-Templates
 
No support by the author.

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(); 

Screenshots

File Type: jpg events.jpg (14.8 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
level8, Toorak Times

Comments
  #222  
Old 05-16-2011, 09:55 PM
TheChief TheChief is offline
 
Join Date: Nov 2010
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #223  
Old 05-16-2011, 10:20 PM
tomsch tomsch is offline
 
Join Date: May 2003
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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??
Reply With Quote
  #224  
Old 05-17-2011, 05:06 AM
TheChief TheChief is offline
 
Join Date: Nov 2010
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you could that'd be great
Reply With Quote
  #225  
Old 05-17-2011, 05:13 AM
TheChief TheChief is offline
 
Join Date: Nov 2010
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is the code i'm currently using.......


Quote:
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
Reply With Quote
  #226  
Old 05-18-2011, 12:15 AM
tomsch tomsch is offline
 
Join Date: May 2003
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
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.
Reply With Quote
  #227  
Old 05-19-2011, 05:29 AM
TheChief TheChief is offline
 
Join Date: Nov 2010
Posts: 73
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for this..............fantastic stuff

Works perfect and is exactly what i was after

Have a huge bag of kudos
Reply With Quote
  #228  
Old 05-27-2011, 01:40 PM
TransAmDan TransAmDan is offline
 
Join Date: Nov 2009
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by otterag View Post
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.
Reply With Quote
  #229  
Old 06-15-2011, 09:11 PM
top dogs 360 top dogs 360 is offline
 
Join Date: Jul 2010
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tomsch View Post
Code:
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?
Reply With Quote
  #230  
Old 06-15-2011, 09:52 PM
top dogs 360 top dogs 360 is offline
 
Join Date: Jul 2010
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #231  
Old 06-15-2011, 11:25 PM
Mooff Mooff is offline
 
Join Date: Mar 2010
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:29 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05158 seconds
  • Memory Usage 2,362KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete