To activate pedagogical elements, go to the CMS configuration in the Training offer tab and tick Activate mutualization.
When a teaching element is created, the sharing fields are automatically initialized.
You can configure this initialization by adding the file shareable-configuration.xml to your application's WEB-INF/param .
<shareable-fields auto-validated="true"> <shareable>true</shareable> <shareable-programs>OWN</shareable-programs> <shareable-degrees>OWN</shareable-degrees> <shareable-periods>OWN</shareable-periods> <shareable-orgunits>OWN</shareable-orgunits> </shareable-fields>
<shareable> |
true to say that pedagogical elements are open to sharing when they are created. |
<shareable-programs> |
OWN so that, when teaching elements are created, this field is initialized with the identifiers of the parent programs of the teaching element. By default, no value is entered. The field will therefore not be initialized. |
<shareable-degrees> |
OWN so that when pedagogical elements are created, this field is initialized with the diploma type identifiers of the parent programs of the pedagogical element. By default, no value is entered. The field will therefore not be initialized. |
<shareable-periods> |
OWN so that when pedagogical elements are created, this field is initialized with the semester identifiers of the parent containers of the pedagogical element. By default, no value is entered. The field will therefore not be initialized. |
<shareable-orgunits> |
OWN so that when teaching elements are created, this field is initialized with the identifiers of the parent program components. By default, no value is entered. The field will therefore not be initialized. |
auto-validated |
true to say that teaching elements are validated for pooling when they are created. |
All existing teaching elements can be initialized using script JCR . This script will be based on the above configuration file.
This script can take several hours if there is a lot of data.
var shareableCourseHelper = serviceManager.lookup("org.ametys.odf.course.ShareableCourseHelper"); var count = { existing: 0, done: 0 }; jcrXPathQuery("//element(*, ametys:courseContent)[@ametys-internal:contentType='org.ametys.plugins.odf.Content.course']").forEach(function (content) { count.existing++; migrateContent(content, [_initializeShareableFields], false, null, false); count.done++; }) print(count.done + " ELP(s) migrated on " + count.existing + " existing ELP(s)"); function _initializeShareableFields(content) { var courseListParents = content.getParentCourseLists(); shareableCourseHelper.initializeShareableFields(content, courseListParents, org.ametys.core.user.population.UserPopulationDAO.SYSTEM_USER_IDENTITY, true); }
After this script, we must :