Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 07:39 am EDT

Geeklog Forums

Calendar Events block help needed


Craig

Anonymous
Hi gang -
Running GL 1.4.1 with events from the standard Calendar plugin populating upcoming events in a block. My problem is that as soon as events start, the block drops the event. I would like the event to show in that block for the entire current day of the event. Anyone know how to do this?

Thanks in advance, Craig
 Quote

Craig

Anonymous
Little bit more clarification -

Events that are listed on the sidebar block disappear on the day of the event. I simply want them to remain in the side block through the day of the event and disappear either the end of the day or at least appear through the conclusion of the event. Any ideas how to do that?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I think the way they work now makes sense. If you want an event to be visible all day, make it an "all day" event.

bye, Dirk
 Quote

Craig

Anonymous
But they aren't all day events. These are events that occur during specific times. But that doesn't matter anyhow, it still won't make the event 'stick' for the current day. For example, if I have an event on the calendar for this evening, it doesn't show up in the sidebar (calendar block). It would be there yesterday, but as soon as the day of the event arrives, the event disappears from the block. Its on the calendar itself fine, just not in the block.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Sorry, I was under the impression that timed events would only disappear when they are due. Apparently, that's not the case. So at least that should be fixed ...

bye, Dirk
 Quote

Craig

Anonymous
Ummm. yeah.

Maybe someone could at least point me to the file containing the code that defines how those events get expired? I couldn't find it anywhere.
 Quote

I'm With Craig

Anonymous
I have three sites all having the same issue. Previous to the turn of this year this was not the case. Is there anything in the current events block that would have changed with the new year?
 Quote

Status: offline

mx52006

Forum User
Newbie
Registered: 11/19/05
Posts: 8
More specifically, where is the code to create the events block and how does it pull the events from the calendar? Can we set a time frame, say any date that is scheduled for the next 15 days to show up?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The code is in function phpblock_calendar() in the Calendar's functions.inc. There already is an $_CA_CONF['upcomingeventsrange'] setting to set the number of days to look ahead.

bye, Dirk
 Quote

Craig

Anonymous
Now we're getting somewhere. Woohoo.

I'm guessing I just need to figure out how to modify the SQL query to call the current day as well. I'm kind of a novice here so any help would be appreciated.

Text Formatted Code
 $eventSql = 'SELECT eid,title,url,datestart,dateend,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon '
. "FROM {$_TABLES['events']} "
. "WHERE dateend >= NOW() AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) "
. 'ORDER BY datestart,timestart';


Probably need to make a change in the WHERE line somehow. Any ideas?
 Quote

Craig

Anonymous
Well...I figured it out...at least a workaround and I'm sure its not the prettiest piece of SQL query ever, but it seems to work.

Just change the WHERE line above to

Text Formatted Code
. "WHERE dateend >= (NOW() - INTERVAL 24 HOUR) AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) "
 Quote

Status: offline

kingsley

Forum User
Junior
Registered: 03/17/05
Posts: 29
Quote by: Craig

Well...I figured it out...at least a workaround and I'm sure its not the prettiest piece of SQL query ever, but it seems to work.

Just change the WHERE line above to

Text Formatted Code
. "WHERE dateend >= (NOW() - INTERVAL 24 HOUR) AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) "



Thanks for this, The fix does seem ugly as it appears the ">=" is correct. Like others this seemed to break all of a sudden around the first of the year so I am guessing the issue is elsewhere in the code but I have not been able to locate the exact source just yet. This fix is a decent temporary fix however.

-Eric
 Quote

Status: offline

DaveC

Forum User
Newbie
Registered: 11/08/04
Posts: 6
Location:NZ
cheerful
Quote by: Craig

Well...I figured it out...at least a workaround and I'm sure its not the prettiest piece of SQL query ever, but it seems to work.

Just change the WHERE line above to

Text Formatted Code
. "WHERE dateend >= (NOW() - INTERVAL 24 HOUR) AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) "



FYI, today I found this bug is also in my 1.4.0sr6 websites, except the offending sql is found in the function COM_printUpcomingEvents( $help='', $title='' ) which is in lib-common.php

... and I don't think the code looks ugly :-)
 Quote

All times are EDT. The time is now 07:39 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content