Table des matières
Klassplace: A flat design theme: Expression engine to drive the items in the panels
Introduction
This engine drives the display of the panels, sections or items of the theme's home page, logged in or not, on the basis of an expression to evaluate: Moodle custom profile fields, cohort membership, etc.
The examples show the expressions, and a test result depending on a given current user in the context. If the result is 1 the element is displayed. '*' for users stands for “all users”.
- <expression to evaluate> ⇒ <user> ⇒ <result>
Examples 1: profile field
A custom profile field “pet” is created for the users' pet. Harry has a pet named Hedwig Hermione has a pet named Crosshawk
user:current:profile_field_pet = “Hedwig”⇒ harry ⇒ 1
If the profile field “pet” contains “Hedwig”, the panel is displayed because the answer is true. So for harry the panel will be displayed, not for hermione.
user:current:profile_field_pet = “Hedwig”⇒ hermione ⇒ 0
If the profile field “pet” does not contain “Hedwig”, the panel is displayed because the answer is true.
user:idnumber:HP:profile_field_pet = “Hedwig”⇒ harry ⇒ 1- user:id:816
user:current:profile_field_house = “Griffindor”⇒ harry ⇒ 1
Examples 2: cohort membership
The cohorts G1 (Griffindor 1st year) and S1 (Slytherin - Serpentar - 1st year) having been created and populated.
user:idnumber:HG isincohort cohort:idnumber:G1⇒ hermione ⇒ 1user:current isincohort cohort:idnumber:“G1”⇒ harry ⇒ 1user:current isincohort cohort:idnumber:“S1”⇒ draco ⇒ 1user:current isincohort cohort:idnumber:“G1”⇒ draco ⇒ 0
Examples 3: course located in a category
course:idnumber:“HEM1” incategory category:idnumber:“Y1”⇒ * ⇒ 1
Examples 4: concatenated evaluations
user:current:profile_field_house = “Griffindor” AND user:current:profile_field_house = “Slytherin”⇒ * ⇒ 0user:current:profile_field_house = “Griffindor” AND user:current hasrolein course:idnumber:“HEM1”⇒ harry ⇒ 1
Complete reference of the rule syntax
Credits
- Valéry Frémaux (valery@activeprolearn.com) - Development and code optimisation
- Florence Labord (florence@activeprolearn.com): Documentation and functional qualification
Index du thème - Index guide d'utilisation - Back to plugins index - Back to catalogue index
