JClicProject

Source: JClicProject.js:50

JClicProject contains all the components of a JClic project: activities, sequences, media
files, descriptors and metadata.

This encapsulation is achieved by three auxiliary objects:

  • ProjectSettings: stores metadata like full title, description, authors, languages,
    educational topics...
  • ActivitySequence: defines the order in which the activities must be shown.
  • MediaBag: contains the list of all media files used by the activities

Constructor

new JClicProject(): JClicProject

JClicProject constructor


Instance Methods

setProperties( $xml: external:jQuery, path: string, zip?: external:JSZip, options?: object, ): module:project/JClicProject.JClicProject

Loads the project settings from a main jQuery XML element

Parameters

  • $xml (external:jQuery) — The XML element
  • path (string) — The full path of this project
  • zip (external:JSZip, optional) — An optional JSZip object where this project is encapsulated
  • options (object, optional) — An object with miscellaneous options

Returns

getAttributes(): object

Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.

Returns

  • object

getJSON(space?: number): string

Gets a JSON string representing the content of this project. This string can be transformed later into a data
object suitable for setAttributes.

Parameters

  • space (number, optional, default: 0) — The number of white spaces to place between items. Defaults to zero (meaning all the JSON rendered in one single line)

Returns

  • string

setAttributes( data: object, path: string, zip?: external:JSZip, options?: object, ): module:project/JClicProject.JClicProject

Loads the project settings from a data object

Parameters

  • data (object) — The data object
  • path (string) — The full path of this project
  • zip (external:JSZip, optional) — An optional JSZip object where this project is encapsulated
  • options (object, optional) — An object with miscellaneous options

Returns

getActivity(name: string): module:Activity.Activity

Finds activities by name and builds the corresponding Activity object.

Parameters

  • name (string) — The name of the requested activity

Returns

realize(ps: module:JClicPlayer.JClicPlayer)

Builds the Skin, EventSounds and MediaBag fonts associated to this project.

Parameters

end()

Run finalizers on realized objects

Instance Fields

name: string

The project's name

version: string

The version of the XML file format used to save the project (currently 0.1.3)

type: string

Optional property that can be used by reporting systems

code: string

Optional property that can be used by reporting systems

settings: module:project/ProjectSettings.ProjectSettings

Object containing the project settings

activitySequence: module:bags/ActivitySequence.ActivitySequence

Object containing the order in which the activities should be played

reportableActs: number

Number of activities suitable to be included reports

mediaBag: module:bags/MediaBag.MediaBag

The collection of all media elements used in this project

skin: module:skins/Skin.Skin

The object that builds and manages the visual interface presented to users

basePath: string

Relative path or absolute URL to be used as a base to access files, usually in conjunction
with module:JClicPlayer.JClicPlayer#basePath

path: string

Full path of this project

zip: external:JSZip

The JSZip object where this project is stored (can be null)