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)

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

Quote:

Originally Posted by vilhiem (Post 2038299)
and ... grrr ... it's off by a day!!! was there something here I missed to fix this ...?

Try this: https://vborg.vbsupport.ru/showpost....8&postcount=33

ssanin 05-19-2010 11:54 AM

Quote:

Originally Posted by Guust (Post 2039774)

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

Guust 05-19-2010 12:48 PM

Quote:

Originally Posted by ssanin (Post 2039790)
link doesn't work :( mine is off by a day as well.

Updated the link: https://vborg.vbsupport.ru/showpost....8&postcount=33

ssanin 05-19-2010 06:00 PM

Thank you very much! Love it :)

level8 05-20-2010 07:48 AM

Quote:

Originally Posted by ngcoders (Post 2036784)
@level8

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

<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

Quote:

Originally Posted by schlottkej (Post 2048002)
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:
Code:

$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:
Code:

$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

Quote:

Originally Posted by Leeleemu (Post 2048154)
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

Quote:

Originally Posted by nader (Post 1956354)
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

Quote:

Originally Posted by Leeleemu (Post 2048660)
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 and see if that fixes it for you.

Leeleemu 06-06-2010 03:25 PM

Quote:

Originally Posted by Stadler (Post 2048694)
It this an 'All Day'-event? Then check my post 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

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

Quote:

Originally Posted by Stadler (Post 2051269)
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

Quote:

Originally Posted by Leeleemu (Post 2052890)
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:
PHP Code:

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

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

Quote:

Originally Posted by Webbstre (Post 2058044)
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

Quote:

Originally Posted by Webbstre (Post 2058044)
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

Quote:

Originally Posted by Eq4bits (Post 2062504)
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

Quote:

Originally Posted by Stadler (Post 2053144)
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/showt...17#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

Quote:

Originally Posted by ragtek (Post 2086993)
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

Quote:

Originally Posted by ragtek (Post 2087525)
what's your 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();
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.


All times are GMT. The time now is 07:11 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.01765 seconds
  • Memory Usage 1,870KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (17)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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