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)

Eq4bits 04-24-2012 08:14 PM

1 Attachment(s)
This is the code with the hz line, items you will need to change: which calendar, how many events, and location of the hz line image; the date format used is: m/d/Y if you'd rather dashes just change the '/'s to '-'s; if you'd rather d/m/Y then switch it to that display instead in both locations.
PHP Code:

ob_start(); 
global 
$db,$vbulletin;


$mydate =  mktime(000date("m"), date("d")-1date("Y"));
$calendarid="1";
$show_count =6

$query sprintf("    SELECT * FROM ".TABLE_PREFIX."event 
                    WHERE visible = 1 
                    AND calendarid='"
.$calendarid."' 
                                        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"); 
                    
$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",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true)); 
     } else { 
         
$format sprintf("From %s to %s",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true),vbdate('m.d',$event['dateline_to'],false,true,false,true)); 
     } 
      
     
$output_bits .= sprintf(
        <div class = "cms_widget_post_bit"><img src="images/****/hz-line.png"><br><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(); 

Attached is a hz line image you can feel free to use:

level8 04-25-2012 09:01 AM

Quote:

Originally Posted by Eq4bits (Post 2323179)
This is the code with the hz line, items you will need to change: which calendar, how many events, and location of the hz line image; the date format used is: m/d/Y if you'd rather dashes just change the '/'s to '-'s; if you'd rather d/m/Y then switch it to that display instead in both locations.
Attached is a hz line image you can feel free to use:

thanks for this will get it changed ASAP... wonder if you coudl help with 2 other things, tried to do it myself but just crashes :(


1. How do I add a link/button at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?

2. Add a small icon image next to all events (https://vborg.vbsupport.ru/images/cs.../forum_new.gif ).

Any help is much appreciated :)

ProFifaLeagues 04-25-2012 09:12 AM

Quote:

Originally Posted by level8 (Post 2323309)
thanks for this will get it changed ASAP... wonder if you coudl help with 2 other things, tried to do it myself but just crashes :(


1. How do I add a link/button at the bottom of the widget called somethign like "Add an Event" which simply will link to the http://****.com/calender.php?

2. Add a small icon image next to all events (https://vborg.vbsupport.ru/images/cs.../forum_new.gif ).

Any help is much appreciated :)


Superb Idea that and one i would love to know how to implement too:up:

Eq4bits 04-27-2012 03:13 AM

1 Attachment(s)
here is code for adding a small icon in front of each event listed:

to have it as a clickable link to the listed event use
PHP Code:

ob_start();
global 
$db,$vbulletin;

$mydate =  mktime(000date("m"), date("d")-1date("Y"));
$calendarid="1";
$show_count =6;

$query sprintf("    SELECT * FROM ".TABLE_PREFIX."event
                    WHERE visible = 1
                    AND calendarid='"
.$calendarid."'
                                        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");
                    
$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",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true));
     } else {
         
$format sprintf("From %s to %s",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true),vbdate('m/d/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"><img src="images/*****/light-color-calendar.gif"
style="border: 0px solid; border: 0px solid; width: 16px; height: 16px;">%s</a></h4>
            <p class="cms_widget_post_content">%s</p><img src="images/*****/hz-line.png" align="top">
         </div>
        '
,$event['eventid'],$event['title'],$format);

}

$output $output_bits;

ob_end_clean(); 

you'll need to put your calendar id # in and the # of events to show, as well as the addy/location of where you have the hz-line.png and the light-color-calendar.gif located in your files. I've attached the hz-line.png and the light-color-calendar.gif (Thanks for the gif level8 ;))


I'm still trying to get a clickable 'button'/image for the bottom for 'add new event' but, so far I've only been able to add that to each and every event listed (which seems a bit redundant to me); I'll continue to play with the code when I can to see if I can get it to display a single 'button'/image after the list of events. No promises ;)

Tri@de 04-27-2012 05:43 AM

There's a way to put an external link (got inside the event) instead of a link to the calendar event?

level8 04-27-2012 06:31 AM

BIG THANKS TO Eq4bits amazing work :)

Tr@de.. I know you can add custom fields to the event and Ive seen people import this on the events list (i.e. webpage link) for external events.. however finding anyone to help with the code has been difficult :(

Eq4bits 04-28-2012 01:09 PM

1 Attachment(s)
This is if you want an external link added (as well as a new calendar icon that is not a link itself... perhaps a bit more 'pleasing to the eye' to some (I also edited out the 'On' preceeding the date because it bugged me ;))

http://pendletonharbor.net/images/PH...st-events2.png

PHP Code:

ob_start(); 
global 
$db,$vbulletin;


$mydate =  mktime(000date("m"), date("d")-1date("Y"));
$calendarid="1";
$show_count =6

$query sprintf("    SELECT * FROM ".TABLE_PREFIX."event 
                    WHERE visible = 1 
                    AND calendarid='"
.$calendarid."' 
                                        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"); 
                    
$event_get vB::$db->query_read($query); 

$output_bits ''
while(
$event vB::$db->fetch_array($event_get)) { 

     if(
$event['dateline_to'] == 
     { 
         
$format sprintf("%s",vbdate('m/d/Y',$event['dateline_from'],false,true,false,true)); 
     } else { 
         
$format sprintf("From %s to %s",vbdate('m.d',$event['dateline_from'],false,true,false,true),vbdate('m.d',$event['dateline_to'],false,true,false,true)); 
     } 
      
     
$output_bits .= sprintf(
<div class="cms_widget_post_bit">
<h4 class="cms_widget_post_header">
<table>
<tbody>
<tr>
<td><img src="images/*****/cal.png" align:"center"=""
v-align:"middle"="">&nbsp;&nbsp;</td>
<td><a href="calendar.php?do=getinfo&amp;e=%d">%s</a><br>
<small><small><a href="http://*********">External Link</a></small></small>
<p class="cms_widget_post_content">%s</p>
</td>
</tr>
<tr align="center">
<td colspan="2" style="vertical-align: top;">
<h4 class="cms_widget_post_header"><img alt="line"
src="images/*****/hz-line.png" align="middle"></h4>
</td>
</tr>
</tbody>
</table>
</h4>
</div>
'
,$event['eventid'],$event['title'],$format); }

$output $output_bits

ob_end_clean(); 

Also attaching new calendar image and a 'shorter' hz-line image as the previous one was too wide to display correctly in the widget when on certain size sidebars/columns ;)

mrt12345 04-28-2012 01:28 PM

Thanks , but can you tell me the image path where to upload the new icons. Thanks:up:

mrt12345 04-28-2012 01:37 PM

ok thanks i figured it out, nice job, just fill in all the ********:o

level8 04-29-2012 07:26 AM

if anyone can help all we are working on now is getting the "external link" to be a custom field path... so you will keep the word "External link" however this will link to whatever the web path has been listed in the custom field.... any help appreciated :)

Tri@de 04-29-2012 10:14 AM

I modified the code to take the link on the event description (in this way you have only to write the link in the description), and also modified the code to select a different calendar. if you want it, just let me know.

ProFifaLeagues 04-29-2012 10:38 AM

Quote:

Originally Posted by Tri@de (Post 2324551)
I modified the code to take the link on the event description (in this way you have only to write the link in the description), and also modified the code to select a different calendar. if you want it, just let me know.


Be great if we can have it please Tri@de thank you :up:

Tri@de 04-29-2012 11:24 AM

Here you are!

Code:

ob_start();


//  %d
$show_count = 5;

$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE calendarid = 5 AND 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("Il %s",date('d-m-Y',$event['dateline_from']));
    } else {
        $format = sprintf("Dal %s al %s",date('d-m-Y',$event['dateline_from']),date('d-m-Y',$event['dateline_to']));
    }
 

    $output_bits .= sprintf('
        <div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><h4 class="cms_widget_post_header"><a href="%s" target="_blank">%s</a></h4>
            <p class="cms_widget_post_content">%s</p>
        </div>
        ',$event['event'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();

The red number id the calendar id you have to modify as you wish.
As i said before, in the description put only the link (including http:// ) or the link doesen't work properly.

level8 04-30-2012 11:18 AM

what if in the description there is 2 links?? how does it know which to pick up?

Tri@de 04-30-2012 12:10 PM

in the link, you find http://firstlink-secondlink i suppose.
i made it to get only a link.
The best for this widget is to make a customfield and using it for urls.

level8 05-03-2012 04:56 PM

yeah thats what I have done.. just importing the info from the custom field (the website address) and replacing it in the href="%s" target="_blank is proving tricky!!

Tri@de 05-03-2012 06:08 PM

Quote:

Originally Posted by level8 (Post 2325896)
yeah thats what I have done.. just importing the info from the custom field (the website address) and replacing it in the href="%s" target="_blank is proving tricky!!

you made with custom field?
can you give me the code?

level8 05-03-2012 06:18 PM

I just went into the calender and added a custom field.. it was part of the default options!

Tri@de 05-03-2012 06:49 PM

Quote:

Originally Posted by level8 (Post 2325918)
I just went into the calender and added a custom field.. it was part of the default options!

Yes, but how you put in the code. i tried, but i've done somthing wrong...

level8 05-03-2012 06:57 PM

thats what I cant do either :( find a way of feeding that into the widget :(

Tri@de 05-03-2012 07:12 PM

Ah.. yes, because, the customfields record have inside also the setting of the custom field. the only way is to separate the options

level8 05-09-2012 06:54 AM

mm.. still cant work it out :( anyone else had any joy on this?!?!

Kiint 05-16-2012 09:51 AM

What I would like on this is for it to show recurring events up to 4 weeks in advance, so if i had an event scheduled for every wednesday then the widget would show this event 4 times, plus any other events inbetween them, eg:

weekly event
single event
weekly event
weekly event
monthly event
weekly event
etc etc

with a limit of 10 events,.. possible?

Kiint 05-22-2012 03:24 PM

Anyone? The way it displays recurring event's is pretty bad, only shows the next one coming, not any others, and that one is at the top because it was created before all the others, not inline like the daily events are......

Eq4bits 05-22-2012 11:32 PM

Quote:

Originally Posted by Kiint (Post 2329821)
What I would like on this is for it to show recurring events up to 4 weeks in advance, so if i had an event scheduled for every wednesday then the widget would show this event 4 times, plus any other events inbetween them, eg:

weekly event
single event
weekly event
weekly event
monthly event
weekly event
etc etc

with a limit of 10 events,.. possible?

all that's a bit more than I can do code wise =S sorry... what I had to do on mine was enter recurring events individually (i used sql to do that on the database end - i.e. insert into _events - used an online unix date converter for dates ;) )
but
you set your limit of events in the widget code itself:
PHP Code:

$show_count 5

by changing the '5' to whatever you want... 10, 15, 20

Eq4bits 05-22-2012 11:36 PM

Quote:

Originally Posted by Tri@de (Post 2325928)
Yes, but how you put in the code. i tried, but i've done somthing wrong...

I read somewhere that with the calendar custom field you have to 'unserialize' it first - in the widget code - then you can pull from it

N^G 06-01-2012 05:40 PM

ignore this post, wrong mod thread!!!

zapiy 01-11-2013 07:30 PM

Can i use this on VBadvanced as a module is some way please?

mna703 01-25-2013 03:30 PM

great plugin, thanks! One problem though.....If I have an event set for lets say 9-11pm EST, the event disappears from the viewer right after 9pm. I would like the event to stay posted throughout the duration of the event...is there anyway to make the event stay for the duration of the event (9-11pm) instead of disappearing rite at 9pm?
Thanks!

fxdigi-cash 05-08-2013 04:39 AM

is it possible to display the upcoming events on top of forumhome instead of sideblock??

imported_EkSeS 05-08-2013 05:57 AM

Quote:

Originally Posted by fxdigi-cash (Post 2420637)
is it possible to display the upcoming events on top of forumhome instead of sideblock??

Another mod do that: Upcoming Events on Top of Pages

----

I have installed & edited some Fields of this Mod :
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",date('d.m.y',$event['dateline_from'])); 
     } else { 
         
$format sprintf("Am %s",date('d.m.y ',$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(); 

Well ..

I have multiple calendars.
1. Visible for guests
2. Visible for users
3. Visible for moderators

On the CMS, guests can see the all the Event Titles :eek:

Permissions of 2. & 3. Calendars are hidden for guests

How can i hide the Titles for guests ?

fxdigi-cash 05-08-2013 07:45 AM

Quote:

Originally Posted by imported_EkSeS (Post 2420642)
Another mod do that: Upcoming Events on Top of Pages

----

I tried that one, but there is a date bug... and needs to be fixed...

fxdigi-cash 05-09-2013 02:11 AM

still there is an issue with expired events... they still there after all while they are supposed to be removed when events finished........

Update: the expired event get removed one day after the event date... not big issue. Thanks

behcet 07-25-2013 06:46 PM

Quote:

Originally Posted by tomsch (Post 2196969)
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.

tnx, my problem solved

rotor 12-12-2013 12:59 AM

Quote:

Originally Posted by imported_EkSeS (Post 2420642)
Another mod do that: Upcoming Events on Top of Pages

----

I have installed & edited some Fields of this Mod :
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",date('d.m.y',$event['dateline_from'])); 
     } else { 
         
$format sprintf("Am %s",date('d.m.y ',$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(); 

Well ..

I have multiple calendars.
1. Visible for guests
2. Visible for users
3. Visible for moderators

On the CMS, guests can see the all the Event Titles :eek:

Permissions of 2. & 3. Calendars are hidden for guests

How can i hide the Titles for guests ?

After using this on a 4.2.2 site I now have an error:

Parse error: syntax error, unexpected ';' in /home/XXXXXXXX/public_html/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 4


even after I deleted the widget I still get the errors!!!!

so what has it changed elsewhere??

any ideas????

twistedsoul 05-30-2016 02:53 AM

great widget, but is there a way to display the event in a color other than white?

oldfan 04-15-2023 03:43 PM

works 4.2.4, php 7.2
any there a way to make it to show multiple years like a event on april 15 2023 and april 15 1999?


All times are GMT. The time now is 01:01 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.03396 seconds
  • Memory Usage 1,925KB
  • 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
  • (6)bbcode_php_printable
  • (11)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
  • (37)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