69 $groupId = (isset($this->arParams[
'GROUP_ID']) ? (int)$this->arParams[
'GROUP_ID'] : 0);
72 SITE_TEMPLATE_ID !==
'bitrix24'
73 || !Loader::includeModule(
'intranet')
79 $result[
'showThemePicker'] = (
81 && (empty($result[
'TAB']) || $result[
'TAB'] ===
'edit')
82 && ($this->arParams[
'THEME_ENTITY_TYPE'] ??
null) ===
'SONET_GROUP'
85 $result[
'themePickerData'] = [];
87 if (!$result[
'showThemePicker'])
94 $themePicker =
new ThemePicker(SITE_TEMPLATE_ID,
false, $USER->getId(), ThemePicker::ENTITY_TYPE_SONET_GROUP, $groupId);
95 $themeId = $themePicker->getCurrentThemeId();
99 $res = ThemeTable::getList([
101 '=ENTITY_TYPE' => $themePicker->getEntityType(),
102 'ENTITY_ID' => $themePicker->getEntityId(),
103 '=CONTEXT' => $themePicker->getContext(),
105 'select' => [
'USER_ID' ],
108 ($themeFields = $res->fetch())
109 && (
int)$themeFields[
'USER_ID'] > 0
112 $themeUserId = (int)$themeFields[
'USER_ID'];
115 $result[
'themePickerData'] = $themePicker->getTheme($themeId, $themeUserId);
117 elseif ($themePicker =
new ThemePicker(SITE_TEMPLATE_ID))
119 $themesList = $themePicker->getPatternThemes();
120 $result[
'themePickerData'] = $themesList[array_rand($themesList)];
126 global $USER_FIELD_MANAGER;
128 $result[
'GROUP_PROPERTIES'] = $USER_FIELD_MANAGER->getUserFields(
'SONET_GROUP', 0, LANGUAGE_ID);
130 foreach ($result[
'GROUP_PROPERTIES'] as $field => $userFieldFata)
133 !empty($userFieldFata[
'EDIT_IN_LIST'])
134 && $userFieldFata[
'EDIT_IN_LIST'] ===
'N'
136 empty($userFieldFata[
'MANDATORY'])
137 || $userFieldFata[
'MANDATORY'] !==
'Y'
141 unset($result[
'GROUP_PROPERTIES'][$field]);
145 $result[
'GROUP_PROPERTIES'][$field][
'EDIT_FORM_LABEL'] = (
146 (string)$userFieldFata[
'EDIT_FORM_LABEL'] !==
''
147 ? $userFieldFata[
'EDIT_FORM_LABEL']
148 : $userFieldFata[
'FIELD_NAME']
150 $result[
'GROUP_PROPERTIES'][$field][
'EDIT_FORM_LABEL'] = htmlspecialcharsEx($result[
'GROUP_PROPERTIES'][$field][
'EDIT_FORM_LABEL']);
151 $result[
'GROUP_PROPERTIES'][$field][
'~EDIT_FORM_LABEL'] = $result[
'GROUP_PROPERTIES'][$field][
'EDIT_FORM_LABEL'];
155 public static function processWorkgroupData(&$groupId, &$groupPropertiesList = [], &$groupData = [], $tab =
false): void
159 $currentUserId = (int)$USER->getId();
160 $currentAdmin = \CSocNetUser::isCurrentUserModuleAdmin();
161 $groupFields = \CSocNetGroup::getById($groupId);
163 $canUpdate = \Bitrix\Socialnetwork\Helper\Workgroup\Access::canUpdate([
164 'groupId' => $groupId,
167 $groupPerms = \Bitrix\Socialnetwork\Helper\Workgroup::getPermissions([
168 'groupId' => $groupId,
182 || $groupPerms[
'UserCanInitiate']
183 || $groupPerms[
'UserCanModifyGroup']
189 $groupData[
'NAME'] = $groupFields[
'NAME'];
190 $groupData[
'DESCRIPTION'] = $groupFields[
"DESCRIPTION"];
191 $groupData[
'IMAGE_ID_DEL'] =
'N';
192 $groupData[
'SUBJECT_ID'] = $groupFields[
'SUBJECT_ID'];
193 $groupData[
'VISIBLE'] = $groupFields[
'VISIBLE'];
194 $groupData[
'OPENED'] = $groupFields[
'OPENED'];
195 $groupData[
'CLOSED'] = $groupFields[
'CLOSED'];
196 $groupData[
'PROJECT'] = ($groupFields[
'PROJECT'] ===
'Y' ?
'Y' :
'N');
197 $groupData[
'PROJECT_DATE_START'] = ($groupData[
'PROJECT'] ===
'Y' ? $groupFields[
'PROJECT_DATE_START'] :
false);
198 $groupData[
'PROJECT_DATE_FINISH'] = ($groupData[
'PROJECT'] ===
'Y' ? $groupFields[
'PROJECT_DATE_FINISH'] :
false);
199 $groupData[
'KEYWORDS'] = $groupFields[
'KEYWORDS'];
200 $groupData[
'OWNER_ID'] = $groupFields[
'OWNER_ID'];
201 $groupData[
'INITIATE_PERMS'] = $groupFields[
'INITIATE_PERMS'];
202 $groupData[
'SPAM_PERMS'] = $groupFields[
'SPAM_PERMS'];
203 $groupData[
'IMAGE_ID'] = $groupFields[
'IMAGE_ID'];
204 $groupData[
'IMAGE_ID_FILE'] = \CFile::getFileArray($groupFields[
'IMAGE_ID']);
205 $groupData[
'IMAGE_ID_IMG'] =
'<img src="' . ($groupData[
'IMAGE_ID_FILE'] !=
false ? $groupData[
'IMAGE_ID_FILE'][
'SRC'] :
'/bitrix/images/1.gif') .
'" height="60" class="sonet-group-create-popup-image" id="sonet_group_create_popup_image" border="0">';
206 $groupData[
'MODERATOR_IDS'] = [];
207 $groupData[
'LANDING'] = ($groupFields[
'LANDING'] ===
'Y' ?
'Y' :
'N');
208 $groupData[
'SCRUM_OWNER_ID'] = ($groupFields[
'SCRUM_OWNER_ID'] ?:
null);
209 $groupData[
'SCRUM_MASTER_ID'] = ($groupFields[
'SCRUM_MASTER_ID'] ?:
null);
210 $groupData[
'SCRUM_SPRINT_DURATION'] = ($groupFields[
'SCRUM_SPRINT_DURATION'] ?:
null);
211 $groupData[
'SCRUM_TASK_RESPONSIBLE'] = ($groupFields[
'SCRUM_TASK_RESPONSIBLE'] ?:
null);
212 $groupData[
'AVATAR_TYPE'] = (string)($groupFields[
'AVATAR_TYPE'] ??
'');
214 foreach (array_keys($groupPropertiesList) as $field)
216 if (!isset($groupFields[$field]))
221 $groupPropertiesList[$field][
'VALUE'] = $groupFields[
'~' . $field];
222 $groupPropertiesList[$field][
'ENTITY_VALUE_ID'] = $groupFields[
'ID'];
225 $groupData[
'IS_EXTRANET_GROUP'] = (
226 Loader::includeModule(
'extranet')
227 && \CExtranet::isExtranetSocNetGroup($groupId)
232 $res = UserToGroupTable::getList([
235 'GROUP_ID' => $groupId,
237 'select' => [
'USER_ID' ]
239 while ($relation = $res->fetch())
241 $groupData[
'MODERATOR_IDS'][] = (int)$relation[
'USER_ID'];
246 $groupData[
'VISIBLE'] =
'Y';
247 $groupData[
'IS_EXTRANET_GROUP'] =
'N';
256 if ((
int)$groupId > 0)
258 $res = \CSocNetFeatures::getList(
261 'ENTITY_ID' => $groupId,
262 'ENTITY_TYPE' => SONET_ENTITY_GROUP,
265 while ($featureFields = $res->GetNext())
267 $result[$featureFields[
'FEATURE']] = $featureFields;
271 $allowedFeaturesList = \CSocNetAllowed::getAllowedFeatures();
284 'content_search' => 11,
288 uksort($allowedFeaturesList,
static function($a, $b) use ($sampleKeysList) {
290 $valA = ($sampleKeysList[$a] ?? 100);
291 $valB = ($sampleKeysList[$b] ?? 100);
306 foreach ($allowedFeaturesList as $feature => $featureData)
309 !is_array($featureData[
'allowed'])
310 || !in_array(SONET_ENTITY_GROUP, $featureData[
'allowed'],
true)
316 if ((
int)$groupId === 0)
318 $result[$feature][
'ACTIVE'] = (
320 ? \CUserOptions::getOption(
'socialnetwork',
'default_chat_create_default',
'Y')
321 : Option::get(
'socialnetwork',
'default_' . $feature .
'_create_default',
'Y', SITE_ID)
325 $featuresList[$feature] = [
327 isset($result[$feature])
328 ? ($result[$feature][
'FEATURE_NAME'] ??
'')
331 'Active' => (!isset($result[$feature]) || $result[$feature][
'ACTIVE'] ===
'Y')