22
33namespace wcf \page ;
44
5- use wcf \data \comment \StructuredCommentList ;
65use wcf \data \person \Person ;
7- use wcf \system \comment \CommentHandler ;
8- use wcf \system \comment \manager \PersonCommentManager ;
96use wcf \system \exception \IllegalLinkException ;
7+ use wcf \system \view \CommentsView ;
108use wcf \system \WCF ;
119
1210/**
1311 * Shows the details of a certain person.
1412 *
15- * @author Matthias Schmidt
13+ * @author Matthias Schmidt
1614 * @copyright 2001-2021 WoltLab GmbH
17- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
1816 */
1917class PersonPage extends AbstractPage
2018{
21- /**
22- * list of comments
23- * @var StructuredCommentList
24- */
25- public $ commentList ;
26-
27- /**
28- * person comment manager object
29- * @var PersonCommentManager
30- */
31- public $ commentManager ;
32-
33- /**
34- * id of the person comment object type
35- * @var int
36- */
37- public $ commentObjectTypeID = 0 ;
38-
39- /**
40- * shown person
41- * @var Person
42- */
43- public $ person ;
44-
45- /**
46- * id of the shown person
47- * @var int
48- */
49- public $ personID = 0 ;
19+ public Person $ person ;
20+ public int $ personID = 0 ;
21+ public ?CommentsView $ commentsView = null ;
5022
5123 /**
5224 * @inheritDoc
@@ -56,11 +28,7 @@ public function assignVariables()
5628 parent ::assignVariables ();
5729
5830 WCF ::getTPL ()->assign ([
59- 'commentCanAdd ' => WCF ::getSession ()->getPermission ('user.person.canAddComment ' ),
60- 'commentList ' => $ this ->commentList ,
61- 'commentObjectTypeID ' => $ this ->commentObjectTypeID ,
62- 'lastCommentTime ' => $ this ->commentList ? $ this ->commentList ->getMinCommentTime () : 0 ,
63- 'likeData ' => MODULE_LIKE && $ this ->commentList ? $ this ->commentList ->getLikeData () : [],
31+ 'commentsView ' => $ this ->commentsView ,
6432 'person ' => $ this ->person ,
6533 ]);
6634 }
@@ -73,16 +41,11 @@ public function readData()
7341 parent ::readData ();
7442
7543 if ($ this ->person ->enableComments ) {
76- $ this ->commentObjectTypeID = CommentHandler::getInstance ()->getObjectTypeID (
77- 'com.woltlab.wcf.person.personComment '
78- );
79- $ this ->commentManager = CommentHandler::getInstance ()->getObjectType (
80- $ this ->commentObjectTypeID
81- )->getProcessor ();
82- $ this ->commentList = CommentHandler::getInstance ()->getCommentList (
83- $ this ->commentManager ,
84- $ this ->commentObjectTypeID ,
85- $ this ->person ->personID
44+ $ this ->commentsView = new CommentsView (
45+ 'com.woltlab.wcf.person.personComment ' ,
46+ $ this ->person ->personID ,
47+ 'personCommentList ' ,
48+ WCF ::getSession ()->getPermission ('user.person.canAddComment ' )
8649 );
8750 }
8851 }
0 commit comments