/** * Create Group * @param ilViteroGroupSoap $group * @throws ilViteroConnectorException $e */ public function create(ilViteroRoom $room, $a_group_id) { try { $this->initClient(); // Wrap into single group object $booking = new stdClass(); $booking->startbuffer = $room->getBufferBefore(); $booking->endbuffer = $room->getBufferAfter(); $booking->groupid = $a_group_id; $booking->roomsize = $room->getRoomSize(); $booking->ignorefaults = false; $booking->cafe = $room->isCafe(); if ($room->isCafe()) { $GLOBALS['ilLog']->write(__METHOD__ . ': Creating new cafe'); $booking->start = $room->getStart()->get(IL_CAL_FKT_DATE, 'YmdHi', self::CONVERT_TIMZONE); $booking->end = $room->getEnd()->get(IL_CAL_FKT_DATE, 'YmdHi', self::CONVERT_TIMZONE); $booking->repetitionpattern = 'daily'; $booking->repetitionenddate = $room->getRepetitionEndDate()->get(IL_CAL_FKT_DATE, 'YmdHi', self::CONVERT_TIMZONE); } else { $GLOBALS['ilLog']->write(__METHOD__ . ': Creating new standard room'); $booking->start = $room->getStart()->get(IL_CAL_FKT_DATE, 'YmdHi', self::CONVERT_TIMZONE); $booking->end = $room->getEnd()->get(IL_CAL_FKT_DATE, 'YmdHi', self::CONVERT_TIMZONE); $booking->repetitionpattern = $room->getRepetitionString(); if ($room->getRepetitionEndDate() instanceof ilDateTime) { $booking->repetitionenddate = $room->getRepetitionEndDate()->get(IL_CAL_FKT_DATE, 'YmdHi', self::CONVERT_TIMZONE); } } $booking->timezone = self::WS_TIMEZONE; $container = new stdClass(); $container->booking = $booking; $this->getClient()->createBooking($container); $GLOBALS['ilLog']->write(__METHOD__ . print_r($this->getClient()->__getLastRequest(), true)); $GLOBALS['ilLog']->write(__METHOD__ . print_r($this->getClient()->__getLastResponse(), true)); } catch (SoapFault $e) { $code = $this->parseErrorCode($e); $GLOBALS['ilLog']->write(__METHOD__ . ': Creating vitero group failed with message code: ' . $code); $GLOBALS['ilLog']->write(__METHOD__ . ': Last request: ' . $this->getClient()->__getLastRequest()); throw new ilViteroConnectorException($e->getMessage(), $code); } }