Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
log.php
1<?php
2
4
5class Log
6{
12 public static function __InitUserTmp($userId)
13 {
14 $title = '';
15
16 $res = \CUser::getById($userId);
17 if ($userFields = $res->GetNext())
18 {
19 $title .= \CSocNetUser::FormatName($userFields["NAME"], $userFields["LAST_NAME"], $userFields["LOGIN"]);
20 }
21
22 return $title;
23 }
24
32 public static function __InitUsersTmp($message, $titleTemplate1, $titleTemplate2)
33 {
34 $usersIdList = explode(',', $message);
35
36 $title = '';
37
38 $first = true;
39 $count = 0;
40 foreach ($usersIdList as $userId)
41 {
42 $titleTmp = self::__InitUserTmp($userId);
43
44 if ($titleTmp !== '')
45 {
46 if (!$first)
47 {
48 $title .= ", ";
49 }
50
51 $title .= $titleTmp;
52 $count++;
53 }
54
55 $first = false;
56 }
57
58 return str_replace("#TITLE#", $title, (($count > 1) ? $titleTemplate2 : $titleTemplate1));
59 }
60
66 public static function __InitGroupTmp($groupId)
67 {
68 $title = '';
69
70 $groupFields = \CSocNetGroup::GetByID($groupId);
71 if ($groupFields)
72 {
73 $title .= $groupFields["NAME"];
74 }
75
76 return $title;
77 }
78
86 public static function __InitGroupsTmp($message, $titleTemplate1, $titleTemplate2)
87 {
88 $groupsIdList = explode(',', $message);
89
90 $title = "";
91
92 $bFirst = true;
93 $count = 0;
94 foreach ($groupsIdList as $groupId)
95 {
96 $titleTmp = self::__InitGroupTmp($groupId);
97
98 if ($titleTmp !== '')
99 {
100 if (!$bFirst)
101 {
102 $title .= ", ";
103 }
104
105 $title .= $titleTmp;
106 $count++;
107 }
108
109 $bFirst = false;
110 }
111
112 return str_replace("#TITLE#", $title, (($count > 1) ? $titleTemplate2 : $titleTemplate1));
113 }
114}
static __InitGroupTmp($groupId)
Definition log.php:66
static __InitGroupsTmp($message, $titleTemplate1, $titleTemplate2)
Definition log.php:86
static __InitUserTmp($userId)
Definition log.php:12
static __InitUsersTmp($message, $titleTemplate1, $titleTemplate2)
Definition log.php:32