UI Customization JavaScript Functions

Javascript object "EB_V2_UI" is api object exposed as an interface. You can use this object to make following call to get different widgets.

Secondly we can also customize the HTML that will be returned back as response. This is achieved by providing custom velocity template under CMS and configuring a well defined property for a given widget  to use this velocity template. 

It is also possible to use multiple velocity template for having different UI at different locations/pages. We'll look at one detailed example in this document that will make it much clear. 

Below are different widgets available via Javascript APIs

  • My Enrolled Courses

EB_V2_UI.my_enrolled_courses(<containerdivId>, <templateIndex>, <callback>,  <reqParams>);

<containerdivId> Id of the container div under which this widget will be added.
<templateIndex> Index location of the name of velocity template to use.
Applicable only when customized html using velocity code. (use default null OR 0 )
<callback> Javascript callback function to call once response is returned.
<reqParams> Javascript object with key value for different values as below.
 
currPage Current page number for data.
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.

 

  • My Enrolled Programs

EB_V2_UI.my_enrolled_programs(<containerdivId>, <templateIndex>, <reqParams>);

<containerdivId> Id of the container div under which this widget will be added.
<templateIndex> Index location of the name of velocity template to use.
Applicable only when customized html using velocity code. (use default null OR 0 )
<reqParams> Javascript object with key value for different values as below.
 
currPage Current page number for data.
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.

 

  • My Expired courses

EB_V2_UI.my_expired_courses(<containerdivId>, <templateIndex>);

<containerdivId> Id of the container div under which this widget will be added.
<templateIndex> Index location of the name of velocity template to use.
Applicable only when customized html using velocity code. (use default null OR 0 )

 

  • My Awarded Courses

EB_V2_UI.my_awarded_courses(<containerdivId>, <templateIndex>);

<containerdivId> Id of the container div under which this widget will be added.
<templateIndex>

Index location of the name of velocity template to use.
Applicable only when customized html using velocity code. (use default null OR 0 ).

 

  • My Awarded Programs

EB_V2_UI.my_awarded_programs(<containerdivId>);

<containerdivId> Id of the container div under which this widget will be added.

Note :We can have one flavour of html customised via velocity template mechanism as usual.  However, this widget does not support multiple different html favours(currently), hence templateId param is not present. 

 

  • My Subscribed Events

EB_V2_UI.my_subscribed_events(<containerdivId>);

<containerdivId> Id of the container div under which this widget will be added.

 

  • My Assignments

EB_V2_UI.my_assignments(<containerdivId>);

<containerdivId> Id of the container div under which this widget will be added.

 

  • My Inbox

EB_V2_UI.my_inbox(<containerdivId>);

<containerdivId> Id of the container div under which this widget will be added.

 

  • Calendar

EB_V2_UI.calendar(<containerdivId>);

<containerdivId> Id of the container div under which this widget will be added.

 

  • My Groups

EB_V2_UI.my_groups(<containerdivId>, <userId>, <reqParams>,  <pagination>);

<containerdivId> Id of the container div under which this widget will be added.
<userId> userId of the whose we want to get groups. If passed null It will fetch current logged user's groups.

<reqParams>

Javascript object with key value for different values as below.
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
templateIndex Index location of the name of velocity template to use.
Applicable only when customized html using velocity code. (use default null OR 0 )

<pagination>

Javascript object with key value for different options for pagination
numItems  
pageSize  

 

  • Site Leaderboard
    There are two flavours available for leaderboardSite Leaderboard 

        1. EB_V2_UI.site_leaderboard(<containerdivId>, <paginationFlag>)

<containerdivId> Id of the container div under which this widget will be added.
<paginationFlag> Boolean value if pagination is needed. If true we can provide following properties in global scope. Each of the variable below is prefixed with widget specific prefix . Here "ldr_" for leaderboard widget
 
ldr_numItems Number of items to return
ldr_currPage Current page number for data.
ldr_numPages This will be available on response. It contains number of pages based on pagesize.

        2. ​EB_V2_UI.site_leaderboard_widget(<containerdivId>)

<containerdivId> Id of the container div under which this widget will be added.

You can override paging and other properties by overriding following 

EB_V2_UI.widgetPagination.leaderboard.pageSize = 20
EB_V2_UI.widgetPagination.leaderboard.currPage = 0

 

  • Network Updates

EB_V2_UI.nw_updates​(<containerdivId>,  <reqParams>, <callback>)

This widget can be used to get activities across site. We can filter based of type of activities. We can also filter to get activities of particular group or particular course session.

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
  groupIds Comma separated groupId.
  usageMetricsTypeList Comma separated activity types. Example : LESSON_VIEWED,SCORM_LAUNCH etc
There are many more activities tracked.
 
<templateIndex> Index location of the name of velocity template to use.
Applicable only when customized html using velocity code. (use default null OR 0 )
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

 

  • OpenLearning Featured lessons

EB_V2_UI.openlearning_featured_lessons(<containerdivId>,  <reqParams>, <callback>)

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
 
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

  • OpenLearning Popular lessons

EB_V2_UI.openlearning_popular_lessons(<containerdivId>,  <reqParams>, <callback>)

 

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
 
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

  • OpenLearning Recently Viewed

This widget returns recently viewed open learning lessons for current user.

EB_V2_UI.openlearning_recently_viewed(<containerdivId>,  <reqParams>, <callback>)

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
 
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

  • OpenLearning Random Picks

This widget returns open learning lessons randomly. Additionally there is json filter that can be applied to restrict to lessons from specific courses based on custom property.

EB_V2_UI.openlearning_random_picks(<containerdivId>,  <reqParams>, <callback>)

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
  customFilterJsonStr Additional filter for json . Currently supports course's custom property key:value.
 
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

  • OpenLearning My Playlist

This widget returns user's open learning lessons's playlist created by him/her .

EB_V2_UI.openlearning_my_playlist(<containerdivId>,  <reqParams>, <callback>)

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
 
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

  • OpenLearning Featured Playlist

This widget returns open learning playlist which are created by site administrator as featured playlist at site level.

EB_V2_UI.openlearning_featured_playlist(<containerdivId>,  <reqParams>, <callback>)

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
 
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

  • Suggested lessons

This widget returns suggested open learning lessons for user.

EB_V2_UI.suggested_lessons(<containerdivId>,  <reqParams>, <callback>)

<containerdivId> Id of the container div under which this widget will be added.
<reqParams> Javascript object with key value for different values as below.
 
currPage current page number
pageSize Number of items to return
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<callback> Javascript callback function to call once response is returned.

 

  • Site Course Catalog

This widget gets the catalog based on the various filters passed

EB_V2_UI.site_course_catalog_v2​(<containerdivId>, <metadata>, <filters>, <uiOpt>, <pagination>, <callback>)

<containerdivId> Id of the container div under which this widget will be added.
<metadata>
Javascript object with key value for different metatda and course name values as below.
subjectId  
skillLevelId  
complexityId  
examId  
regionId  
   
<filters>
Javascript object with key value for different filters based on what type of items we want to fetch
csIncluded Booleanm , inlcude course sessions
psIncluded Boolean, include program sessions
evIncluded Boolean, include events
allItems Boolean, inlcude all types of items
<uiOpt>
Javascript object with key value for different options
cacheEnabled Boolean. To set Http cache headers.
cacheDuration Set http cache expiry header with value in minutes to expiry.If not set default
30 minutes is set. Default value can also be set at site level.
<pagination>
Javascript object with key value for different options for pagination
numItems  
pageSize  
<callback>

Callback method

 

 

 


Rating: