From f58f149da8327bdf871237ff3215165ac94e488a Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sat, 6 Jun 2020 13:01:34 +0200 Subject: [PATCH] Improved html code of the trophy lists Closes #3276 --- .../templates/categoryTrophyList.tpl | 39 +++++++++---------- com.woltlab.wcf/templates/trophy.tpl | 26 +++++++------ com.woltlab.wcf/templates/trophyList.tpl | 39 +++++++++---------- .../lib/page/CategoryTrophyListPage.class.php | 1 + .../files/lib/page/TrophyListPage.class.php | 1 + 5 files changed, 54 insertions(+), 52 deletions(-) diff --git a/com.woltlab.wcf/templates/categoryTrophyList.tpl b/com.woltlab.wcf/templates/categoryTrophyList.tpl index eac8c8707c..3a39651634 100644 --- a/com.woltlab.wcf/templates/categoryTrophyList.tpl +++ b/com.woltlab.wcf/templates/categoryTrophyList.tpl @@ -30,26 +30,25 @@ {/hascontent} -
- 1} class="tabMenuContent"{/if}> - {if $objects|count} -
    - {foreach from=$objects item=trophy} -
  1. -
    {@$trophy->renderTrophy(64)}
    - -
    -

    {@$trophy->getTitle()}

    - {if !$trophy->getDescription()|empty}{@$trophy->getDescription()}{/if} -
    -
  2. - {/foreach} -
- {else} -

{lang}wcf.global.noItems{/lang}

- {/if} +{if $objects|count} +
+
    + {foreach from=$objects item=trophy} +
  1. +
    {@$trophy->renderTrophy(64)}
    + +
    +

    {@$trophy->getTitle()}

    + {if !$trophy->getDescription()|empty}

    {@$trophy->getDescription()}

    {/if} +

    {lang items=$trophy->awarded}wcf.user.trophy.trophyAwarded{/lang}

    +
    +
  2. + {/foreach} +
-
+{else} +

{lang}wcf.global.noItems{/lang}

+{/if} -{include file='footer'} \ No newline at end of file +{include file='footer'} diff --git a/com.woltlab.wcf/templates/trophy.tpl b/com.woltlab.wcf/templates/trophy.tpl index 20be7d57fc..460b73e330 100644 --- a/com.woltlab.wcf/templates/trophy.tpl +++ b/com.woltlab.wcf/templates/trophy.tpl @@ -39,18 +39,20 @@ {/hascontent} {if $objects|count} -
    - {foreach from=$objects item=userTrophy} -
  1. -
    {@$userTrophy->getUserProfile()->getAvatar()->getImageTag(64)}
    - -
    -

    {user object=$userTrophy->getUserProfile()}

    - {if !$userTrophy->getDescription()|empty}{@$userTrophy->getDescription()} {/if}{@$userTrophy->time|time} -
    -
  2. - {/foreach} -
+
+
    + {foreach from=$objects item=userTrophy} +
  1. +
    {@$userTrophy->getUserProfile()->getAvatar()->getImageTag(64)}
    + +
    +

    {user object=$userTrophy->getUserProfile()}

    + {if !$userTrophy->getDescription()|empty}{@$userTrophy->getDescription()} {/if}{@$userTrophy->time|time} +
    +
  2. + {/foreach} +
+
{else}

{lang}wcf.global.noItems{/lang}

{/if} diff --git a/com.woltlab.wcf/templates/trophyList.tpl b/com.woltlab.wcf/templates/trophyList.tpl index 811a2b8009..f88727cb2c 100644 --- a/com.woltlab.wcf/templates/trophyList.tpl +++ b/com.woltlab.wcf/templates/trophyList.tpl @@ -25,26 +25,25 @@ {/hascontent} -
- 1} class="tabMenuContent"{/if}> - {if $objects|count} -
    - {foreach from=$objects item=trophy} -
  1. -
    {@$trophy->renderTrophy(64)}
    - -
    -

    {@$trophy->getTitle()}

    - {if !$trophy->getDescription()|empty}{@$trophy->getDescription()}{/if} -
    -
  2. - {/foreach} -
- {else} -

{lang}wcf.global.noItems{/lang}

- {/if} +{if $objects|count} +
+
    + {foreach from=$objects item=trophy} +
  1. +
    {@$trophy->renderTrophy(64)}
    + +
    +

    {@$trophy->getTitle()}

    + {if !$trophy->getDescription()|empty}

    {@$trophy->getDescription()}

    {/if} +

    {lang items=$trophy->awarded}wcf.user.trophy.trophyAwarded{/lang}

    +
    +
  2. + {/foreach} +
-
+{else} +

{lang}wcf.global.noItems{/lang}

+{/if} -{include file='footer'} \ No newline at end of file +{include file='footer'} diff --git a/wcfsetup/install/files/lib/page/CategoryTrophyListPage.class.php b/wcfsetup/install/files/lib/page/CategoryTrophyListPage.class.php index b2b129668e..1cf566137a 100644 --- a/wcfsetup/install/files/lib/page/CategoryTrophyListPage.class.php +++ b/wcfsetup/install/files/lib/page/CategoryTrophyListPage.class.php @@ -61,6 +61,7 @@ class CategoryTrophyListPage extends TrophyListPage { protected function initObjectList() { MultipleLinkPage::initObjectList(); + $this->objectList->sqlSelects = '(SELECT COUNT(*) FROM wcf'.WCF_N.'_user_trophy WHERE trophyID = trophy.trophyID) AS awarded'; $this->objectList->getConditionBuilder()->add('isDisabled = ?', [0]); $this->objectList->getConditionBuilder()->add('categoryID = ?', [$this->categoryID]); } diff --git a/wcfsetup/install/files/lib/page/TrophyListPage.class.php b/wcfsetup/install/files/lib/page/TrophyListPage.class.php index fc16fa6dee..9049b99ff0 100644 --- a/wcfsetup/install/files/lib/page/TrophyListPage.class.php +++ b/wcfsetup/install/files/lib/page/TrophyListPage.class.php @@ -83,6 +83,7 @@ class TrophyListPage extends MultipleLinkPage { protected function initObjectList() { parent::initObjectList(); + $this->objectList->sqlSelects = '(SELECT COUNT(*) FROM wcf'.WCF_N.'_user_trophy WHERE trophyID = trophy.trophyID) AS awarded'; $this->objectList->getConditionBuilder()->add('isDisabled = ?', [0]); $this->objectList->getConditionBuilder()->add('categoryID IN (?)', [array_map(function ($category) { return $category->categoryID; -- 2.20.1