Show the "category" tag?

General questions on installation, use, and modication of PHP iCalendar. Old threads I haven't moved yet and new threads that don't fit elsewhere.

Show the "category" tag?

Postby JanSchmitte » Wed Mar 21, 2007 1:04 pm

Hallo everybody,


I've been using phpical for almost 3 months now and I'm still happy with it!

I already made some modifications to the code to better suit my needs:
- fixed display of german "umlaute"
- added display of a calendar's "last modified" timestamp in the legend
- added navigation arrow to month view
- changed event.tpl

What I'm trying to achieve now is the display of the category tag in the event-pop-up. I've looked into my ics-files and there's a line like:
Code: Select all
CATEGORIES: Meeting

When looking through the forums I noticed that this line is currently not supported by phpical.
I tried to understand the concept of reading the ics-files (and therefore putting the content of "CATEGORIES" into some variable...) but failed miserably...

What do I have to do to read this line into the master array?

I simply don't understand how the variables are set in "ical_parser.php"...

Could somebody please help me...


TIA, Jan
JanSchmitte
Member
 
Posts: 10
Joined: Thu Feb 15, 2007 3:26 pm

Postby jimhu » Wed Mar 21, 2007 8:44 pm

This is why I'm trying (slowly) to rewrite the whole thing. ical_parser.php has a couple of parts. The first part largely deals with reading a previously parsed and cached calendar. Then there's a very large while loop that reads the file in a line at a time.

A gigantic switch statement looks for the type of line it is, and populates a slew of variables. The case where the line is END:VEVENT is a large, difficult to understand set of routines to actually write the master array entries for an event (a similar block handles END:VTODO)

Within the case END:VEVENT part, there are too many separate places in the code where the array is written. These should all be one subroutine, but I think that when Chad was writing this without OO methods, he was looking at passing a zillion parameters to a function in the right order. This probably should have been rewritten to use a hash, but once you've gone that far, you might as well go all the way to objects.


So...just adding support for categories, or freebusy, or other things gets harder and harder as long as we stick with the current parser.

But...and this is a huge caveat...it more or less works, while the new and improved one is still pretty far off.
jimhu
Member
 
Posts: 1092
Joined: Fri Nov 04, 2005 2:34 am

Postby JanSchmitte » Thu Mar 22, 2007 12:12 pm

So I would be better off waiting for phpical3 than trying to implement this on my own, right?

I do not need this function at all costs, it would just be a nice bonus (at the moment)...


If there's somebody reading this who already has implemented this function PLEASE GIVE ME A CALL...

Otherwise, it's OK as well...


Yours, Jan
JanSchmitte
Member
 
Posts: 10
Joined: Thu Feb 15, 2007 3:26 pm

How to implement CATEGORIES: a solution

Postby RandoXtrem » Mon Apr 16, 2007 11:09 am

First, 1000 excuses for my very bad english language ...

Jan, in order to implement categories on event (strangely categories are implemented by todo) just do it (changes are bold):

- file ical_parser.php


~ line 146
case 'BEGIN:VEVENT':
unset ( ... $number, $categories );

~line 218
if (!isset($url)) $url = $master_array[$old_start_date][$old_start_time][$uid]['url'];
if (!isset($categories)) $categories = $master_array[$old_start_date][$old_start_time][$uid]['categories'];

~line 238
if (!isset($categories)) $categories = '';

~line 311
'class' => $class,
'categories' => $categories );



~line 357
'url' => $url,
'categories' => $categories );

~line 393
'url' => $url,
'categories' => $categories );

~line 855
'url' => $url,
'categories' => $categories,
'recur' => $recur );

~line 893
'url' => $url,
'categories' => $categories,
'recur' => $recur );


~line 1007
case 'CATEGORIES':
$vtodo_categories = "$data";
$categories = "$data";


- file includes/event.php

~line 97
'l_location' => $lang['l_location'],
'categories' => $event['categories']

- template: file event.tpl
add somewhere this type of code:
Categories:: {CATEGORIES}




To complete and test, you need to delete you cache calendar file if option $save_parsed_cals is set to "yes".

I hope it will help you. On my side, all run without problem.

RDX
RandoXtrem
Member
 
Posts: 1
Joined: Mon Apr 16, 2007 10:41 am

New solution for showing the content of CATEGORIES:?

Postby johann » Tue Jul 13, 2010 11:45 am

Thank you for your solution, RandoXtrem, but PHPicalendar 2.4 seems to have developed much further. So it seems not possible any more to do it the way you did.

Is there a new solution to show the CATEGORIES-content?

I don't really want to display this tag but would like to smuggle it into the RSS-Feed.
The way you did it, Jim, with your custom stuff
"custom stuff for Jim Hu's RSS feeds".

I've already tried some tricks in rss/rss.php but was not successful.
My <category></category>-Tags display in the XML-file, but
the content (my custom calendar categories) is missing.

Is there a new way to just get the CATEGORIES:-content?

Thanks for reading and helping.

Best wishes

Johann
johann
Member
 
Posts: 3
Joined: Tue Apr 07, 2009 5:26 am

Re: Show the

Postby Japcy07 » Sun Jul 25, 2010 9:58 pm

Hi RandoXtrem,
Thank you for the information you had given.My question was how can I access the lines you posted and the other thoughts you shared.Show me some categories you are trying to imply and further eloborate the following lines!
Japcy07
Member
 
Posts: 1
Joined: Sun Jul 25, 2010 9:33 pm


Return to General Questions

Who is online

Users browsing this forum: Ask Jeeves [Bot], Google [Bot] and 1 guest

cron