correct description shorting for Seminaries and add values for XP progress bar
This commit is contained in:
parent
c83373c62a
commit
6d17b7eaf1
2 changed files with 12 additions and 10 deletions
|
|
@ -64,15 +64,15 @@
|
|||
// Get additional data
|
||||
foreach($seminaries as &$seminary)
|
||||
{
|
||||
$seminary['description'] = \hhu\z\Utils::shortenString($seminary['description'], 100, 120).' …';
|
||||
|
||||
// Created user
|
||||
$description = \hhu\z\Utils::shortenString($seminary['description'], 100, 120);
|
||||
$seminary['description'] = $description.(strlen($description) < strlen($seminary['description']) ? ' …' : null);
|
||||
$seminary['creator'] = $this->Users->getUserById($seminary['created_user_id']);
|
||||
|
||||
// Character of currently logged-in user
|
||||
try {
|
||||
$seminary['usercharacter'] = $this->Characters->getCharacterForUserAndSeminary($this->Auth->getUserId(), $seminary['id']);
|
||||
$seminary['usercharacter']['characterroles'] = $this->Characterroles->getCharacterrolesForCharacterById($seminary['usercharacter']['id']);
|
||||
$seminary['xps'] = $this->Seminaries->getTotalXPs($seminary['id']);
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,18 +15,20 @@
|
|||
<?php endif ?>
|
||||
<section>
|
||||
<p class="fwb">
|
||||
<?php if(array_key_exists('usercharacter', $seminary) && count($seminary['usercharacter']['characterroles']) > 0) : ?>
|
||||
<a href="<?=$linker->link(array('seminary', $seminary['url']), 1)?>"><?=$seminary['title']?></a>
|
||||
<?php else : ?>
|
||||
<?=$seminary['title']?>
|
||||
<?php endif ?>
|
||||
<?php if(array_key_exists('usercharacter', $seminary) && count($seminary['usercharacter']['characterroles']) > 0) : ?>
|
||||
<a href="<?=$linker->link(array('seminary', $seminary['url']), 1)?>"><?=$seminary['title']?></a>
|
||||
<?php else : ?>
|
||||
<?=$seminary['title']?>
|
||||
<?php endif ?>
|
||||
</p>
|
||||
<?php if(array_key_exists('usercharacter', $seminary)) : ?>
|
||||
<div class="cf">
|
||||
<div class="xpbar">
|
||||
<span style="width:25%"></span>
|
||||
<span style="width:<?=round($seminary['usercharacter']['xps'] * 100 / $seminary['xps'])?>%"></span>
|
||||
</div>
|
||||
<p class="xpnumeric">25 / 100 XP</p>
|
||||
<p class="xpnumeric"><?=$seminary['usercharacter']['xps']?> / <?=sprintf(_('%d XPs'), $seminary['xps'])?></p>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<p><small><?=sprintf(_('created by %s on %s'), $seminary['creator']['username'], $dateFormatter->format(new \DateTime($seminary['created'])))?></small></p>
|
||||
<p><?=\hhu\z\Utils::t($seminary['description'])?></p>
|
||||
<?php if(!array_key_exists('usercharacter', $seminary)) : ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue