Expert Mode

Last modified by Carina Enke on 15.01.2024

Application examples of expert rules

In the following, you will find examples of how to use the expert syntax.

 

Typical application examples

Make individual content elements in a public course only visible to registered users ...

Do you wish to hide certain content elements in a public course from guests? Then enter the following code into the text field next to Expert mode in the Visibility tab of the corresponding course element. This will hide the course element in a publicly accessible course from non-registered guest users.

isGuest(0)=false

Configuration in the course editor

Kurseditor - Konfiguration nur registrierte Nutzer_de.png

Course view as a registered user

Kursrun - Ansicht registrierte Nutzer_de.png

Course view as a guest user

Kurseditor - Konfiguration nicht für Gäste_de.png

Course view as a course owner

Kursrun - Ansicht Kursverantwortlicher_de.png

Make individual content elements in a public course only visible to guests ...

Do you wish to display certain content elements in a public course only to guests and course owners? Then enter the following code into the text field next to Expert mode in the Visibility tab of the corresponding course element. This will display the course element in a publicly accessible course only to guest users and course owners.

isGuest(0)=true |isCourseAdministrator(0

Configuration in the course editor

Kurseditor - Konfiguration keine Gäste_de.png

Course view as a registered user

Kursansicht - nicht für registrierte Nutzer_de.png

Course view as a guest user

Kursrun - Ansicht nur Gäste_de.png

Course view as a course owner

Kursrun - Ansicht Kursverantwortlicher_de.png

Activate course elements according to test result ...

Do you wish to activate certain course elements depending on a test? For instructions on how to implement this scenario, see the help page Learning path control by test result.

Further application examples of the expert syntax ...

In addition to the general examples, which can be used institution-independently, there are also institution-specific restrictions on data that will be transmitted depending on the institution.

For OPAL users, the help page Overview of OPAL Shibboleth attributes contains all currently usable institution-specific attributes of Saxon institutions.

Examples of rules in the tabs «Visibility », « Access », and « Points » (structure element)

Effects

isGuest(0)=true

If this code is entered in the Visibility tab, the course element will only be visible to guests, but not to registered users.

If this code is entered in the Access tab, only guests will have access to this course element.

Alternatively, the code isGuest(0) or isGuest (0)=1 can be used.

isGuest(0)=false

If this code is entered in the Visibility tab, the course element will be hidden from guests.

If this code is entered in the Access tab, guests will not have access to the course element's contents.

inLearningGroup("Beginners") = false

With the exception of the «Beginners» group, the course element will be visible to all course participants.

(now >= date("22.03.2017 12:00")) & (now <= date("23.08.2017 18:00")) | inLearningGroup("Supervisors")

The course element will be visible to all course participants from 22.03.2017 to 23.08.2017. For the members of the «Supervisors» learning groupin contrast, it will be visible at any time.

(now >= date("03.09.2017 00:00")) & (now <= date("13.10.2017 00:00")) & inRightGroup("Assessors")| isUser("Author")

The course element will be visible to all course participants of the «Assessors» right group from 03.09.2017 to 13.10.2017. For the user with the user name «Author»in contrast, it will be visible at any time.

isInAttribute("surname","Mue")

Returns TRUE for all users whose «surname» attribute contains the letter sequence "Mue". For example, it returns TRUE for the value "Mueller" or "Muehlebacher".

(getUserProperty("orgUnit") = "Marketing")

Checks whether a person is in the "Marketing" organisation unit. This is useful, for example, if the data is automatically transferred from LDAP.

(getPassed("69742969114730") | getPassed("69742969115733") | getPassed("69742969118009")) * 10

This rule can be set in the «Points» tab -> «Process points» of the Structure course element. The Structure course element shows 10 points if any of the tests (course element IDs "69742969114730", "69742969115733", or "69742969118009") will be passed, otherwise it shows 0 points.

(getScore("69742969114730") + getScore("69742969115733") + getScore("69742969118009")) >= 140 | getPassed("69978845384688")

This rule can be set in the «Points» tab ->

«Passed if» of the Structure course element. The Structure course element shows "passed" if a minimum of 140 points will be achieved across all tests or if «passed» will be manually set (Assessment course element with the ID "69978845384688").

getAttempts("70323786958847") > 0

Returns TRUE as soon as the course participant has completed the test with the specified ID for the first time.

getAttempts("70323524635734") <= 3

Returns FALSE as soon as the course participant has saved more than 3 files to the drop box of the Task course element.

getInitialEnrollmentDate("70323786958847") <= date("26.5.2017 18:00")

Returns TRUE for those course participants who enrolled in one of the available groups via the Enrolment course element using a specified ID before 6 p.m. on May 26 2017.

getInitialEnrollmentDate("70323786958847") + 2h > now

Returns TRUE within two hours from the time of enrolment for those course participants who enrolled in one of the available groups via the Enrolment course element using a specified ID. In this way, it can be ensured that each course participant can only e.g. process a script during a certain period of time.

(getInitialCourseLaunchDate(0) >= never) | (getInitialCourseLaunchDate(0) + 2h > now)

Returns TRUE if the course participant has not yet visited the course, or during the first two hours of the first course visit. In this way, it can be ensured that each course participant can only see the course for a certain period of time.

(getRecentCourseLaunchDate(0) + 10min) > now

Returns TRUE if the user has been active in the course for more than 10 minutes.

getOnyxTestOutcome("84692289655276","SCORE") >= 10

Returns TRUE if the user has reached at least 10 points.

getOnyxTestOutcomeZK("84389429397045","PASS") ="true"

Returns TRUE if the user has passed the test.

getMark("84692289655276") > 4

Returns TRUE if the user's mark for the specified course element is better than 4.

getProgress("69742969114730")>=100

Returns TRUE if the user has completed the specified course element (course progress).

Attention!

Please note that the above-mentioned course element IDs are just examples. When you create a course, you need to reference the IDs of your own courses.

Expert syntax

Overview of the available expert syntax ...

Type

Syntax

Description

Constants

TRUE or 1

True

FALSE or 0

False

Variable

now

Current server system time

Functions


 


 



 


 


 


 


 

date("[date]")

Query date

inLearningGroup("[string]")

Returns TRUE for all members of the learning group with the title [string] of the current course.

inLearningGroup("[string1]","[string2]")

Returns TRUE for all members of the specified learning group [string1] of the course with the specified course ID=[string2].

inLearningGroupWaitingList("[string]")

Returns TRUE for all users on the waiting list of the learning group [string] of the current course.

inLearningGroupWaitingList("[string1]","[string2]" )

Returns TRUE for all users on the waiting list of the learning group [string1] of the course with the specified course ID=[string2].

inRightGroup("[string]")

Returns TRUE for all members of the right group [string].

isLearningGroupFull("[string]")

Returns the Boolean TRUE (=full) or FALSE (=not full) for the specified learning group in the current course.

isLearningGroupFull("[string1]","[string2]")

Returns the Boolean TRUE (=full) or FALSE (=not full) for the specified learning group=[string1] of the course with the course ID=[string2].

isUser("[string]")

Returns TRUE for the user with the user name [string].

inLearningArea("[string]")

Returns TRUE for all members of the groups in the learning area [string] of the current course.

inLearningArea("[string1]","[string2]")

Returns TRUE for all members of the groups in the specified learning area [string1] of the course with the specified course ID=[string2].

getNumberOfEnrollments("[string1]*")

Returns TRUE, when the configured number of learning group members is reached in the learning area (string1).

isGlobalAuthor()

Returns TRUE for all members of the OPAL author group.

isCourseAdministrator()

Returns TRUE for all owners of your course (learning resource).

isCourseCoach()

Returns TRUE for all users who supervise a learning group.

isGuest()

Returns TRUE for all users who visit OPAL as guests.

isExternalUser()

Returns TRUE for everyone who uses OPAL as an external user.

hasAttribute("[AttrName]","[string]")

Returns TRUE if [string] matches the value of the AAI attribute [AttrName] of the respective user.

isInAttribute("[AttrName]","[substring]")

Returns TRUE if [substring] matches a portion of the value of the AAI attribute [AttrName] of the respective user.

getUserProperty("[string]")

Returns the specified user property of the executing user.

getPassed("[integer]")

Returns the Boolean TRUE (=passed) or FALSE (=not passed) from the course element with the specified ID.

getScore("[integer]")

Returns the number of points from the course element with the specified ID.

getAttempts("[integer]")

Returns the number of completed attempts from the course element with the specified ID. Can be applied to course elements of the type Test, Self-test, Survey (possible return values 0 or 1), and Task (return value = number of submitted files).

getInitialEnrollmentDate("[integer]")

Returns the date of the respective course participant's first-time enrolment from the Enrolment course element with the specified ID.

getRecentEnrollmentDate("[integer]")

Returns the date of the respective course participant's last enrolment from the Enrolment course element with the specified ID.

getInitialCourseLaunchDate()

Returns the date of the first-time course visit of the respective course participant.

getRecentCourseLaunchDate()

Returns the date of the last course visit of the respective course participant.

getPassedWithCourseId("[integer-1]","[integer- 2]")

Returns the Boolean TRUE (=passed) or FALSE (=not passed) from the course element with the ID=[integer-2] of the course with the ID=[integer-1].

getScoreWithCourseId("[integer-1]","[integer-2]")

Returns the number of points from the course element with the ID=[integer-2] of the course with the ID=[integer-1].

getMarkWithCourseId(" [integer-1]","[integer-2]")

Returns the mark from the course element with the ID=[integer-2] of the course with the ID=[integer-1].

hasEvaluationCompleted("KB-ID")

Returns TRUE for all users who have successfully completed the specified course element.

getNumberOfEnrollments("[string1]*")

Returns TRUE, when the configured number of learning group members is reached in the learning area (string1).

getOnyxTestOutcome("[string1]","[string2]")

Returns from the ONYX test course element with the specified ID (string1) and the specified output variable (string2) the value of this variable. The return value will be a number.

getOnyxTestOutcomeZK("[string1]","[string2]")

Returns from the ONYX test course element with the specified ID (string1) and the specified output variable (string2) the value of this variable. The return value will be a string.

getProgress("[integer]")

Returns the progress from the course element with the specified ID as a numerical value between 0 and 100 (percent).

isPasswordConfirmed("[string]")

Returns TRUE after entering the correct password (string1).

Can only be used with course elements that allow a password restriction even in simple mode.

comesFrom("[string]")

Returns TRUE if the user has a linked account to OLAT with the specified system ID.

Units

 

min

Minutes

h

Hours

w

Weeks

m

Months

Operators





 

=

Equal to

>

Greater than

<

Less than

>=

Greater than or equal to

<=

Less than or equal to

*

Multiplication

/

Division

+

Addition

-

Subtraction

Booleans

 

&

Logical AND

|

Logical OR

!

Logical NOT