Default objects for Velocity Code

Default objects for Velocity Code

To use Velocity scripting in header / footer code, you need to turn on Velocity by adding following custom property in the Site Details->Customizations tab.

ENABLE_VELOCITY=true

API Description
Methods on UIContext object  
getCurrentLogoPath Returns currently set logo's path for the site. The output can be used in an IMG tag to create the Logo in custom header.
getUrl Returns the URL of the current page
getPageDescriptor Returns the page descriptor if the currently displayed page is a CMS published page
getCurrentUser Returns User object corresponding to current user. The User object further provides firstName, lastName and userName properties which can be used to display a customized greeting in the header.
Methods on User object  
getFirstName  
getLastName  
getNonPrefixedUserName User name of the current user
getAttachment Picture of the current user (if uploaded). The output variable is of type Attachment
isAdmin  
isGuest  
getProperty("Custom User Property Name") Custom user property value
   
TestInstance object This object contains the data corresponding to the results of a test taken by a user. The object can be accessed as ${testInstance}
getTest Test which was taken by the user
getStudent User who took test
getStartedOn Date on which the test was taken
getNoOfAttempted Total number of questions attempted by the user
getNoOfCorrect Total number of correctly attempted questions
getNoOfIncorrect Total number of incorrectly attempted questions
getTotalScore Total score obtained by the user
getResult Whether the user passed or failed in the test
Test object This object contains the data corresponding to the test that was taken by a user.
getName Name of the test
getDuration Duration of the test in milliseconds
getTotalQuestions Total number of questions in the test
getTotalMarks Total points in the test
getPassingMarks Passing points in the test if specified
getNegativeMarksPerQuestion Negative points in the test if specified

 


Rating: