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)

Elenna 04-10-2012 11:21 AM

Hmm, I haven't updated to 4.1.12 yet (I usually like to have others find the remaining bugs!).

Does the widget work when that option is turned off?

Elenna 04-10-2012 03:52 PM

I have updated the code to work with single-day events, events that have already started but havn't ended, etc. Thanks to tomsch for the mkdate snippet!

I believe I got user time zone correction to work. Please see the following code:

Note: This version checks for the user's preferred date and time display settings (i.e. UK vs US, etc) and displays things accordingly. This can also pull from one or more selected calendars, per the instructions below (see orange comments).

PHP Code:

ob_start(); 
//Change $show_count to change how many events to display in the block
$show_count 5;
//Get the user's time zone
$user_tz vB::$vbulletin->userinfo['timezoneoffset'];
$tz_adjust $user_tz 3600;
$mydate =  mktime(000date("m"), date("d")-1date("Y"));
 
//Get events from the table
//Use the code below to pull from ALL calendars
$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"); 
//To pull from just certain calendars, comment out the above $query and uncomment the line below. Change the "AND calendarids in (1, 2, 3)" to match your calendar IDs to pull
//$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)) AND calendarids in (1, 2, 3) 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)) { 
 
// Convert user timezone offset into minutes
$offset $user_tz;
 
// Only adjust start times for ranged events; all-day events should keep their midnight start time.
     
if($event['dateline_to'] == 
     { 
         
$from $event['dateline_from']; 
     } else { 
         
$from $event['dateline_from'] + $tz_adjust;
     } 
$to $event['dateline_to'] + $tz_adjust
 
 
$fromDate trim(vbdate(vB::$vbulletin->options['dateformat'],  $fromfalsetruefalsetrue));
$toDate trim(vbdate(vB::$vbulletin->options['dateformat'],  $tofalsetruefalsetrue));
$fromTime trim(vbdate(vB::$vbulletin->options['timeformat'],  $fromfalsetruefalsetrue));
$toTime trim(vbdate(vB::$vbulletin->options['timeformat'],  $tofalsetruefalsetrue));
 
if(
$event['dateline_to'] == 
 { 
 
$format sprintf("%s",$fromDate); 
     } else { 
 
$format sprintf("%s %s - %s",$fromDate$fromTime$toTime);
 } 
 
$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(); 


SweCastel 04-10-2012 08:30 PM

Quote:

Originally Posted by Elenna (Post 2318651)
Hmm, I haven't updated to 4.1.12 yet (I usually like to have others find the remaining bugs!).

Does the widget work when that option is turned off?

When Article is optioned as "Show full i sectionpage:
http://mustangclubsweden.org/content.php/116-kalender

Same article, but when it is opened:
http://mustangclubsweden.org/content...%C3%A4vle-Dala

It worked before 4.1.12... :/

Help :)

Elenna 04-10-2012 09:47 PM

This mod is meant to be used as a "Widget", so I am not sure about it being used as an Article? :(

I don't use it like that, so hopefully someone else can provide some assistance?

SweCastel 04-11-2012 08:43 PM

I know, but it did work before. :/

//D

Elenna 04-12-2012 01:03 AM

When adding the code to the article, are you using the PHP Direct Execution "type"?

If so, did you leave the template as "vbcms_content_phpeval_page"?

officer cartman 04-13-2012 05:03 PM

i want to display the next event for the next 7 days like you can at the bottom of the main forum display
however i want them to display in the cms in a sidebar using a widget
anyone any ideas ?
using this i get the events but it shows from and to i just want the events for that week

SweCastel 04-22-2012 01:53 PM

Quote:

Originally Posted by Elenna (Post 2319239)
When adding the code to the article, are you using the PHP Direct Execution "type"?

If so, did you leave the template as "vbcms_content_phpeval_page"?

Yes :/

Captainhilts 04-22-2012 05:10 PM

works perfectly as widget. Love it!

Is it possible to change to display how many signed up?

level8 04-24-2012 07:33 PM

on the main screen shot it shows a line underneath each event... however with the code copied it does show any lines???

Help??


All times are GMT. The time now is 09:12 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.01402 seconds
  • Memory Usage 1,766KB
  • 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
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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