sproctor / php-calendar

PHP-Calendar
http://www.php-calendar.org/
Apache License 2.0
138 stars 67 forks source link

Category Legend #131

Open aabshagen opened 9 years ago

aabshagen commented 9 years ago

Not sure if I am just missing something but it would be nice if there was a way to put a category legend at the bottom of the screen.

aabshagen commented 9 years ago

Just as a note not that this is the best way to do it but I added the below code to the footer section to accommodate what I wanted. This was added in calender.php just before the debug section.

$categories = $phpc_cal->get_categories();

foreach ($categories as $category) { $name = empty($category['name']) ? __('No Name') : $category['name']; $catid = $category['catid']; $textcolor = $category['text_color']; $bgcolor = $category['bg_color']; $group = empty($category['group_name']) ? __('None') : $category['group_name']; $style = "color: ". $textcolor ." !important; background: ". $bgcolor ." !important;"; $tag->add(tag('a',attributes('style="'.$style.'"'), $name));

}
nemezis007 commented 9 years ago

The solution works, the only problem with it, which I find is that the categories are visible in public. The best solution for me would be only per user, which works well with this change to the above:

$categories = $phpc_cal->get_visible_categories($phpc_user->get_uid());