6cbad9d9efb8508049f3696f5c3bbba6d438850b
[GitHub/WoltLab/woltlab.github.io.git] /
1 <?php
2
3 namespace wcf\system\comment\manager;
4
5 use wcf\data\person\Person;
6 use wcf\data\person\PersonEditor;
7 use wcf\system\cache\runtime\PersonRuntimeCache;
8 use wcf\system\WCF;
9
10 /**
11 * Comment manager implementation for people.
12 *
13 * @author Matthias Schmidt
14 * @copyright 2001-2021 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @package WoltLabSuite\Core\System\Comment\Manager
17 */
18 class PersonCommentManager extends AbstractCommentManager
19 {
20 /**
21 * @inheritDoc
22 */
23 protected $permissionAdd = 'user.person.canAddComment';
24
25 /**
26 * @inheritDoc
27 */
28 protected $permissionAddWithoutModeration = 'user.person.canAddCommentWithoutModeration';
29
30 /**
31 * @inheritDoc
32 */
33 protected $permissionCanModerate = 'mod.person.canModerateComment';
34
35 /**
36 * @inheritDoc
37 */
38 protected $permissionDelete = 'user.person.canDeleteComment';
39
40 /**
41 * @inheritDoc
42 */
43 protected $permissionEdit = 'user.person.canEditComment';
44
45 /**
46 * @inheritDoc
47 */
48 protected $permissionModDelete = 'mod.person.canDeleteComment';
49
50 /**
51 * @inheritDoc
52 */
53 protected $permissionModEdit = 'mod.person.canEditComment';
54
55 /**
56 * @inheritDoc
57 */
58 public function getLink($objectTypeID, $objectID)
59 {
60 return PersonRuntimeCache::getInstance()->getObject($objectID)->getLink();
61 }
62
63 /**
64 * @inheritDoc
65 */
66 public function isAccessible($objectID, $validateWritePermission = false)
67 {
68 return PersonRuntimeCache::getInstance()->getObject($objectID) !== null;
69 }
70
71 /**
72 * @inheritDoc
73 */
74 public function getTitle($objectTypeID, $objectID, $isResponse = false)
75 {
76 if ($isResponse) {
77 return WCF::getLanguage()->get('wcf.person.commentResponse');
78 }
79
80 return WCF::getLanguage()->getDynamicVariable('wcf.person.comment');
81 }
82
83 /**
84 * @inheritDoc
85 */
86 public function updateCounter($objectID, $value)
87 {
88 (new PersonEditor(new Person($objectID)))->updateCounters(['comments' => $value]);
89 }
90 }