3 use wcf\data\trophy\category\TrophyCategory
;
4 use wcf\data\trophy\category\TrophyCategoryCache
;
5 use wcf\data\trophy\TrophyList
;
6 use wcf\system\exception\IllegalLinkException
;
7 use wcf\system\exception\PermissionDeniedException
;
8 use wcf\system\request\LinkHandler
;
12 * Represents a trophy page.
14 * @author Joshua Ruesweg
15 * @copyright 2001-2019 WoltLab GmbH
16 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
17 * @package WoltLabSuite\Core\Page
20 * @property TrophyList $objectList
22 class CategoryTrophyListPage
extends TrophyListPage
{
24 * the category id filter
27 public $categoryID = 0;
30 * The category object filter
38 public function readParameters() {
39 parent
::readParameters();
41 if (isset($_REQUEST['id'])) $this->categoryID
= intval($_REQUEST['id']);
43 $this->category
= TrophyCategoryCache
::getInstance()->getCategoryByID($this->categoryID
);
45 if (!$this->category
) {
46 throw new IllegalLinkException();
49 if (!$this->category
->isAccessible()) {
50 throw new PermissionDeniedException();
53 $this->canonicalURL
= LinkHandler
::getInstance()->getLink('CategoryTrophyList', [
54 'object' => $this->category
55 ], ($this->pageNo
> 1 ?
'pageNo=' . $this->pageNo
: ''));
61 protected function initObjectList() {
62 MultipleLinkPage
::initObjectList();
64 $this->objectList
->sqlSelects
= '(SELECT COUNT(*) FROM wcf'.WCF_N
.'_user_trophy WHERE trophyID = trophy.trophyID) AS awarded';
65 $this->objectList
->getConditionBuilder()->add('isDisabled = ?', [0]);
66 $this->objectList
->getConditionBuilder()->add('categoryID = ?', [$this->categoryID
]);
72 public function assignVariables() {
73 parent
::assignVariables();
75 WCF
::getTPL()->assign([
76 'category' => $this->category
,
77 'categoryID' => $this->categoryID