diff options
author | emkael <emkael@tlen.pl> | 2016-05-06 12:48:05 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-06 12:48:05 +0200 |
commit | 1a2cd8ca8c3a5d4561905fc3139654d06b9cefd7 (patch) | |
tree | d5fefa67dac70c26cc3e7be44fba1a11a47c2549 /app | |
parent | 77ccd8ed8b64f4ec3c83e47e960591f4d17defa6 (diff) |
* adding calendar to user preference
Diffstat (limited to 'app')
-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( |