public function createCalendarName() { $calendars = OC_Calendar_Calendar::allCalendars($this->userid); $calendarname = $guessedcalendarname = !is_null($this->guessCalendarName()) ? $this->guessCalendarName() : OC_Calendar_App::$l10n->t('New Calendar'); $i = 1; while (!OC_Calendar_Calendar::isCalendarNameavailable($calendarname, $this->userid)) { $calendarname = $guessedcalendarname . ' (' . $i . ')'; $i++; } return $calendarname; }