VBTrain.Net Documentation

LmsApi2.GetJsForLogoff Function

Returns JavaScript to handle various logoff options. Depending on parameter values, the returned JavaScript may include SCORM calls to both LMSCommit (SCORM 1.2) or Commit (SCORM 1.3), and LMSFinish (SCORM 1.2) or Terminate (SCORM 1.3), and a command to close the SCO window. Calls may be placed inside a JavaScript function. See Techniques For Calling LMSFinish for more information.

Public Function GetJsForLogoff( _ 
ByVal callTypes As
LogoffEnum, _
ByVal logoffOption As
LogoffOptionsEnum , _
Optional ByVal windowToClose As String = "self", _
Optional ByVal functionName As String = "lmsLogoff" _
) As String

Parameters

callTypes
A LogoffEnum indicating whether to include calls to LMSCommit (1.2) or Commit (1.3), or LMSFinish (1.2) or Terminate (1.3), or both.
logoffOption
A LogoffOptionsEnum indicating whether to place calls inside a JavaScript function, or, if outside a function, whether or not to include JavaScript to close the specified window.
windowToClose
Optional. Specification of which window to close. If code is inside a frame, this parameter is typically set to "parent".
functionName
Optional. Specification of the function name in JavaScript. This parameter only applies when the logoffOption is set to the LogoffOptionsEnum callsInsideFunction .

Remarks

The JavaScript from the GetJsApiLocate function must be added to your page prior to using the JavaScript from GetJsForLogoff.

You can use the server side RegisterClientScriptBlock method to add the JavaScript from any LmsApi GetJs function to your HTML page.

Example

The following example assumes that the VBTrain.WebTracking.LmsApi2 namespace has been imported, and that the LmsApi for the session is stored as a property (LmsApiObject) of the current class.

[Visual Basic]
Private Sub BtnExit_Click( _
   ByVal sender As System.Object, _
   ByVal e As System.EventArgs) Handles BtnExit.Click

   Dim pgName As String = Me.CurrentPageName
   Dim apiObject As LmsApi = Me.LmsApiObject
   Dim js As String

   js = apiObject.GetJsApiLocate()
   Me.RegisterClientScriptBlock("apiLocate", js)

   js = apiObject.GetJsSetValue(SetValueEnum.location, pgName, True)
   Me.RegisterClientScriptBlock("setLessonLocation", js)

   js = apiObject.GetJsForLogoff(LogoffEnum.CommitAndTerminate, _
   LogoffOptionsEnum.callsPlusWindowClose, "parent")
   Me.RegisterClientScriptBlock("apiLogoff", js)
End Sub

See Also

LmsApi2 Class | LmsApi Members | Techniques For Calling LMSFinish |GetJsApiLocate | GetJsCommit | GetJsFinish