/** * Copy bookings from one group to another * @param <type> $a_old_group * @param <type> $a_new_group * @throws ilViteroConnectorException */ public function copyBookings($a_old_group, $a_new_group) { // Read all bookings of old group $now = new ilDateTime(time(), IL_CAL_UNIX); $later = clone $now; $later->increment(IL_CAL_YEAR, 5); try { $bookings = $this->getByGroupAndDate($a_old_group, $now, $later); } catch (ilViteroConnectorException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Copying vitero group failed with message ' . $e); return false; } foreach ((array) $bookings->booking as $booking) { $room = new ilViteroRoom(); $room->setBufferBefore($booking->startbuffer); $room->setBufferAfter($booking->endbuffer); $room->setRoomSize($booking->roomsize); $room->enableCafe($booking->cafe ? true : false); $room->setStart(ilViteroUtils::parseSoapDate($booking->start)); $room->setEnd(ilViteroUtils::parseSoapDate($booking->end)); $room->setRepetition($booking->repetitionpattern); $rep_end = ilViteroUtils::parseSoapDate($booking->repetitionenddate); if ($rep_end instanceof ilDateTime) { $room->setRepetitionEndDate($rep_end); } try { $this->create($room, $a_new_group); } catch (ilViteroConnectorException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Copying vitero group failed with message ' . $e); } } }