diff options
Diffstat (limited to 'app/php/facades/CalendarFacade.php')
-rw-r--r-- | app/php/facades/CalendarFacade.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/php/facades/CalendarFacade.php b/app/php/facades/CalendarFacade.php index 25dec5f..a1ff42d 100644 --- a/app/php/facades/CalendarFacade.php +++ b/app/php/facades/CalendarFacade.php @@ -39,6 +39,18 @@ class CalendarFacade extends Facade { return []; } + public function addToPreference(DbUser $user, $calendarID) { + if (!$user->IsGuest) { + $calendar = Calendar::finder()->findByPk($calendarID); + if ($calendar) { + $preference = new UserPreference(); + $preference->CalendarID = $calendar->UID; + $preference->UserID = $user->DbRecord->ID; + $preference->save(); + } + } + } + public function removeFromPreference(DbUser $user, $calendarID) { if (!$user->IsGuest) { $preferenceRecord = UserPreference::finder()->find( |