diff options
Diffstat (limited to 'app/php/components/UserSelection.php')
-rw-r--r-- | app/php/components/UserSelection.php | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/app/php/components/UserSelection.php b/app/php/components/UserSelection.php index 7b10b40..6ae68e4 100644 --- a/app/php/components/UserSelection.php +++ b/app/php/components/UserSelection.php @@ -1,7 +1,6 @@ <?php -Prado::using('Application.dto.CalendarGroupDTO'); -Prado::using('Application.model.UserPreference'); +Prado::using('Application.facades.CalendarFacade'); class UserSelection extends TTemplateControl { @@ -28,40 +27,11 @@ class UserSelection extends TTemplateControl { public function removeFromSelection($sender, $param) { if (!$this->UserToDisplay->IsGuest) { - $preferenceRecord = UserPreference::finder()->find( - '_user = ? AND _calendar = ?', - $this->UserToDisplay->DbRecord->ID, - $param->CommandParameter - ); - $preferenceRecord->delete(); } } private function _getUserSelection(DbUser $user) { - $calendars = $user->getCalendarPreference(); - if ($calendars) { - $categories = Category::finder()->findAllByPks( - array_unique( - array_map( - function($calendar) { - return $calendar->CategoryID; - }, - $calendars - ) - ) - ); - $categories = array_map( - function($category) use($calendars) { - $dto = new CalendarGroupDTO(); - $dto->loadRecord($category, $calendars); - return $dto; - }, - $categories - ); - usort($categories, ['CalendarGroupDTO', '__compare']); - return $categories; - } - return []; + return CalendarFacade::getInstance()->getPreferenceList($user); } } |