Uploaded image for project: 'Offre de formation'
  1. Offre de formation
  2. ODF-1326

Mentions : Proposer le téléchargement PDF sur la fiche parcours

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 2.6.0, 4.0.0
    • 2.6.0
    • None
    • None

      Depuis la mise en place des fiches mentions, les anciennes formations se retrouvent désormais définies dans les parcours (subprogram), il faudrait proposer le téléchargement PDF de la fiche parcours.

          [ODF-1326] Mentions : Proposer le téléchargement PDF sur la fiche parcours

          Laurence Perier made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]
          Laurence Aumeunier made changes -
          Fix Version/s New: 2.6.0 [ 13180 ]
          Fix Version/s New: 4.0 [ 12986 ]
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Laurence Aumeunier added a comment - - edited

          Pour ce faire, le helper XSLT pour l'ODF (org.ametys.plugins.odfweb.xslt.OdfXSLTHelper) a une nouvelle méthode qui permet de récupérer l'url du PDF d'une formation ou d'un sous-programme.

          <xsl:variable name="pdfHref" select="odf:odfPDFUrl($contentId, $site)">
          

          Le helper renvoie une valeur vide si le contenu n'est pas une formation ou un sous-programme.

          Pour ajouter un lien vers le PDF uniquement pour les formations et les sous-programme de type parcours, voici un exemple de code XSL :

          <xsl:variable name="pdfHref">
                 <xsl:choose>
                          <xsl:when test="/cms/page/pageContents/zone[@name = 'default']/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.program' and information/type = 'CONTENT']">
                                  <!-- Lien pour une formation -->
                                  <xsl:variable name="programId" select="/cms/page/pageContents/zone[@name = 'default']/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.program' and information/type = 'CONTENT'][1]/information/contentId"/>
                                  <xsl:value-of select="odf:odfPDFUrl($programId, $site)"/>
                          </xsl:when>
                          <xsl:when test="/cms/page/pageContents/zone[@name = 'default']/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.subProgram' and information/type = 'CONTENT']">
                          	<xsl:variable name="subprogram-id" select="/cms/page/pageContents/zone[@name = 'default']/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.subProgram' and information/type = 'CONTENT'][1]/information/contentId"/>
                          	<xsl:variable name="educationKind" select="ametys:contentMetadata($subprogram-id, 'educationKind')"/>
                          	<!-- Limitation au type parcours -->
                          	<xsl:if test="$educationKind = 'P'">
                          		<xsl:value-of select="odf:odfPDFUrl($subprogram-id, $site)"/>
                          	</xsl:if>
                          </xsl:when>
                  </xsl:choose>
          </xsl:variable>
          
          <xsl:if test="string-length($pdfHref) != 0">
               <div id="pdf-icon">
          	   <a href="{$pdfHref}" onclick="window.open(this.href); return false;" title="skin.{$skin}:SKIN_DOWNLOAD_PDF_TITLE" i18n:attr="title">
          		<img src="{ametys:skinURL('img/PDF.png')}" alt="skin.{$skin}:SKIN_DOWNLOAD_PDF_ALT" i18n:attr="alt"/>
                     </a>
              </div>
          

          Laurence Aumeunier added a comment - - edited Pour ce faire, le helper XSLT pour l'ODF ( org.ametys.plugins.odfweb.xslt.OdfXSLTHelper ) a une nouvelle méthode qui permet de récupérer l'url du PDF d'une formation ou d'un sous-programme. < xsl:variable name= "pdfHref" select= "odf:odfPDFUrl($contentId, $site)" > Le helper renvoie une valeur vide si le contenu n'est pas une formation ou un sous-programme. Pour ajouter un lien vers le PDF uniquement pour les formations et les sous-programme de type parcours , voici un exemple de code XSL : < xsl:variable name= "pdfHref" > < xsl:choose > < xsl:when test= "/cms/page/pageContents/zone[@name = 'default' ]/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.program' and information/type = 'CONTENT' ]" > <!-- Lien pour une formation --> < xsl:variable name= "programId" select= "/cms/page/pageContents/zone[@name = 'default' ]/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.program' and information/type = 'CONTENT' ][1]/information/contentId" /> < xsl:value-of select= "odf:odfPDFUrl($programId, $site)" /> </ xsl:when > < xsl:when test= "/cms/page/pageContents/zone[@name = 'default' ]/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.subProgram' and information/type = 'CONTENT' ]" > < xsl:variable name= "subprogram-id" select= "/cms/page/pageContents/zone[@name = 'default' ]/zoneItem[information/type-information/@id = 'org.ametys.plugins.odf.Content.subProgram' and information/type = 'CONTENT' ][1]/information/contentId" /> < xsl:variable name= "educationKind" select= "ametys:contentMetadata($subprogram-id, 'educationKind' )" /> <!-- Limitation au type parcours --> < xsl:if test= "$educationKind = 'P' " > < xsl:value-of select= "odf:odfPDFUrl($subprogram-id, $site)" /> </ xsl:if > </ xsl:when > </ xsl:choose > </ xsl:variable > < xsl:if test= "string-length($pdfHref) != 0" > <div id= "pdf-icon" > <a href= "{$pdfHref}" onclick= "window.open(this.href); return false;" title= "skin.{$skin}:SKIN_DOWNLOAD_PDF_TITLE" i18n:attr= "title" > <img src= "{ametys:skinURL( 'img/PDF.png' )}" alt= "skin.{$skin}:SKIN_DOWNLOAD_PDF_ALT" i18n:attr= "alt" /> </a> </div>
          Laurence Perier created issue -

            Unassigned Unassigned
            lperier Laurence Perier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: