diff options
author | emkael <emkael@tlen.pl> | 2016-06-16 11:48:31 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-06-16 11:50:22 +0200 |
commit | 7af1ebdd7216f14778bdfa68c39a8e2050413a1f (patch) | |
tree | 3f276f63df7d049ba9da5e92b1151277141eaea0 /app/frontend/facades/UserFacade.php | |
parent | 01bbbb7336835451888dabfb1fc7e874986585ad (diff) |
* differring view between grouped and normal view based on user preference
Diffstat (limited to 'app/frontend/facades/UserFacade.php')
-rw-r--r-- | app/frontend/facades/UserFacade.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/frontend/facades/UserFacade.php b/app/frontend/facades/UserFacade.php index 864fb58..5c8b6c0 100644 --- a/app/frontend/facades/UserFacade.php +++ b/app/frontend/facades/UserFacade.php @@ -97,6 +97,27 @@ class UserFacade extends Facade { return NULL; } + public function setGroupedViewPreference(DbUser $user, bool $value) { + if ($user->IsGuest) { + throw new TInvlaidDataException( + Prado::localize( + 'Grouped view preference change impossible for guest user' + ) + ); + } + $user->DbRecord->GroupedView = $value; + $user->DbRecord->save(); + } + + public function getGroupedViewPreference(DbUser $user) { + if (!$user->IsGuest) { + return TPropertyValue::ensureBoolean( + $user->DbRecord->GroupedView + ); + } + return FALSE; + } + } ?> |