php-calendar icon indicating copy to clipboard operation
php-calendar copied to clipboard

Category Legend

Open aabshagen opened this issue 9 years ago • 2 comments

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 avatar Mar 25 '15 00:03 aabshagen

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));

}

aabshagen avatar Mar 25 '15 15:03 aabshagen

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());

nemezis007 avatar Aug 31 '15 08:08 nemezis007