CMS Ametys provides integrators with numerous methods accessible from XSLT, facilitating the integration of graphic charters.
Add this "odf" namespace to the header of XSL files as follows:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:odf="org.ametys.plugins.odfweb.xslt.OdfXSLTHelper" ... extension-element-prefixes="... ametys ...">
So that you can call any of the functions defined below, using "ametys:functionName(argument1, argument2)".
Description :
Retourne autant de nœuds <program> qu'il y a de formations intégrant ce sous-programme, incluant la structure des sous-programmes jusque la profondeur indiquée.
Si vous connaissez l'identifiant de la formation souhaitée, utilisez plutôt la méthode getProgramStructure.
Signature :
NodeList getParentProgramStructure (String subprogramId, int depth)
Arguments:
Name |
Type |
Description |
---|---|---|
subprogramId |
String |
Sub-program identifier |
depth |
int |
Depth Enter a positive number to retrieve the structure of subroutines up to a depth of depth. Enter a negative number to retrieve the complete structure recursively. This parameter only concerns sub-programs. |
Example: see getProgramStructure
Description :
Retourne autant de noeuds <program> qu'il y a de formations intégrant ce sous-programme.
Si vous connaissez l'identifiant de la formation parente, utilisez plutôt la méthode getProgram.
Signature :
NodeList getParentProgram (String subprogramId)
Arguments:
Name |
Type |
Description |
---|---|---|
subprogramId |
String |
Sub-program identifier |
Example: see getProgram
Description :
Retourne un nœud <program> contenant la structure de la formation jusqu'à une profondeur de depth
Signature :
NodeList getProgramStructure (String programId, int depth)
Arguments:
Name |
Type |
Description |
---|---|---|
programId |
String |
Training identifier |
depth |
int |
Depth Enter a positive number to recover the structure to a depth of depth. Enter a negative number to retrieve the complete structure recursively. This parameter only concerns sub-programs. |
Example:
<program ects="content://766a60bb-0048-4c0f-9018-9a5cf3cb5a6a" code="H7AHQYZO" catalog="2013-2017" degree="content://47383714-55b6-441b-b43c-4ef27db82e1c" id="programContent://25be5972-5e5a-4068-bd30-dd97b400c8ff" title="Licence Mathématiques"> <subprogram ects="content://8cbc13c3-b44d-42a4-842f-71456b3d9a1e" code="H7AHWVC8" catalog="2013-2017" id="subProgramContent://627f8540-be41-4797-bd18-82f9c09be35e" title="L3 parcours Mathématiques générales"> <container code="K42UDTSB" catalog="2013-2017" id="container://c10dd651-afbb-4913-b813-78430749c960" title="L3 parcours Mathématiques générales"> <container code="K42UR3PX" catalog="2013-2017" id="container://19d5cb9b-7f70-45b5-bb95-ff188cdd85db" title="Semestre 5"> <courselist code="LMP1A3M" catalog="2013-2017" id="courseListContent://a18375e2-c581-430b-88f6-4817f77b71e5" title="Math. Options 3e année" type="MANDATORY"> <course code="H7AI4Z0J" catalog="2013-2017" name="course-fruai3182988bcoh7ai4z0j" id="courseContent://03a77422-20d2-4a7b-a315-74de76c327fa" title="Arithmétique"></course> <!-- // ... --> </courselist> </container> <container code="K42UOQ9N" catalog="2013-2017" id="container://466926e2-6107-43a5-af73-0539263f0178" title="Semestre 6"> <!-- // ... --> </container> </container> </subprogram> <subprogram code="H7AHX5R3" catalog="2013-2017" id="subProgramContent://b503cb25-5a69-4596-b7bb-5d9cdff18af4" title="Parcours Mathématiques pour l’assurance et la finance"> <!-- // ... --> </subprogram> </program>
Description :
Retourne un nœud <program> contenant les informations de la formation
Signature :
Node getProgram (String programId)
Arguments:
Name |
Type |
Description |
---|---|---|
programId |
String |
Program identifier |
Example of returned information:
<program ects="content://766a60bb-0048-4c0f-9018-9a5cf3cb5a6a" code="H7AHQYZO" catalog="2013-2017" degree="content://47383714-55b6-441b-b43c-4ef27db82e1c" id="programContent://25be5972-5e5a-4068-bd30-dd97b400c8ff" title="Licence Mathématiques"> </program>
Description :
Returns a node <subprogram> containing the sub-program structure, including the sub-program structure.
If the depth attribute is specified, the structure is returned up to a depth of depth.
Without depth attribute, the structure is complete.
Signature :
Node getSubProgramStructure(String subprogramId)
Node getSubProgramStructure(String subprogramId, int depth)
Arguments:
Name |
Type |
Description |
---|---|---|
subprogramId |
String |
Sub-program identifier |
depth |
int |
Depth Enter a positive number to recover the structure to a depth of depth. Enter a negative number to retrieve the complete structure recursively. This parameter only concerns sub-programs. |
Example:
<subprogram ects="content://8cbc13c3-b44d-42a4-842f-71456b3d9a1e" code="H7AHWVC8" catalog="2013-2017" id="subProgramContent://627f8540-be41-4797-bd18-82f9c09be35e" title="L3 parcours Mathématiques générales"> <container code="K42UDTSB" catalog="2013-2017" id="container://c10dd651-afbb-4913-b813-78430749c960" title="L3 parcours Mathématiques générales"> <container code="K42UR3PX" catalog="2013-2017" id="container://19d5cb9b-7f70-45b5-bb95-ff188cdd85db" title="Semestre 5"> <courselist code="LMP1A3M" catalog="2013-2017" id="courseListContent://a18375e2-c581-430b-88f6-4817f77b71e5" title="Math. Options 3e année" type="MANDATORY"> <course code="H7AI4Z0J" catalog="2013-2017" name="course-fruai3182988bcoh7ai4z0j" id="courseContent://03a77422-20d2-4a7b-a315-74de76c327fa" title="Arithmétique"></course> <!-- // ... --> </courselist> </container> <container code="K42UOQ9N" catalog="2013-2017" id="container://466926e2-6107-43a5-af73-0539263f0178" title="Semestre 6"> <!-- // ... --> </container> </container> </subprogram>
Description:
Returns the ID of the parent program from the current page.
The method returns null if the program is not found.
Signature :
String parentProgramId()
Description:
Returns the root page identifier ODF for a specific site, language, and possibly catalog.
If there are several root pages, the first in the list is returned.
If the root page ofODF is not found, the method returns null.
Signature :
String odfRootPage (String siteName, String language)
String odfRootPage (String siteName, String language, String catalog)
Arguments:
Name |
Type |
Description |
---|---|---|
siteName |
String |
Site name |
language |
String |
Language |
catalog |
String |
Catalog name |
Description:
Returns theURL of a program or sub-program's PDF .
If the content identifier does not correspond to a program or sub-program, the method returns an empty string.
Signature :
String odfPDFUrl (String contentId, String siteName)
Arguments:
Name |
Type |
Description |
---|---|---|
contentId |
String |
Program or sub-program identifier |
siteName |
String |
Site name |
Example of use:
<a href="{odf:odfPDFUrl($programId, $site)}" target="blank" >Télécharger le PDF</a>
Description:
Returns the certification label for the program or sub-program.
If the course is not certified, the method returns null.
Signature :
String getCertificationLabel(String abstractProgramId)
Arguments:
Name |
Type |
Description |
---|---|---|
abstractProgramId |
String |
Program or sub-program identifier |
Example of use:
<xsl:variable name="label" select="odf:getCertificationLabel(@id)"/> <xsl:if test="$label != ''"> <xsl:variable name="labelImgPath" select="concat('img/labels/', $label, '.svg')"/> <img class="ametys-main-banner-label__img" src="{ametys:skinURL($labelImgPath)}" alt="" /> </xsl:if>
From Ametys 4.4
Description:
Returns cumulative hours for the content identified in the parameter.
To do this, the algorithm descends the tree structure of the content supplied as a parameter down to the content with the nbHours field filled in.
Teaching hours are read only ifELP is at the last level.
For theELP lists, the calculation is carried out as follows, depending on the type of list:
Signature :
Double getCumulatedHours(String contentId)
Arguments:
Name |
Type |
Description |
---|---|---|
contentId |
String |
Identifier of the content on which the calculation is performed |
This method is available from version 4.4 onwards.
In 4.4 and 4.5 this method can only be called for a path (sub-program)
From version 4.6 this method can be called on a course, path, container or sub-program. ELP
Description:
Returns the course book (renamed course catalog in 4.6) in the latest PDF format for:
If the element does not exist, or if no catalog exists, the method returns null.
Signature :
AmetysNodeList getEducationalBooklet (String programItemId)
Arguments:
Name |
Type |
Description |
---|---|---|
programItemId |
String |
Sub-program identifier |
Example:
<pdf filename="Livret pédagogique L3 parcours Mathématiques générales - 2020-11-27.pdf" lastmodified="2020-11-27T17:06:26.000Z" mime-type="application/pdf" multiple="false" path="educational-booklets[1]/pdf" size="135670" type="attribute" typeid="file" uri="educational-booklets[1]/pdf"> </pdf>
Example of use:
<xsl:variable name="educationalBooklet" select="odf:getEducationalBooklet(/view/content/@id)"/> <a href="{resolver:resolve($educationalBooklet/@type, $educationalBooklet/@path, 'true')}"> <xsl:value-of select="$educationalBooklet/@filename"/> </a>
From Ametys 4.6
Description:
Returns true if the training element in the context of its page is excluded from the skills display.
Signature :
boolean areSkillsUnavailable(String programItemId, String programPageItemId)
Arguments:
Name |
Type |
Description |
---|---|---|
programItemId |
String |
Training element identifier |
programPageItemId |
String |
Identifier of the page on which the training element is located. If not entered, skills will still be visible. |
From Ametys 4.6
Description :
Returns all paths from a training element to its parent training element(s).
Paths are built from the element title and the transmitted separator.
Ex: Master Droit public > Security and defense > Year 1
Signature :
boolean getProgramPaths(String programItemId, String separator)
Arguments:
Name |
Type |
Description |
---|---|---|
programItemId |
String |
Training element identifier |
separator |
String |
Separator to use (e.g. ">") |
Description:
Returns the code associated with a reference table entry.
If the entry is not found, the method returns null.
Signature :
String getCode (String tableRefEntryId)
Arguments:
Name |
Type |
Description |
---|---|---|
tableRefEntryId |
String |
Reference table entry identifier |
Example of use:
<xsl:variable name="degreeId" select="metadata/degree/@id"/> <xsl:variable name="degreeCode" select="odf:getCode($degreeId)"/>
Description:
Returns the identifier of a reference table entry from its code.
The method returns null if the entry is not found.
Signature :
String getEntryId (String tableRefId, String code)
Arguments:
Name |
Type |
Description |
---|---|---|
tableRefId |
String |
Reference table identifier |
code |
String |
Reference table entry code |
Example:
<xsl:variable name="degreeId" select="odf:getEntryId('odf-enumeration.Degree', 'XA')"/>
Description :
Returns the entries of a reference table.
Signature :
Node getTableRefItems (String tableRefId, String lang)
Node getTableRefItems (String tableRefId, String lang, boolean ordered)
Arguments:
Name |
Type |
Description |
---|---|---|
tableRefId |
String |
Reference table identifier |
lang |
String |
Language for labels |
ordered |
Boolean |
If this boolean is set to true, then the entries will be sorted according to the "order" attribute. |
Example:
<items id="odf-enumeration.Domain"> <item code="STS" id="content://305e6e9e-1ec2-4adb-8ffc-2274ab807907" title="Sciences, Technologies, Santé"></item> <item code="ALL" id="content://47bb25ce-234c-4ed4-9e29-ce2c0227ddbe" title="Arts, Lettres, Langues"></item> <item code="SHS" id="content://64e192e6-31cd-4a12-88b4-d8d38267bce5" title="Sciences humaines et sociales"></item> <item code="DEG" id="content://fb0f2f0e-fc29-4ceb-8d2b-70bf1ef3b729" title="Droit, Economie, Gestion"></item> <item code="HD" id="content://fe887b17-fc96-42ac-a698-0e9868e56e7c" title="Hors domaines de formation"></item> <item code="STA" id="content://34170b44-174a-44fc-937b-c6c56d8e8910" title="Sciences et Techniques des Activités Physiques et sportives"></item> </items>
Description:
Returns the diploma label associated with the diploma's CDM value.
If the key is not found, the method returns an empty string
Signature :
String degreeLabel (String cmdValue)
String degreeLabel (String cmdValue, String language)
Arguments:
Name |
Type |
Description |
---|---|---|
cmdValue |
String |
Diploma key |
language |
String |
Language |
Example of use:
<xsl:variable name="degreeLabel" select="odf:degreeLabel('licence', $lang)"/>
Description:
Returns the root component identifier.
Signature :
String getRootOrgUnitId()
From Ametys ODF 4.3.11
Description :
Returns the component identifier corresponding to the UAI code or null if no component has been found.
Signature :
String getOrgUnitIdByUAICode(String uaiCode)
Arguments:
Name |
Type |
Description |
---|---|---|
uaiCode |
String |
Component UAI code |