Submit a request
Submit a request

Custom Player Templates

Templates for the player ("Player templates") are used to configure the regions, and label bundle (and any other properties you wish to pass) of the Assess Player. 

There are three preconfigured regions based presets, and custom ones can be created, by:

  1. Passing an array of objects to the init option activity_edit.player_templates.
  2. Using the Template builder feature in the UI - turned on by setting activity_edit.player_template_builder.show to true, available from Author API v2021.3.LTS.

As above, custom templates can be provided via the init option activity_edit.player_templates.

Note: Selecting one of the options updates the JSON (in Source tab). The provided templates reference will be saved in the Activity metadata and used to "select" the template in the list when loading Activities. Thus, if, for some reason, the template is not passed in the init options, but was previously selected for an activity, the templates configuration data will still show in the source, but no template will be selected in the list.

To change the default selected template when a new Activity is created, use the init option activity_edit.default_player_template.

To only show custom templates, or only one of the defaults for example, you can pass an array of template references to the init option activity_edit.enabled_player_templates.

Example Preconfigured Player Templates list:

activity-editor-player-templates.png

The example code below shows configuring a new player template, which defines a custom Regions object, a label bundle to show the assessment player text in German, and configuration to only show one of the standard templates, and the newly defined custom player template in the list.

"enabled_player_templates": [
    "e883731f-6fb8-43b3-992b-14f53cdf8350",
    "some-unique-reference"
],
"default_player_template": "some-unique-reference",
"player_templates": [
    {
        "reference": "some-unique-reference",
        "name": "Regions with German Label Bundle",
        "regions": {
        "top-left": [
            {
                "type": "title_element"
            },
            {
                "type": "timer_element",
                "countdown_option": true
            }
        ],
        "left": [
            {
                "type": "save_button"
            },
            {
                "type": "fullscreen_button"
            },
            {
                "type": "separator_element"
            },
            {
                "type": "accessibility_button"
            },
            {
                "type": "calculator_button"
            },
            {
                "type": "verticaltoc_element"
            },
            {
                "type": "masking_button"
            },
            {
                "type": "next_button"
            },
            {
                "type": "previous_button"
            }
        ],
        "items": [
            {
                "type": "slider_element",
                "scrollable_option": false,
                "warning_on_change_option": false
            },
            {
                "type": "progress_element"
            }
        ],
        "bottom-right": [
            { "type": "next_button" },
            {
                "type": "previous_button"
            },
            {
                "type": "pause_button",
                "position": "right"
            },
            {
                "type": "itemcount_element"
            }
        ]
        },
        "labelBundle": {
            "accessibility": "Zugänglichkeit",
            "assessmentTimeExpired": "Die Zeit ist abgelaufen.",
            "calculator": "Taschenrechner",
            "close": "schließen",
            "configuration": "Konfiguration",
            "confirm": "Ja",
            "contactAdministrator": "Kontakt",
            "continue": "Fortsetzen",
            "decline": "Nein",
            "elapsedTime": "Verstrichen",
            "fullScreen": "Vollbild",
            "introItemMessage": "Drücken sie 'Start', wenn Sie bereit sind",
            "nextButtonLabel": "Nächster",
            "pause": "Pause",
            "play": "Abspielen",
            "previousButtonLabel": "Bisherige",
            "quit": "Verlassen",
            "reachedLastItem": "Das ist das ende.",
            "save": "Speichern",
            "saveButtonLabel": "Speichern",
            "saveInProgress": "Speichern...",
            "saving": "Speichern..",
            "startTest": "Beginne die Bewertung",
            "submit": "Einreichen",
            "submitButtonLabel": "Einreichen",
            "testPaused": "Pausiert"
        }
    }
],
            

Template storage

Templates created via the UI are stored in Learnosity's databases when the activity is saved, and can be reused across activities being created.

Template creation can be enabled by setting the init option activity_edit.player_template_builder.show to true.

Note: As well as enabling creation, this init option also gives the ability to edit and delete templates, so it should only be enabled for users who need it.

After enabling, users will be able to see the "Create" button under the template list:

mceclip0.png

Upon clicking create, the builder will load:

mceclip2.png

All elements are show in the left menu, split into either assigned or unassigned elements.

Elements can be moved into position by either:

  • Clicking and dragging (either from left menu, or from the template itself)
  • Clicking an element once, then clicking into a region to drop
  • Navigating the screen using tab/shift-tab, and selecting and dropping an element using Enter.

When an element is selected or being dragged, the regions will become greyed out if the element can not be part of that region.

Label bundles can be set via the template builder UI and other properties can be set via the Source tab.

Some elements have additional configuration options, which are shown in the left panel, as below:

mceclip3.png

After naming the template, clicking "Apply" will add the template to the list, copy the settings into the current Activity's JSON, and close the takeover. 

The Activity must be saved for the new template to be saved into the database.

After templates have been created, they will appear, and can be used, by all users of that organisation. As above, only those with the init option set will be able to edit/delete templates.

Templates will automatically be loaded and shown in the template list, as in the above picture.

Selecting a template will:

  1. Copy all settings configured in the template into the Activity's source JSON.
  2. Remove any keys set by the currently selected template

Changing templates for an activity will discard any player settings defined in the earlier template and add in the configurations from the newly selected template including configurations defined for label bundles. 

Note: Activities are not explicitly linked to Templates - selecting a template copies the template data to the Activity source JSON and stores the metadata so it can be highlighted in the list. If the template is updated however, existing Activities will not be updated.

 

When a template is selected, the "Edit" button will show next to the template name.

mceclip6.png

Editing a template will update the JSON of the current Activity, but not update the JSON of other Activities which were created using the older version of this template.

The Activity must be saved for the template changes to be saved into the database. It is recommended that you preview that template being created in the player tab of the activity. 

Hovering over the row will also show the "Delete" button (which turns to a confirmation button is pressed):

mceclip1.png

Deleting a template will remove properties which were set by this template from the JSON of the current Activity, but not update the JSON of other Activities which were created using this template.

The Activity must be saved for the template to be removed from the database.

 

Was this article helpful?
0 out of 0 found this helpful

Did you arrive here by accident? If so, learn more about Learnosity by clicking here.