Home Forum
Qivva Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Archived & future events, 1 calendar = SUCCESS!
(0 viewing) 
Go to bottom
TOPIC: Archived & future events, 1 calendar = SUCCESS!
#1468
synthesis
Fresh Boarder
Posts: 5
graphgraph
User Offline
Archived & future events, 1 calendar = SUCCESS! 10 Years, 4 Months ago Karma: 0
Hey everyone,

I really dig Toni's calendar module (so do my site users), but I was a little dismayed that when an event was archived, it no longer displayed on the calendar. I know there have been at least a couple of posts here asking about this as well as feature requests for an all inclusive calendar. Well, I think I may have an answer...

Bear in mind, I'm no code genius or guru, more like a hack...that said, I've coded bits in many different programming languages over the years (self-taught on all of them) and if I study the code long enough I can usually figure things out. As such, I thought I might have a go at this archived/future event calendar thing. I believe I got it to work and below is what I did...

The code I hacked is in the helper.php file located under the modules\mod_eventlistcal15q\ directory in your installation (unless you did something funky with your install). The bit I modified is in the query portion of the code, below is what the code looks like by default (located around line 95, depends on the editor you use, I just use a generic text editor):



Code:

$query = 'SELECT a.id,a.dates, a.times, a.enddates,
a.title,c.id AS mcatid,c.catname,l.id AS mlocid,l.venue,
DAYOFMONTH(a.dates) AS created_day, YEAR(a.dates) AS created_year, MONTH(a.dates) AS created_month'
. ' FROM #__eventlist_events AS a'
. ' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid'
. ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid'
. ' WHERE a.published = '.$publ
. ' AND c.access <= '.(int)$user->aid
.($catid ? $categories : '')
.($venid ? $venues : '');






I noticed that just above this chunk Toni wrote an if/else bit with the variable $publ, depending on your settings in the backend for his calendar this parses out to a value of either 1 or -1 (meaning the calendar will either display upcoming or archived events). You will notice in the code above that this variable value is used as a condition of the query (the WHERE statement bit). Given that, I figured if I removed that portion of the condition (NOT the whole condition), I might get lucky and the calendar would show all events, both past, present and future. Now it's 2am in the morning here, but I don't think I've started hallucinating yet...this appears to have worked!!! A simple change, I know, but sometimes simple is good. Below is what the code looks like now:




Code:

$query = 'SELECT a.id,a.dates, a.times, a.enddates,
a.title,c.id AS mcatid,c.catname,l.id AS mlocid,l.venue,
DAYOFMONTH(a.dates) AS created_day, YEAR(a.dates) AS created_year, MONTH(a.dates) AS created_month'
. ' FROM #__eventlist_events AS a'
. ' LEFT JOIN #__eventlist_categories AS c ON c.id = a.catsid'
. ' LEFT JOIN #__eventlist_venues AS l ON l.id = a.locid'
. ' WHERE c.access <= '.(int)$user->aid
.($catid ? $categories : '')
.($venid ? $venues : '');






Essentially, all I did was remove this portion:




Code:

a.published = '.$publ
. ' AND






I suppose I could clean things up a bit more and remove the if/else statement as well, it doesn't appear to be used anywhere else in the helper.php file, but I left it in just in case.




If anyone else is interested in implementing this hack, I'd love to get some feedback to ensure that it didn't muck anything else up with the calendar. Two sets of eyes are always better than one...




Now on to finding out how to get rid of the \ inserted in front of apostrophes in the tooltips when used in the event titles...seems like it might be an escape character issue or something.




Hope someone finds this useful.




Regards,
Dave
 
Logged Logged
 
Last Edit: 2009/04/20 14:20 By .
  The administrator has disabled public write access.
#1469
synthesis
Fresh Boarder
Posts: 5
graphgraph
User Offline
Re:Archived & future events, 1 calendar = SUCCESS! 10 Years, 4 Months ago Karma: 0
WOW! Sorry Toni, looks like my posting with the code broke the forum page, almost impossible to read. It previewed ok, but looks like crapola once posted. I couldn't find an "edit post" button anywhere to try and fix it...again, very sorry...

EDIT: Found the edit button (it was waaay off the right side of my screen), got everything sorted now
 
Logged Logged
 
Last Edit: 2009/04/20 14:15 By .
  The administrator has disabled public write access.
#1474
rrafaell
Fresh Boarder
Posts: 5
graphgraph
User Offline
Re:Archived & future events, 1 calendar = SUCCESS! 10 Years, 4 Months ago Karma: 0
THX
 
Logged Logged
  The administrator has disabled public write access.
#1476
synthesis
Fresh Boarder
Posts: 5
graphgraph
User Offline
Re:Archived & future events, 1 calendar = SUCCESS! 10 Years, 4 Months ago Karma: 0
rrafaell wrote:
THX

Glad you found it useful, rrafaell. Post a reply here if you find any problems with this tweak...still seems to be working without error on my site, but it isn't live yet so I'm the only one looking at it...
 
Logged Logged
  The administrator has disabled public write access.
#1481
admin
Platinum Boarder
Posts: 677
graphgraph
User Offline
Re:Archived & future events, 1 calendar = SUCCESS! 10 Years, 4 Months ago Karma: 14
Hi Dave

What you now have is code that will show all events (Current, Archived and UNPUBLISHED).

It's the Unpublished ones that will cause a problem for some people.

I think what you really need is something like this:

$publ = '1';
$arch = '-1';

Then change the SQL section to:
. ' WHERE a.published = '.$publ
. ' OR a.published = '.$arch
. ' AND c.access <= '.(int)$user->aid

PS the answer to backslashes is here: http://extensions.qivva.com/forum.html?func=view&id=1216&catid=5#1216
It's a Joomla problem!

Regards
Toni
 
Logged Logged
 
Last Edit: 2009/04/21 13:52 By .
  The administrator has disabled public write access.
#1482
synthesis
Fresh Boarder
Posts: 5
graphgraph
User Offline
Re:Archived & future events, 1 calendar = SUCCESS! 10 Years, 4 Months ago Karma: 0
admin wrote:
What you now have is code that will show all events (Current, Archived and UNPUBLISHED).

Hey Toni, thanks for pointing this out. I guess I overlooked this...currently I have no unpublished events, only archived (but probably will in the future). It was 2am here...and I'd been looking at the code way too long by that time...


admin wrote:
I think what you really need is something like this:

$publ = '1';
$arch = '-1';

Then change the SQL section to:
. ' WHERE a.published = '.$publ
. ' OR a.published = '.$arch
. ' AND c.access <= '.(int)$user->aid


Thanks for this as well, I'll look into implementing this asap.


admin wrote:
PS the answer to backslashes is here: http://extensions.qivva.com/forum.html?func=view&id=1216&catid=5#1216
It's a Joomla problem!


No wonder I couldn't find anything in your code that would cause this...doh!

Great mod, great support! Keep up the excellent work!
 
Logged Logged
 
Last Edit: 2009/04/21 18:18 By .
  The administrator has disabled public write access.
Go to top
Drug Amoxil Online (Amoxicillin) is used to treat many different types of infections caused by bacteria, such as ear infections, bladder infections, pneumonia, gonorrhea, and E. coli or salmonella infection. Sleeping pills: l-tryptophan, Phenergan, Unisom, Sominex - currently the most popular are the following hypnotic drugs. Click to see full text here:
Italian online pharmacy. Cialis, Viagra and other generic drugs. The best price and free shipping.
Sponsored by: sominex online shop.