protected function deleteSessions($a_sessions)
 {
     $this->getViteroInstance()->includeClass('class.ilViteroSessionCodeSoapConnector.php');
     try {
         $connector = new ilViteroSessionCodeSoapConnector();
         $connector->deleteSessionCodes($a_sessions);
     } catch (ilViteroConnectorException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': ViteroSingleLogout failed with message: ' . $e->getMessage());
     }
 }
 /**
  * start session
  * @global <type> $ilDB
  */
 public function startSession()
 {
     global $ilDB, $ilUser, $ilCtrl, $ilAccess;
     // Handle deleted accounts
     ilObjVitero::handleDeletedUsers();
     try {
         // Create update user
         $map = new ilViteroUserMapping();
         $vuid = $map->getVUserId($ilUser->getId());
         $ucon = new ilViteroUserSoapConnector();
         if (!$vuid) {
             $vuid = $ucon->createUser($ilUser);
             $map->map($ilUser->getId(), $vuid);
         } else {
             try {
                 $ucon->updateUser($vuid, $ilUser);
             } catch (ilViteroConnectorException $e) {
                 if ($e->getCode() == 53) {
                     $map->unmap($ilUser->getId());
                     $vuid = $ucon->createUser($ilUser);
                     $map->map($ilUser->getId(), $vuid);
                 }
             }
         }
         // Store update image
         if (ilViteroSettings::getInstance()->isAvatarEnabled()) {
             $usr_image_path = ilUtil::getWebspaceDir() . '/usr_images/usr_' . $ilUser->getId() . '.jpg';
             if (@file_exists($usr_image_path)) {
                 $ucon->storeAvatarUsingBase64($vuid, array('name' => 'usr_image.jpg', 'type' => ilViteroAvatarSoapConnector::FILE_TYPE_NORMAL, 'file' => $usr_image_path));
             }
         }
         /*
         			if(ilViteroSettings::getInstance()->isAvatarEnabled() and 0)
         			{
         				try {
         					$avatar_service = new ilViteroAvatarSoapConnector();
         					$usr_image_path = ilUtil::getWebspaceDir().'/usr_images/usr_'.$ilUser->getId().'.jpg';
         
         					if(@file_exists($usr_image_path))
         					{
         						$avatar_service->storeAvatar(
         							$vuid,
         							array(
         								'name' => 'usr_image.jpg',
         								'type' => ilViteroAvatarSoapConnector::FILE_TYPE_NORMAL,
         								'file' => $usr_image_path
         							)
         						);
         					}
         				}
         				catch(ilViteroConnectorException $e)
         				{
         					// continue
         				}
         			}
         */
         // Assign user to vitero group
         $grp = new ilViteroGroupSoapConnector();
         $grp->addUserToGroup($this->object->getVGroupId(), $vuid);
         $grp->changeGroupRole($this->object->getVGroupId(), $vuid, $ilAccess->checkAccess('write', '', $this->object->getRefId()) ? ilViteroGroupSoapConnector::ADMIN_ROLE : ilViteroGroupSoapConnector::MEMBER_ROLE);
         $sc = new ilViteroSessionCodeSoapConnector();
         $dur = new ilDateTime(time(), IL_CAL_UNIX);
         $dur->increment(IL_CAL_HOUR, 2);
         $code = $sc->createPersonalBookingSessionCode($vuid, (int) $_GET['bid'], $dur);
         $GLOBALS['ilLog']->write(__METHOD__ . ': ' . ilViteroSettings::getInstance()->getWebstartUrl() . '?code=' . $code);
         ilUtil::redirect(ilViteroSettings::getInstance()->getWebstartUrl() . '?sessionCode=' . $code);
     } catch (ilViteroConnectorException $e) {
         ilUtil::sendFailure($e->getViteroMessage(), true);
         $ilCtrl->redirect($this, 'infoScreen');
     }
 }