public function retrieveCalendarPreferences($userId, $calendarId)
 {
     if (!is_string($userId) || $userId == '') {
         throw new EyeInvalidArgumentException('$userId must be a non-empty string.');
     }
     if (!is_string($calendarId) || $calendarId == '') {
         throw new EyeInvalidArgumentException('$calendarId must be a non-empty string.');
     }
     $dao = StorageManager::getInstance()->getHandler('SQL/EyeosDAO');
     $calendarPrefs = new CalendarPrefs();
     $calendarPrefs->setUserId($userId);
     $calendarPrefs->setCalendarId($calendarId);
     $calendarPrefs = $dao->search($calendarPrefs);
     unset($dao);
     if (count($calendarPrefs) === 0) {
         throw new EyeCalendarPrefsNotFoundException('Unknown calendar preferences with user ID "' . $userId . '" and calendar ID "' . $calendarId . '".');
     }
     return current($calendarPrefs);
 }
Пример #2
0
 public function getCalendarPreferences($userId, $calendarId)
 {
     $prefs = null;
     try {
         $prefs = $this->getProvider()->retrieveCalendarPreferences($userId, $calendarId);
     } catch (EyeCalendarPrefsNotFoundException $e) {
         $prefs = new CalendarPrefs();
         $prefs->setUserId($userId);
         $prefs->setCalendarId($calendarId);
         $prefs->setColor(CalendarPrefs::DEFAULT_COLOR);
     }
     return $prefs;
 }