summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-06 12:48:05 +0200
committeremkael <emkael@tlen.pl>2016-05-06 12:48:05 +0200
commit1a2cd8ca8c3a5d4561905fc3139654d06b9cefd7 (patch)
treed5fefa67dac70c26cc3e7be44fba1a11a47c2549 /app
parent77ccd8ed8b64f4ec3c83e47e960591f4d17defa6 (diff)
* adding calendar to user preference
Diffstat (limited to 'app')
-rw-r--r--app/php/facades/CalendarFacade.php12
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(