1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
user.php
См. документацию.
1<?php
2
3namespace Bitrix\Forum\Comments;
4
5use \Bitrix\Forum;
6use Bitrix\Main\Engine\CurrentUser;
7use CUser;
8
9class User
10{
11 protected ?int $id = 0;
12 private static $groups;
13 protected $forumUser = null;
14
15 public function __construct(int $id)
16 {
17 $user = CurrentUser::get();
18 if ($id === (int)$user->getId())
19 {
20 $this->id = $id;
21 if (empty(self::$groups[$id]))
22 {
23 self::$groups[$id] = $user->getUserGroups();
24 }
25 }
26 else if ($id > 0)
27 {
28 $this->id = $id;
29 if (empty(self::$groups[$id]))
30 {
32 }
33 }
34
35 if (empty(self::$groups[$id]))
36 {
37 self::$groups[$id] = [2];
38 }
39
40 $this->forumUser = Forum\User::getById($this->id);
41 }
42
43 public function getId()
44 {
45 return $this->id;
46 }
47
48 public function getGroups()
49 {
50 return implode(",", self::$groups[$this->id]);
51 }
52
53 public function getUserGroupArray()
54 {
55 return self::$groups[$this->id];
56 }
57
58 public function isAuthorized()
59 {
60 return true;
61 }
62
63 public function getParam(string $key)
64 {
65 if ($this->forumUser instanceof Forum\User)
66 {
67 return $this->forumUser[$key];
68 }
69 return null;
70 }
71 public function isAdmin()
72 {
73 return false;
74 }
75 public function getUserGroup()
76 {
77 return self::$groups[$this->id];
78 }
79 public function getFirstName()
80 {
81 return '';
82 }
83 public function getLastName()
84 {
85 return '';
86 }
87 public function getSecondName()
88 {
89 return '';
90 }
91 public function getLogin()
92 {
93 return '';
94 }
95 public function getFullName()
96 {
97 return '';
98 }
99
100 public function getUnreadMessageId($topicId = 0)
101 {
102 if ($this->forumUser instanceof Forum\User)
103 {
104 return $this->forumUser->getUnreadMessageId($topicId);
105 }
106 return null;
107 }
108
109 public function readTopic($topicId = 0)
110 {
111 if ($this->forumUser instanceof Forum\User)
112 {
113 $this->forumUser->readTopic($topicId);
114 $this->forumUser->setLastVisit();
115 }
116 }
117
118 public function setLocation(int $forumId = 0, int $topicId = 0)
119 {
120 if ($this->forumUser instanceof Forum\User)
121 {
122 $this->forumUser->setLocation($forumId, $topicId);
123 }
124 }
125}
getUserGroupArray()
Определения user.php:53
getId()
Определения user.php:43
getFullName()
Определения user.php:95
int $id
Определения user.php:11
getUnreadMessageId($topicId=0)
Определения user.php:100
setLocation(int $forumId=0, int $topicId=0)
Определения user.php:118
getUserGroup()
Определения user.php:75
getSecondName()
Определения user.php:87
getGroups()
Определения user.php:48
getLastName()
Определения user.php:83
getLogin()
Определения user.php:91
readTopic($topicId=0)
Определения user.php:109
__construct(int $id)
Определения user.php:15
isAdmin()
Определения user.php:71
isAuthorized()
Определения user.php:58
getFirstName()
Определения user.php:79
$forumUser
Определения user.php:13
getParam(string $key)
Определения user.php:63
static getUserGroupIds($userId)
Определения user.php:250
$user
Определения mysql_to_pgsql.php:33
if(empty($signedUserToken)) $key
Определения quickway.php:257