Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sonetgroup.php
1<?php
3
6
7Loc::loadMessages(__FILE__);
8
9final class SonetGroup extends Base
10{
11 public function getData($entityId = 0)
12 {
13 static $groupPath = null;
14
15 global $USER;
16
17 $result = $this->getMetaResult();
18 $options = $this->getOptions();
19
20 if ($fields = \CSocNetGroup::getByID($entityId))
21 {
22 $result['id'] = $entityId;
23 $result['name'] = (
24 isset($fields["~NAME"])
25 ? $fields["~NAME"]
26 : ''
27 );
28
29 if (
30 empty($options['skipLink'])
31 || !$options['skipLink']
32 )
33 {
34 if ($groupPath === null)
35 {
36 $groupPath = (
37 (!isset($options['mobile']) || !$options['mobile'])
38 && (!isset($options['im']) || !$options['im'])
39 ? Option::get('socialnetwork', 'workgroups_page', SITE_DIR.'company/workgroups/').'group/#group_id#/'
40 : ''
41 );
42 }
43
44 if (!empty($groupPath))
45 {
46 $extranet = (
47 isset($options['extranet'])
48 ? $options['extranet']
49 : false
50 );
51 $extranetSite = (
52 isset($options['extranetSite'])
53 ? $options['extranetSite']
54 : false
55 );
56
57 $link = \CComponentEngine::makePathFromTemplate(
58 $groupPath,
59 array(
60 "group_id" => $fields["ID"]
61 )
62 );
63
64 $groupSiteID = false;
65
66 $res = \CSocNetGroup::getSite($fields["ID"]);
67 while ($groupSiteList = $res->fetch())
68 {
69 if (
70 !$groupSiteID
71 && (
72 !$extranet
73 || $groupSiteList["LID"] != $extranetSite
74 )
75 )
76 {
77 $groupSiteID = $groupSiteList["LID"];
78 }
79 }
80
81 if ($groupSiteID)
82 {
83 $tmp = \CSocNetLogTools::processPath(array("GROUP_URL" => $link), $USER->getId(), $groupSiteID);
84 $link = ($tmp["URLS"]["GROUP_URL"] <> '' ? $tmp["SERVER_NAME"].$tmp["URLS"]["GROUP_URL"] : $link);
85 }
86
87 $result['link'] = $link;
88 }
89 }
90 }
91
92 return $result;
93 }
94
95}
static loadMessages($file)
Definition loc.php:64