Commit bdcc05cb authored by Fabrice Gangler's avatar Fabrice Gangler 🎨
Browse files

FEAT(mapping): display mapping on software page

Refs: #918
parent ec0fa69e
Pipeline #9992 passed with stage
in 3 minutes and 46 seconds
......@@ -114,3 +114,11 @@ msgstr ""
#: Template/Api/V1/TaxonomysSoftwares/mapping_taxon_users_of.ctp:
msgid "TaxonomySoftware.UserOf.comments.subtitle"
msgstr ""
#: Template/Api/V1/Softwares/view.cpt:98
msgid "Taxonomy.softwarePage.description"
msgstr ""
#: Template/Api/V1/Softwares/view.cpt:74
msgid "Taxonomy.softwarePage.taxonSoftwareLink.title"
msgstr ""
......@@ -120,3 +120,12 @@ msgstr "Testimonials"
msgid "TaxonomySoftware.UserOf.comments.subtitle"
msgstr "Testimonials on the use of <strong>{0}</strong> free software"
"<br> in the field of <strong>{1}</strong>"
#: Template/Api/V1/Softwares/view.cpt:98
msgid "Taxonomy.softwarePage.description"
msgstr "<strong>Use case{0}</strong> of libre software <strong>{1}</strong>"
"<br> declared by local governments in <strong>business mapping</strong>:"
#: Template/Api/V1/Softwares/view.cpt:74
msgid "Taxonomy.softwarePage.taxonSoftwareLink.title"
msgstr "{0} software - Use Cases \n{1} · {2}"
......@@ -121,3 +121,13 @@ msgstr "Témoignages"
msgid "TaxonomySoftware.UserOf.comments.subtitle"
msgstr "Témoignages sur l'utilisation du logiciel libre <strong>{0}</strong>"
"<br> dans le domaine <strong>{1}</strong>"
#: Template/Api/V1/Softwares/view.cpt:98
msgid "Taxonomy.softwarePage.description"
msgstr "<strong>Cas d'usage{0}</strong> déclaré{0} du logiciel libre <strong>{1}</strong> "
"<br> par les collectivités et les administrations "
" dans la <strong>cartographie</strong> des <strong>métiers</strong> : "
#: Template/Api/V1/Softwares/view.cpt:74
msgid "Taxonomy.softwarePage.taxonSoftwareLink.title"
msgstr "Logiciel {0} - Cas d'usage \n{1} · {2}"
......@@ -49,6 +49,13 @@ $this->assign('title', __d("Softwares", "{0}", $software->softwarename));
"emptyMsg" => __d("Softwares", "No user for {0}", $software->softwarename)
]
); ?>
<?php
// Mapping display for current software
if (count($taxonomiesSoftware) > 0) {
echo $this->element("Softwares/mappingOnSoftwarePage");
}
?>
</section>
<section class="clearfix">
......
<?php
///////////////////////////////////////////////////////////////
// Mapping display for current software
//
// Used by Softwares/view.ctp
///////////////////////////////////////////////////////////////
// Mapping for current software
$list = [];
$softwareName = $software->softwarename;
$softwareSlug = $software->slugName;
$softwareId = $software->id;
foreach ($mappingFirstLevels as $firsLevelId => $firsLevelName) {
if(isset($mappingTaxons[$firsLevelId]['children'])) {
foreach ($mappingTaxons[$firsLevelId]['children'] as $taxonId => $taxonName) {
if (isset($mappingTaxons[$taxonId]) && $taxonomiesSoftware[$taxonId]) {
$name = $mappingTaxons[$taxonId]['title'];
$slug = $mappingTaxons[$taxonId]['slug'];
$parentId = $mappingTaxons[$taxonId]['id_parent'];
$parentName = $mappingTaxons[$parentId]['title'];
$parentSlug = $mappingTaxons[$parentId]['slug'];
$url = "$mappingBaseUrl/$parentSlug/$slug/$softwareSlug/$taxonId.$softwareId";
$linkOptions = [
'title' => __d(
"Taxonomy",
"Taxonomy.softwarePage.taxonSoftwareLink.title",
[$software->softwarename, $parentName, $name]
),
'id' => "linkMapping-taxon-$taxonId-Software-$softwareId",
'class' => "linkMapping-taxonSoftware",
'escape' => false
];
$list[] = $this->Html->link("$parentName · <strong>$name</strong>", $url, $linkOptions);
}
}
}
}
$nbOfUseCases = count($list);
if ($nbOfUseCases > 0) {
$s = ''; if($nbOfUseCases > 1) { $s = 's'; }
$mappingTxt = __d(
"Taxonomy",
"Taxonomy.softwarePage.description",
[$s, $software->softwarename,]
);
$htmlList = $this->Html->nestedList($list);
echo "<div id=\"mappingForSoftware-$softwareId\">
<p>$mappingTxt</p>
$htmlList
<div>";
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment