Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#586 2008-08-04 13:14:30
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Hi folks!
In an attempt to meet my humble needs regarding zem_event, I have added a few things to this already great textpattern plugin. Until somebody tells me what to do with it I intend to post it here: http://docs.google.com/Doc?id=dhgqhbvp_5f5sz5bcj (Edit: This file was deleted. I will share my changes as soon as I have the sparetime to setup a proper website for it.)
Attention: This hack need some serious testing. It looks good on my textpattern installation, and I tried all kind of kinky stuff with it, but nevertheless it might cause some unexpected sideeffects on other platforms. So be cautious and most of all don’t use it on an important project until a hand full of people get the idea that it actually works like it was intended.
Installation
Somehow I wasn’t able to transform the plugin properly, when- and whereever I tried, part of the plugin was cut off (I suspect ied_plugin_composer and something regarding maximum upload filesize). Because I don’t recommend to use the plugin in a production environment, you may stick for now with event.php anyway.
Just create a plugin directory (somethin like path_to_yoursite/textpattern/plugins) and tell textpattern where to find it (admin->preferences->advanced->“Plugin cache directory path”
So whats new about it?
zem_event_calendar
Now you get additional calender views for one week or only three days
With the view attribute in zem_event_calendar you may tell your calendar to show a whole month, just one week or only three days
Example:
<txp:zem_event_calendar view=“month” />
<txp:zem_event_calendar view=“week” />
<txp:zem_event_calendar view=“threedays” />
Because those additional calendars need their own navigation, I also tweaked zem_event_calendar_nav a little bit.
This function was enhanced by the “step” attribute. Now you may create a navigation pushing your calendar by a “day”, a “week” a “month” or a even a whole “year”!
I also removed some problems with zem_event_mini_calendar. Dates between 01 and 09 of each month will now be shown properly.
For starters, cut and paste the following lines into a template and link it to your calendar section:
<hr />
<h3>Overview – Three Days</h3>
<txp:zem_event_calendar_nav class=“zem_event_calendar_nav” label=”%A, den %d. %B %Y” step=“day” />
<txp:zem_event_calendar view=“threedays” table_caption=”“ table_th=”<span>%A, </span><span>%d. %B %Y</span>” />
- table_caption=”“ : This way you get rid of that double heading if you use calendar in conjunction with calendar_nav
- table_th : Style the content of table headings (<th>) however you like.
<hr />
<h3>Overview – One Week</h3>
<txp:zem_event_calendar_nav class=“zem_event_calendar_nav” label=“KW %U” step=“week” />
<txp:zem_event_calendar view=“week” table_caption=”“ table_th=”<span>%a, </span><span>%d. %B %Y</span>” />
<hr />
<h3>Overview – One Month
<txp:zem_event_calendar_nav class=“zem_event_calendar_nav” label=”%B %Y” step=“month” />
<txp:zem_event_calendar view=“month” table_caption=”“ />
(P.S. Don’t forget, that the information content for each kalendar entry is created by the zem_event_cal_entry form.)
<hr />
<h4>Navigation Whole Years</h4>
<txp:zem_event_calendar_nav class=“zem_event_calendar_nav” label=”%Y” step=“year” />
<h2>Mini Calendar</h2>
<txp:zem_event_calendar_nav class=“minical_nav” />
<txp:zem_event_mini_calendar
class=“minical”
class_event=“full”
class_empty=“empty”
section=”“ />
<hr />
Last edited by pepebe (2008-08-11 13:11:26)
Offline
#587 2008-08-04 14:13:19
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Hi Pepebe,
Really good to have somebody working on zem_event again, it’s a great little plug-in and it would be terrible to see it just fade away.
I’ve been using it on a live site for a while now and it works pretty well (mini calendar aside), except for this one issue that I’ve been trying to work around without much success – do you have any ideas about a solution?
Offline
#588 2008-08-04 21:17:00
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
@decoder,
I agree with you, it would be a waste of really good work to let it fade away. The good news are, that the mini calendar problem seems to be solved (at least, it works for me). Either try the revised plugin or use the hack I described a few posts above.
Regarding your problem, I’m not sure if I understand it. Please give me some more details and a rough example of what you want to achieve. Until then I will tinker around with some dummy events and try to get a grip on the search issue in general.
CU
pepebe
P.S: Just noticed that I should clean up the php code of the revised plugin and perhaps add some comments. I will do so as soon as I find the time to do some “fun” work…
@infrarosso
I’m on it. Keep the faith. ;)
Last edited by pepebe (2008-08-04 21:18:32)
Offline
#589 2008-08-05 09:20:27
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
@decoder
I hope I understand your problem right.
Please try that one: http://docs.google.com/Doc?id=dhgqhbvp_7ftdm2gf8 (Edit: This file was deleted. I will share my changes as soon as I have the sparetime to setup a proper website for it.)
(Note: This is highly experimental stuff, so please test it thouroughly!)
As uasual, cut and paste, save as event.php and then put it into your textpattern/plugin directory. Even though I have the feeling, this was to easy, it seems to do the trick.
If have tried
<txp:zem_event_list … sort=“zem_event_category.k2 asc, Category1 asc, zem_event_calendar.name asc, zem_event_date.event_date asc,zem_event_date.event_time asc” />
and it looked fine
CU,
pepebe
P.S. I think you need to rework your form a bit here and there
Last edited by pepebe (2008-08-11 13:12:29)
Offline
#590 2008-08-05 09:57:04
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Hi pepebe,
Really appreciate you taking the time to help me out.
I’ve set up my Plugin cache directory path as requested, uploaded the event.php and added the revised sort, but I’m getting the following error:
tag_error <txp:zem_event_list limit="999" form="cltc_event_table" section="calendar" label="Forthcoming Fixtures and Events" labeltag="h3" wraptag="" sort=“zem_event_category.k2 asc, Category1 asc, zem_event_calendar.name asc, zem_event_date.event_date asc,zem_event_date.event_time asc” /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '��zem_event_category.k2' at line 1
select count(*) from zem_event_calendar, zem_event_date, textpattern where zem_event_calendar.id=zem_event_date.event_id and zem_event_calendar.article_id = textpattern.ID and textpattern.Status >= 4 and textpattern.Posted <= now() and (zem_event_date.event_date >= '2008-08-05' or zem_event_date.finish_date >= '2008-08-05') and textpattern.Section IN ('calendar') order by “zem_event_category.k2 on line 81
This is probably a silly question, but how does zem_event know to look at the new code rather than the original plug-in?
Offline
#591 2008-08-05 11:26:02
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
@decoderltd
As far as I know, it doesn’t.
Sorry I forgot to mention that earlier. Of course you have to deactivate the original zem_event plugin in your plugin tab. This should do the trick.
Good luck,
pepebe
Offline
#592 2008-08-05 13:03:27
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Hi pepebe,
Really sorry about this, I’ve switched off the plug-in and all zem_event features have disappeared and there’s a tag error:
tag_error <txp:zem_event_list limit="10" category="club-event" wraptag="ul" break="li" form="cltc_event_display" /> -> Textpattern Warning: unknown_tag.....
Maybe it’s something I’m doing wrong with the event.php file.
Offline
#593 2008-08-05 13:38:00
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
No problem, your welcome!
Make sure, you can say “YES SIR” to the following things:
You switched off zem_event in the plugin tab.
zem_paginate is still installed and running, the javascript files are in textpattern/js
you cut and paste the content of eventv02 into a file and named it event.php
you told textpattern where to find the plugindirectory (make sure, that the path is correct).
you copied the plugin into that directory
Voila! Everything should be fine. I did so a few minutes ago and it works like a breeze…
If this doesn’t help, we have to get serious…
pepebe
P.S. I also checked the source code on my google account. Everythingwent fine.
Last edited by pepebe (2008-08-05 13:40:09)
Offline
#594 2008-08-05 13:56:05
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Sorry pepebe,
Sure enough, I had a problem with the plug-in path. I’ve now corrected it, but another error is thrown up
@tag_error <txp:zem_event_list limit=“999” form=“cltc_event_table” section=“calendar” label=“Forthcoming Fixtures and Events” labeltag=“h3” wraptag=”“ sort=“zem_event_category.k2 asc, Category1 asc, zem_event_calendar.name asc, zem_event_date.event_date asc,zem_event_date.event_time asc” /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘��zem_event_category.k2’ at line 1 select count(*) from zem_event_calendar, zem_event_date, textpattern, zem_event_category where zem_event_calendar.id=zem_event_date.event_id and zem_event_calendar.id=zem_event_category.k1 and zem_event_calendar.article_id = textpattern.ID and textpattern.Status >= 4 and textpattern.Posted <= now() and (zem_event_date.event_date >= ’2008-08-05’ or zem_event_date.finish_date >= ’2008-08-05’) and textpattern.Section IN (‘calendar’) order by “zem_event_category.k2 on line 81….@
Not sure what it all means!
UPDATE – I’ve reapplied/copied/pasted the various bits code and it all seems to be working now. Fantastic, I’ve been trying to get that sort problem fixed for ages so thank you very much. I’m away for a couple of weeks now, but I’ll play around with the other changes you’ve made and get back to you with any observations.
Last edited by decoderltd (2008-08-05 17:17:40)
Offline
#595 2008-08-05 20:28:53
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
@decoderltd
thanks for testing my changes. I hope, everything will come out fine.
CU,
pepebe
Offline
#596 2008-08-07 11:50:56
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
@infrarosso
Even though I’m sure this can be solved much more simpler, here is a solution for your problem:
Create a form called ppb_event_count
<txp:zem_event_list />:
Add the following code to your pagetemplate
<txp:php>
$date = gps('date');
if (empty($date)){
$date=strftime("%Y-%m-%d");
}
$events = zem_event_list(
array(
'date' => $date,
'form' => 'ppb_count_events',
'section' => '',
'category' => '',
)
);
$number_of_events = count(explode(":",$events))-1;
if($number_of_events==1){echo "Today there is $number_of_events event.<br>";}
else {echo "Today there are $number_of_events events.<br>";}
</txp:php>
Use the same codeblock to list the number of events in category X by writing “X” to the category attribute (e.g. ‘category’ => ‘X’,)
To list the current date try something like that:
<txp:php>
$today = strftime("Today is %d/%m/%y");
echo $today;
</txp:php>
If you want to have the option to list the date enclosed in the url (e.g. http://www.mysite/index.php?date=2008-08-08&s=Kalender) grab the time with gps (see above) and add some date(), strftime() to format it in a pleasant way.
Good Luck,
pepebe
P.S. I will add some functions to zem_event to do that kind of thing,then it will be much easier. Expect something like: <txp:zem_event_number_of_events section=”“ category=”“ />
Last edited by pepebe (2008-08-07 20:39:30)
Offline
#597 2008-08-07 21:56:14
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Hi Infrarosso,
I hope, you have studied my solution by heart, its a great exercice about how to do something COMPLETLY WRONG. It works, but a few chenges inside zem_event will do this and much more. If you are up to a hack try this.
Warning: For sake of security it would be the best thing, if you put a copy of zem_event.php into your textpattern plugin directory. So if something should go wrong, you just have to delete that file on your server and you (should) be back to normal…
Ah, don’t forget to deactivate zem_event in your pluginlist.
Go to function zem_event_list and add the following variable to the function array
‘count_events’ => ‘0’,
now go to the very bottom of function zem_event_list
instead of
return doTag($label, $labeltag, $class).
doWrap($out, $wraptag, $break, $class, $breakclass);
insert
if ($count_events==1){
$number_of_events=count($out);
return doTag($label, $labeltag, $class).
$number_of_events;
}
else {
return doTag($label, $labeltag, $class).
doWrap($out, $wraptag, $break, $class, $breakclass);
}
Voila, now you have a counter at your hands capable to do all kind of crazy stuff.
Try the following tags to get an idea:
<txp:zem_event_list count_events="1" category="Concerts" date="Today" labeltag="span" label="Events today:" />
I think I can pimp that still up a bit, but that should be sufficient for now.
Have fun,
pepebe
Last edited by pepebe (2008-08-07 22:05:55)
Offline
#598 2008-08-08 15:38:30
- Alex007
- Member
- Registered: 2007-10-24
- Posts: 57
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Hi Pepebe
There may already be a post out here answering the following but i couldn’t see one so thought it would be the best place to ask…
I am sure others want to do this…. so is it possible to have the large calendar to start on a Monday rather than on a Sunday have tried looking in the code and can see it has the following comment
// day number of the first of the month (Sunday = 0)
is there an easy way to change this or can i add to the txp_event_calendar an attribute?
Thanks for the help.
a
Offline
#599 2008-08-08 23:39:49
- pepebe
- Member
- From: Mannheim, Germany
- Registered: 2005-02-07
- Posts: 74
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
Hi Alex007
I’m not sure, if this works with my other hacks, but I think,you could try the following thing:
Find this paragraph in function zem_event_calendar
// day number of the first of the month (Sunday = 0)
$first = mktime(0,0,0,$m, 1, $y);
$firstday = strftime('%w', $first);
Replace the last line with this one:
$firstday = strftime('%w', $first)-1;
Explanation: Because from strftime’s point of few the week starts on a Sunday=0, counting upwards, Mondays get a value of 1. By subtracting 1, we simulate a week that starts one day later (1-1=0).
If you want to have the option to do that kind of thing within <txp:zem_event_calendar /> just add
‘offset’ => ‘0’,
to function zem_event_calendar’s lAtts Array block and change the last line to
$firstday = strftime('%w', $first)-$offset; instead.
Now you can write
<txp:zem_vent_calendar ... offset="1" />
and your week will start on a monday.
Good luck,
pepebe
Last edited by pepebe (2008-08-08 23:48:27)
Offline
#600 2008-08-09 21:36:24
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: [plugin] [ORPHAN] zem_event [flexible integrated event management]
as a heavy user of this plugin, and away from the forum for a couple of months, was good to see your posts pepebe!
Offline