Let user send an invitation.

@since 2.0.0
@access public
@param int $InvitationID Unique identifier.
@param string $TransientKey Security token.
434857
public function SendInvite($InvitationID = '', $TransientKey = '') {
      $this->Permission('Garden.SignIn.Allow');
      $InvitationModel = new InvitationModel();
      $Session = Gdn::Session();
      if ($Session->ValidateTransientKey($TransientKey)) {
         try {
            $Email = new Gdn_Email();
            $InvitationModel->Send($InvitationID, $Email);
         } catch (Exception $ex) {
            $this->Form->AddError(strip_tags($ex->getMessage()));
         }
         if ($this->Form->ErrorCount() == 0)
            $this->InformMessage(T('The invitation was sent successfully.'));

      }
      
      $this->View = 'Invitations';
      $this->Invitations();
   }
534958
public function Themes($ThemeName = '', $TransientKey = '') {
      $this->AddJsFile('addons.js');
      $this->SetData('Title', T('Themes'));
         
      $this->Permission('Garden.Settings.Manage');
      $this->AddSideMenu('dashboard/settings/themes');
      
      $ThemeInfo = Gdn::ThemeManager()->EnabledThemeInfo(TRUE);
      $this->SetData('EnabledThemeFolder', GetValue('Folder', $ThemeInfo));
      $this->SetData('EnabledTheme', Gdn::ThemeManager()->EnabledThemeInfo());
      $this->SetData('EnabledThemeName', GetValue('Name', $ThemeInfo, GetValue('Index', $ThemeInfo)));
      
      $Themes = Gdn::ThemeManager()->AvailableThemes();
      uasort($Themes, array('SettingsController', '_NameSort'));
      
      // Remove themes that are archived
      $Remove = array();
      foreach ($Themes as $Index => $Theme) {
         $Archived = GetValue('Archived', $Theme);
         if ($Archived)
            $Remove[] = $Index;
      }
      foreach ($Remove as $Index) {
         unset($Themes[$Index]);
      }
      $this->SetData('AvailableThemes', $Themes);
      
      if (Gdn::Session()->ValidateTransientKey($TransientKey) && $ThemeName != '') {
         try {
            $ThemeInfo = Gdn::ThemeManager()->GetThemeInfo($ThemeName);
            if ($ThemeInfo === FALSE)
               throw new Exception(sprintf(T("Could not find a theme identified by '%s'"), $ThemeName));
            
            Gdn::Session()->SetPreference(array('PreviewThemeName' => '', 'PreviewThemeFolder' => '')); // Clear out the preview
            Gdn::ThemeManager()->EnableTheme($ThemeName);
            $this->EventArguments['ThemeName'] = $ThemeName;
            $this->EventArguments['ThemeInfo'] = $ThemeInfo;
            $this->FireEvent('AfterEnableTheme');
         } catch (Exception $Ex) {
            $this->Form->AddError($Ex);
         }
         
         if ($this->Form->ErrorCount() == 0)
            Redirect('/settings/themes');

      }
      $this->Render();
   }
455344
public function setId($keyId = 0)
    {
        if (empty($keyId) || $keyId == 0) {
            throw new GdgCommonsInvalidArgumentException("Key id must not be null or empty");
        }
        
        if (!is_int($keyId)) {
            throw new GdgCommonsInvalidArgumentException("Key id must be integer");
        }
        
        $this->_keyId = $keyId;
    }
1370813
public void setInvites(java.util.Collection<Invite> invites) {
        if (invites == null) {
            this.invites = null;
            return;
        }

        this.invites = new java.util.ArrayList<Invite>(invites);
    }
141752
public function removeSentInvitation(\WobbleCode\UserBundle\Document\Invitation $sentInvitation)
    {
        $this->sentInvitations->removeElement($sentInvitation);
    }
352726
public function sendID($info = null)
    {
        if (!$this->_capability('ID')) {
            throw new Horde_Imap_Client_Exception_NoSupportExtension('ID');
        }

        $this->_sendID(is_null($info) ? ($this->getParam('id') ?: array()) : $info);
    }
617410
public function send(string $recipientID, Notification $notification): void
    {
        $app = App::get();

        if ($notification->id === null) {
            $notification->id = 'n' . uniqid() . 'x' . base_convert(rand(0, 999999999), 10, 16);
        }
        if ($notification->dateCreated === null) {
            $notification->dateCreated = time();
        }

        if ($this->hasEventListeners('beforeSendNotification')) {
            $eventDetails = new \IvoPetkov\BearFrameworkAddons\Notifications\BeforeSendNotificationEventDetails($recipientID, $notification);
            $this->dispatchEvent('beforeSendNotification', $eventDetails);
            if ($eventDetails->preventDefault) {
                return;
            }
        }

        if (strlen($notification->type) > 0) {
            $otherNotifications = $this->getList($recipientID);
            foreach ($otherNotifications as $otherNotification) {
                if ((string) $notification->type === (string) $otherNotification->type) {
                    $this->delete($recipientID, $otherNotification->id);
                }
            }
        }

        $this->set($recipientID, $notification);

        if ($this->hasEventListeners('sendNotification')) {
            $eventDetails = new \IvoPetkov\BearFrameworkAddons\Notifications\SendNotificationEventDetails($recipientID, $notification);
            $this->dispatchEvent('sendNotification', $eventDetails);
        }
    }
708044
public function deleted(MemberInvitation $invitation)
    {
        $member = Member::findOrFail($invitation->member_id);
        /** @noinspection PhpUndefinedMethodInspection */
        $member->forceDelete();
    }
1000899
public function Delete($RouteIndex = FALSE, $TransientKey = FALSE) {
      $this->Permission('Garden.Settings.Manage');
      $this->DeliveryType(DELIVERY_TYPE_BOOL);
      $Session = Gdn::Session();
      
      // If seeing the form for the first time...
      if ($TransientKey !== FALSE && $Session->ValidateTransientKey($TransientKey))
         Gdn::Router()->DeleteRoute($RouteIndex);
      
      if ($this->_DeliveryType === DELIVERY_TYPE_ALL)
         Redirect('dashboard/routes');

      $this->Render();      
   }
797331
public function Register($InvitationCode = '') {
      if (!$this->Request->IsPostBack())
         $this->CheckOverride('Register', $this->Target());
      
      $this->FireEvent("Register");
      
      $this->Form->SetModel($this->UserModel);

      // Define gender dropdown options
      $this->GenderOptions = array(
         'u' => T('Unspecified'),
         'm' => T('Male'),
         'f' => T('Female')
      );

      // Make sure that the hour offset for new users gets defined when their account is created
      $this->AddJsFile('entry.js');
         
      $this->Form->AddHidden('ClientHour', date('Y-m-d H:00')); // Use the server's current hour as a default
      $this->Form->AddHidden('Target', $this->Target());
      
      $this->SetData('NoEmail', UserModel::NoEmail());
      
      $RegistrationMethod = $this->_RegistrationView();
      $this->View = $RegistrationMethod;
      $this->$RegistrationMethod($InvitationCode);
   }
116800
public function setInvitationDocument(\AgentSIB\Diadoc\Api\Proto\InvitationDocument $value = null)
    {
        $this->InvitationDocument = $value;
    }
100687
public function addGuest($id,$guest) {
        if(is_string($guest)) {
            $params = array('email'=>$guest);
        } elseif(is_numeric($guest)) {
            $params = array('user_id'=>$guest);
        }else  {
            throw new \Exception('Invalid parameter');
        }
         
        return $this->post('/projects/'.$id.'/add_guest.json', $params);
        
    }
703581
public static function onConnect($callback_key, $fd, $from_id) {
		if (isset(self::$_listener[$callback_key])) {
			call_user_func(self::$_listener[$callback_key], 'connect', $fd, $from_id);
		}
	}
157665
public function setInvitations(\WobbleCode\UserBundle\Document\Invitation $invitations)
    {
        $this->invitations = $invitations;
        return $this;
    }
701087
def invite(self, event):
        """"""

        self.log('Inviting new user to enrol')
        name = event.data['name']
        email = event.data['email']
        method = event.data['method']

        self._invite(name, method, email, event.client.uuid, event)
1129931
public function addKeyRecipient($recipientId, $publicKey)
    {
        try {
            $this->cipher->addKeyRecipient($recipientId, $publicKey);

            return $this;
        } catch (Exception $e) {
            throw new CipherException($e->getMessage(), $e->getCode());
        }
    }
292315
public function acquireCounteragentByInnWithDocument($myOrgId, $counteragentInn, $myDepartmentId = null, InvitationDocument $invitationDocument = null, $messageToContragent = null)
    {
        $request = new AcquireCounteragentRequest();
        $request->setInn($counteragentInn);
        $request->setMessageToCounteragent($messageToContragent);
        $request->setInvitationDocument($invitationDocument);

        $response = $this->doRequest(
            self::RESOURCE_ACQUIRE_COUNTERAGENTS_V2,
            [
                'myOrgId' => $myOrgId,
                'myDepartmentId'    =>  $myDepartmentId,
            ],
            self::METHOD_POST,
            $request->toStream()->getContents()
        );
        return AsyncMethodResult::fromStream($response);
    }