Constructor
new TCPReporter(ps)
TCPReporter constructor
| Name | Type | Description | 
|---|---|---|
| ps | module:JClicPlayer. | The  | 
- Source
Extends
- module:reports/Reporter.Reporter
Members
DEFAULT_SERVER_PATH :string
Default path of JClic Reports Server
- string
- Source
DEFAULT_SERVER_PROTOCOL :string
Default server protocol
Use always 'https' except when in 'http' and protocol not set in options
- string
- Source
DEFAULT_SERVER_SERVICE :string
Default name for the reports service
- string
- Source
DEFAULT_TIMER_LAP :number
Default lap between calls to flushTasks, in seconds
- number
- Source
actCount :number
Number of activities processed
- number
- Source
beforeUnloadFunction :function
Function to be called by the browser before leaving the current page
- function
- Source
currentSessionId :string
Identifier of the current session, provided by the server
- string
- Source
dbProperties :object
Object used to store specific properties of the connected reports system
- object
- Source
descriptionDetail :string
Additional info to display after the reporter's description
- string
- Source
descriptionKey :string
Description of this reporting system
- string
- Source
failCount :number
Counter of unsuccessful connection attempts with the report server
- number
- Source
forceFlush :boolean
Force processing of pending tasks as soon as possible
- boolean
- Source
lastActivity :module:report/ActivityReg.ActivityReg
Last activity reported
- Source
maxFails :number
Maximum number of failed attempts allowed before disconnecting
- number
- Source
processingTasks :boolean
Flag used to indicate if transaction is currently running
- boolean
- Source
serverPath :string
Main path of the reports server (without protocol nor service)
- string
- Source
serviceUrl :string
Service URL of the JClic Reports server
- string
- Source
tasks :Array.<module:report/TCPReporter.ReportBean>
List of ReportBean objects pending to be processed
- Source
timer :number
Identifier of the background function obtained with a call to window.setInterval
- number
- Source
timerLap :number
Time between calls to the background function, in seconds
- number
- Source
waitingTasks :Array.<module:report/TCPReporter.ReportBean>
Waiting list of tasks, to be used while tasks is being processed
- Source
Methods
addTask(bean)
Adds a new element to the list of report beans pending to be transmitted.
| Name | Type | Description | 
|---|---|---|
| bean | module:report/TCPReporter. | 
- Source
createDBSession(forceNewSession) → {external:Promise}
Creates a new session in the remote database and records its ID for future use
| Name | Type | Description | 
|---|---|---|
| forceNewSession | boolean | When  | 
- Source
- A Promise reporter will be successfully resolved
 only whencurrentSessionIdhave a valid value.
- Type:
- external:Promise
end() → {external:Promise}
Closes this reporting system
- Source
- A promise to be fullfilled when all pending tasks are finished, or null if not active.
- Type:
- external:Promise
endActivity(score, numActions, solved)
This method should be called when the current activity finishes. Data about user's final results
on the activity will then be saved.
| Name | Type | Description | 
|---|---|---|
| score | number | The final score, usually in a 0-100 scale. | 
| numActions | number | The total number of actions done by the user to solve the activity | 
| solved | boolean | 
 | 
- Source
flushTasksPromise() → {external:Promise}
Transmits all report beans currently stored in tasks to the reports server
- Source
- Type:
- external:Promise
getGroups() → {external:Promise}
Gets the list of current groups or organizations registered on this reporting system.
- Source
- When fulfilled, an array of group data is returned as a result
- Type:
- external:Promise
getProperty(key, +) → {string}
Gets a specific property from this reporting system
| Name | Type | Description | 
|---|---|---|
| key | string | Requested property | 
| + | string | defaultValue - Default return value when requested property does not exist | 
- Source
- Type:
- string
getUserData(userId) → {external:Promise}
Gets extended data associated with a specific user.
| Name | Type | Description | 
|---|---|---|
| userId | string | The requested user ID | 
- Source
- When fulfilled, an object with user data is returned.
- Type:
- external:Promise
getUsers(+) → {external:Promise}
Gets the list of users currently registered in the system, optionally filtered by
a specific group ID.
| Name | Type | Description | 
|---|---|---|
| + | string | groupId - Optional group ID to be used as a filter criteria | 
- Source
- When fulfilled, an object with a collection of user data records
 is returned
- Type:
- external:Promise
init(optionsopt) → {external:Promise}
Initializes this report system with an optional set of parameters.
Returns a Promise, fulfilled when the reporter is fully initialized.
| Name | Type | Attributes | Description | 
|---|---|---|---|
| options | object | <optional> | Initial settings passed to the reporting system | 
- Source
- Type:
- external:Promise
newActivity(act)
This method should be invoked when the user starts a new activity
| Name | Type | Description | 
|---|---|---|
| act | module:Activity. | The  | 
- Source
newSession(jcp)
This method should be invoked when a new session starts.
| Name | Type | Description | 
|---|---|---|
| jcp | module:project/JClicProject. | The  | 
- Source
reportActivity(flushNow)
Prepares a ReportBean object with information related to the current
activity, and pushes it into the list of pending tasks, to be processed by the main timer.
| Name | Type | Description | 
|---|---|---|
| flushNow | boolean | When  | 
- Source
stopReporting() → {external:Promise}
Stops the reporting system, usually as a result of repeated errors or because the player
shuts down.
- Source
- A promise to be fullfilled when all pending tasks are finished.
- Type:
- external:Promise
transaction($xml) → {external:jqXHR}
Performs a transaction on the remote server
| Name | Type | Description | 
|---|---|---|
| $xml | external:jQuery | The XML element to be transmited, wrapped into a jQuery object | 
- Source
- The external:jqXHRobtained as a result of a call to$.ajax.
 This object should be treated as a Promise or
 as a JQuery Deferred object.
- Type:
- external:jqXHR