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)

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


Code:

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

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

Attachment 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

Quote:

Originally Posted by billstelling (Post 2195678)
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..

Attachment 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

Quote:

Originally Posted by TheChief (Post 2196024)
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....&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

Quote:

Originally Posted by TheChief (Post 2196042)
Alas, this code shows up all the old data which i dont want displayed

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


All times are GMT. The time now is 08:18 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.01227 seconds
  • Memory Usage 1,751KB
  • 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_code_printable
  • (3)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