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

FEAT(Software page): add buttons for mapping section

- same buttons of "used by" section
- display these buttons only for administration user type

Refs: #940
parent 854bcc31
Pipeline #10203 passed with stage
in 4 minutes and 17 seconds
......@@ -13,7 +13,8 @@ $this->assign('title', __d("Softwares", "{0}", $software->softwarename));
<section>
<?php echo $this->Lists->block(
<?php
$htmlUsedSoftwares = $this->Lists->block(
$software->userssoftwares,
[
"type" => "user",
......@@ -48,11 +49,30 @@ $this->assign('title', __d("Softwares", "{0}", $software->softwarename));
"titleFallBack" => __d("Softwares", "Softwares.Users.DeclareAs.user.removeMessage.", $software->softwarename),
"emptyMsg" => __d("Softwares", "No user for {0}", $software->softwarename)
]
); ?>
);
echo $htmlUsedSoftwares;
?>
</section>
<?php
// Extract buttons for mapping section and rename some HTML ids
// @@@TODO ---> must be refactorized
$mappingButtons = '';
if ( 'Administration' === $this->request->session()->read("Auth.User.user_type")) {
$startPattern = '<div class="container_btn-participate">';
$endPattern = '</div><!-- END class "container_btn-participate" -->';
$mappingButtons = strstr($htmlUsedSoftwares, $startPattern);
$mappingButtons = strstr($mappingButtons, $endPattern, true);
$mappingButtons = "$mappingButtons $endPattern <div class=\"clearFloat\"></div>";
$mappingButtons = str_replace('Form_', 'FormMapping_', $mappingButtons);
$mappingButtons = str_replace('btn_', 'btnMapping_', $mappingButtons);
}
?>
<section class="clearfix">
<h2> <?= __d("Taxonomy", "Taxonomy.softwarePage.sectionTitle", $software->softwarename); ?></h2>
<div class="align">
<h2> <?= __d("Taxonomy", "Taxonomy.softwarePage.sectionTitle", $software->softwarename); ?></h2>
<?php echo $mappingButtons; ?>
</div>
<?php
// Mapping display for current software
$mappingNoRecord = __d("Taxonomy", "Taxonomy.softwarePage.sectionNoRecord", $software->softwarename);
......
......@@ -80,7 +80,9 @@ class ListsHelper extends Helper
}
if (!empty($participateLink)) {
$participateLink = "<div class=\"container_btn-participate\">$participateLink </div>
$participateLink = "<div class=\"container_btn-participate\">
$participateLink
</div><!-- END class \"container_btn-participate\" -->
<div class=\"clearFloat\"></div>";
}
$header = $this->formatTemplate(
......
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