Commit 8c2d7465 authored by Fabrice Gangler's avatar Fabrice Gangler 🎨
Browse files

FEAT(mapping): display mapping on user page

Refs: #917
parent c6e7f6f4
Pipeline #10009 passed with stage
in 3 minutes and 58 seconds
......@@ -122,3 +122,19 @@ msgstr ""
#: Template/Api/V1/Softwares/view.cpt:74
msgid "Taxonomy.softwarePage.taxonSoftwareLink.title"
msgstr ""
#: Template/Api/V1/Users/view.cpt:34
msgid "Taxonomy.userPage.taxonSoftwareLink.title"
msgstr ""
#: Template/Api/V1/Users/view.cpt:54
msgid "Taxonomy.userPage.taxonLink.title"
msgstr ""
#: Template/Api/V1/Users/view.cpt:75
msgid "Taxonomy.userPage.title"
msgstr ""
#: Template/Api/V1/Users/view.cpt:76
msgid "Taxonomy.userPage.description"
msgstr ""
......@@ -129,3 +129,20 @@ msgstr "<strong>Use case{0}</strong> of libre software <strong>{1}</strong>"
#: Template/Api/V1/Softwares/view.cpt:74
msgid "Taxonomy.softwarePage.taxonSoftwareLink.title"
msgstr "{0} software - Use Cases \n{1} · {2}"
#: Template/Api/V1/Users/view.cpt:34
msgid "Taxonomy.userPage.taxonSoftwareLink.title"
msgstr "{0} software - Use Cases \n{1} · {2}"
#: Template/Api/V1/Users/view.cpt:54
msgid "Taxonomy.userPage.taxonLink.title"
msgstr "Use cases \n{0} · {1}"
#: Template/Api/V1/Users/view.cpt:75
msgid "Taxonomy.userPage.title"
msgstr "Use case{0}"
#: Template/Api/V1/Users/view.cpt:76
msgid "Taxonomy.userPage.description"
msgstr "<strong>Use case{0}</strong> declared by <strong>{1}</strong> "
" in business mapping."
......@@ -131,3 +131,20 @@ msgstr "<strong>Cas d'usage{0}</strong> déclaré{0} du logiciel libre <strong>{
#: Template/Api/V1/Softwares/view.cpt:74
msgid "Taxonomy.softwarePage.taxonSoftwareLink.title"
msgstr "Logiciel {0} - Cas d'usage \n{1} · {2}"
#: Template/Api/V1/Users/view.cpt:34
msgid "Taxonomy.userPage.taxonSoftwareLink.title"
msgstr "Cas d'usage du logiciel {0} \n{1} · {2}"
#: Template/Api/V1/Users/view.cpt:54
msgid "Taxonomy.userPage.taxonLink.title"
msgstr "Cas d'usage \n{0} · {1}"
#: Template/Api/V1/Users/view.cpt:75
msgid "Taxonomy.userPage.title"
msgstr "Cas d'usage{0}"
#: Template/Api/V1/Users/view.cpt:76
msgid "Taxonomy.userPage.description"
msgstr "<strong>Cas d'usage{0}</strong> déclaré{0} par <strong>{1}</strong> "
" dans la cartographie des métiers."
......@@ -133,6 +133,13 @@ $this->assign('title', __d("Users", "User {0}", $user->username));
: "";
echo $softwareBlock;
?>
<?php
// Mapping display for current user
if ($user->user_type->name === 'Administration' && count($taxonomiesSoftware) > 0 ) {
echo $this->element("Users/mappingOnUserPage");
}
?>
</section>
<section>
<?php
......
<?php
///////////////////////////////////////////////////////////////
// Mapping display for current user
//
// Used by Users/view.ctp
///////////////////////////////////////////////////////////////
$list = [];
$userName = $user->username;
$userId = $user->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'];
// Prepare software list for current taxon
$softwareList = [];
foreach ($taxonomiesSoftware[$taxonId] as $item) {
$softwareId = $item->software_id;
$usedSoftwareKey = $usedSoftwareKeys[$softwareId];
$software = $user->usedsoftwares[$usedSoftwareKey]->software;
$softwareSlug = $software->slugName;
$softwareName = $software->softwarename;
$linkSoftwareOptions = [
'title' => __d(
"Taxonomy",
"Taxonomy.userPage.taxonSoftwareLink.title",
[$software->softwarename, $parentName, $name]
),
'id' => "linkMappingTaxon-$taxonId-Software-$softwareId",
'class' => "linkMappingTaxonSoftware",
'escape' => true
];
// $htmlSoftwareImg = $this->Software->displayLogoLink($software);
$softwareUrl = "$mappingBaseUrl/$parentSlug/$slug/$softwareSlug/$taxonId.$softwareId";
$softwareList[] = $this->Html->link($softwareName, $softwareUrl, $linkSoftwareOptions);
}
$htmlSoftwareList = $this->Html->nestedList($softwareList);
// Display current taxon
$displayName = "$parentName · <strong>$name</strong>";
$linkOptions = [
'title' => __d("Taxonomy", "Taxonomy.userPage.taxonLink.title", [$parentName, $name]),
'id' => "linkMappingTaxon-$taxonId",
'class' => "linkMappingTaxon",
'escape' => false
];
$url = "$mappingBaseUrl/$parentSlug/$slug/$taxonId";
$list[] = $this->Html->link($displayName, $url, $linkOptions) . $htmlSoftwareList;
}
}
}
}
$nbOfUseCases = count($list);
if ($nbOfUseCases > 0) {
$s = ''; if($nbOfUseCases > 1) { $s = 's'; }
$mappingTxt = __d("Taxonomy", "Taxonomy.userPage.description", [$s, $userName,]);
$mappingTitle = __d("Taxonomy", "Taxonomy.userPage.title", [$s,]);
$htmlList = $this->Html->nestedList($list);
echo "<div id=\"mappingForUser-$userId\" class=\"userPage_mapping\">
<h2>$mappingTitle</h2>
<p>$mappingTxt</p>
$htmlList
<div>";
}
......@@ -1533,6 +1533,19 @@ section.taxonomyPages strong {
font-size: 1em;
}
/* =====================================================================================================================
* ---------------------------------------------- User page : mapping display ------------------------------------------
* =====================================================================================================================
*/
div.userPage_mapping ul ul {
padding-bottom: 0.7em;
}
div.userPage_mapping > ul > li > a,
div.userPage_mapping > ul > li > a > strong {
color: black;
}
/* =====================================================================================================================
* ---------------------------------------------- Mapping Form --------------------------------------------------------------
......
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