Skip to content

Commit

Permalink
Rework Home Site display
Browse files Browse the repository at this point in the history
- Having the line break in the href string cause the spaces to be
  interpreted as part of the URL.
- Add a comment explaining why xecho is used here
- Refactor HomeSite ShortName display using variable
- factor out $params['user']->getHomeSite()
- indentation of "?>" looks a little weird but i guess it makes
  sense because it's treating the `if` as a reason to increase
  the indent.
  • Loading branch information
gregcorbett committed Nov 30, 2023
1 parent 6e00018 commit 20ca45c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions htdocs/web_portal/views/user/view_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,23 @@
</div>
</td>
</tr>-->
<?php if ($params['user']->getHomeSite() != null) { ?>
<?php
$homeSite = $params['user']->getHomeSite();
if ($homeSite != null) {
?>
<tr class="site_table_row_2">
<td class="site_table">Home Site</td>
<td class="site_table">
<a href="index.php?Page_Type=Site&amp;id=
<?php echo $params['user']->getHomeSite()->getId()?>">
<?php xecho($params['user']->getHomeSite()->getShortName()) ?>
</a>
<?php
$homeId = $homeSite->getId();
$homeShortName = $homeSite->getShortName();
echo "<a href=\"index.php?Page_Type=Site&amp;id=";
echo "$homeId\">";
// Use xecho as the Site's ShortName is user
// submitted input.
xecho($homeShortName);
echo "</a>";
?>
</td>
</tr>
<?php } ?>
Expand Down

0 comments on commit 20ca45c

Please sign in to comment.