php-calendar
php-calendar copied to clipboard
Category Legend
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.
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));
}
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());