sproctor / php-calendar

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

show user ONLY their own calender #165

Closed losferatos closed 2 years ago

losferatos commented 3 years ago

Hi there!

I highly appreciate your work guys. I just started an internship and my boss wants me to implement such a calender option. But because there are hundreds of users and therefore also hundreds of calenders. To keep it slick for the users I'd like to put a limitation on - so that they can only pick their calender from the dropdown and don't have to go through the whole list.

I'm looking for some hint on how I can archive this. I haven't even managed to determine where the dropdown is created. Any help is highly appreciated =)

best regards (and sorry, I'm not a native english speaker) Eric

sproctor commented 3 years ago

It's been a while since I've worked on this.

The calendar list is created here: https://github.com/sproctor/php-calendar/blob/d8e71bfa29a237035580a27cd744ac3c063903ac/includes/calendar.php#L794

That should probably have the following in the loop:

if ($calendar->can_read()) {
    $list[$phpc_home_url . '?phpcid=' . $calendar->get_cid()] = $calendar->get_title();
}

That might accomplish what you're attempting, depending on whether users have read access to other's calendars.

losferatos commented 3 years ago

Thank you so much for your fast and perfect answer!

Again, highly appreciated =)

sproctor commented 2 years ago

committed this change. closing issue