Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
rightparam.php
1<?php
2
4
9
11{
12 private $user = null;
13 private $iblockTypeId = '';
14 private $iblockId = false;
15 private $socnetGroupId = 0;
16 private $entityId = 0;
17
18 private ?int $sectionId = null;
19
20 public function __construct(Param $param)
21 {
22 $params = $param->getParams();
23
24 $this->setIblockTypeId($params["IBLOCK_TYPE_ID"]);
25 $this->setIblockId(Utils::getIblockId($params));
26 $this->setSocnetGroupId($params["SOCNET_GROUP_ID"]);
27 }
28
32 public function getUser()
33 {
34 return $this->user;
35 }
36
40 public function setUser(\CUser $user)
41 {
42 $this->user = $user;
43 }
44
48 public function getIblockTypeId()
49 {
50 return $this->iblockTypeId;
51 }
52
56 public function setIblockTypeId($iblockTypeId)
57 {
58 $this->iblockTypeId = ($iblockTypeId ? $iblockTypeId : "");
59 }
60
64 public function getIblockId()
65 {
66 return $this->iblockId;
67 }
68
72 public function setIblockId($iblockId)
73 {
74 $this->iblockId = ($iblockId ? (int)$iblockId : false);
75 }
76
80 public function getSocnetGroupId()
81 {
82 return $this->socnetGroupId;
83 }
84
88 public function setSocnetGroupId($socnetGroupId)
89 {
90 $this->socnetGroupId = (int)$socnetGroupId;
91 }
92
96 public function getEntityId()
97 {
98 return $this->entityId;
99 }
100
104 public function setEntityId($entityId)
105 {
106 $this->entityId = (int)$entityId;
107 }
108
109 /***
110 * @return int|null
111 */
112 public function getSectionId(): ?int
113 {
114 return $this->sectionId;
115 }
116
117 /***
118 * @param int $sectionId
119 */
120 public function setSectionId(int $sectionId)
121 {
122 if ($sectionId >= 0)
123 {
124 $this->sectionId = $sectionId;
125 }
126 }
127
137 {
138 $socnetGroupId = intval($this->socnetGroupId);
139 if ($socnetGroupId && Loader::includeModule("socialnetwork"))
140 {
141 $socnetGroup = \CSocNetGroup::getByID($socnetGroupId);
142 if (
143 is_array($socnetGroup) &&
144 $socnetGroup["CLOSED"] == "Y" &&
145 !\CSocNetUser::isCurrentUserModuleAdmin() &&
146 ($socnetGroup["OWNER_ID"] != $this->getUser()->getID() ||
147 Option::get("socialnetwork", "work_with_closed_groups", "N") != "Y")
148 )
149 {
150 return true;
151 }
152 }
153 return false;
154 }
155}