1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
calendar_user_settings.php
См. документацию.
1<?
6{
7 private static
8 $settings = array(
9 'view' => 'month',
10 'CalendarSelCont' => false,
11 'SPCalendarSelCont' => false,
12 'meetSection' => false,
13 'crmSection' => false,
14 'showDeclined' => false,
15 'denyBusyInvitation' => false,
16 'collapseOffHours' => 'Y',
17 'showWeekNumbers' => 'N',
18 'showTasks' => 'Y',
19 'showCompletedTasks' => 'N',
20 'syncPeriodPast' => 3,
21 'syncPeriodFuture' => 12,
22 );
23
24 public static function Set($settings = array(), $userId = false)
25 {
26 if (!$userId)
27 $userId = CCalendar::GetUserId();
28 if (!$userId)
29 return;
30
31 if ($settings === false)
32 {
33 CUserOptions::SetOption("calendar", "user_settings", false, false, $userId);
34 }
35 elseif(is_array($settings))
36 {
37 $curSet = self::Get($userId);
38 foreach($settings as $key => $val)
39 {
40 if (isset(self::$settings[$key]))
41 $curSet[$key] = $val;
42 }
43 CUserOptions::SetOption("calendar", "user_settings", $curSet, false, $userId);
44 }
45 }
46
47 public static function Get($userId = false)
48 {
49 if (!$userId)
50 {
51 $userId = CCalendar::GetUserId();
52 }
53
54 $resSettings = self::$settings;
55
56 if ($userId)
57 {
58 $settings = CUserOptions::GetOption("calendar", "user_settings", false, $userId);
59 if (is_array($settings))
60 {
61 foreach($settings as $key => $value)
62 {
63 $resSettings[$key] = $value;
64 }
65 }
66
67 $resSettings['timezoneName'] = CCalendar::GetUserTimezoneName($userId);
68 $resSettings['timezoneOffsetUTC'] = CCalendar::GetCurrentOffsetUTC($userId);
69 $resSettings['timezoneDefaultName'] = '';
70
71 // We don't have default timezone for this offset for this user
72 // We will ask him but we should suggest some suitable for his offset
73 // We will ask him but we should suggest some suitable for his offset
74 if (!$resSettings['timezoneName'])
75 {
76 $resSettings['timezoneDefaultName'] = CCalendar::GetGoodTimezoneForOffset($resSettings['timezoneOffsetUTC']);
77 }
78
79 $workTime = CUserOptions::GetOption("calendar", "workTime", false, $userId);
80 if ($workTime)
81 {
82 $resSettings['work_time_start'] = $workTime['start'].'.00';
83 $resSettings['work_time_end'] = $workTime['end'].'.00';
84 }
85 }
86
87 $resSettings['showDeclined'] = intval($resSettings['showDeclined']);
88 $resSettings['denyBusyInvitation'] = intval($resSettings['denyBusyInvitation']);
89
90 return $resSettings;
91 }
92
93 public static function getFormSettings($formType, $userId = false)
94 {
95 if (!$userId)
96 $userId = CCalendar::GetUserId();
97
99 'slider_main' => array(
100 'pinnedFields' => implode(',',array('location', 'rrule'))
101 )
102 );
103 if (!isset($defaultValues[$formType]))
104 $defaultValues[$formType] = false;
105
106 //CUserOptions::DeleteOption("calendar", $formType);
107 $settings = CUserOptions::GetOption("calendar", $formType, $defaultValues[$formType], $userId);
108 if (!is_array($settings['pinnedFields']))
109 $settings['pinnedFields'] = explode(',', $settings['pinnedFields']);
110 return $settings;
111 }
112
113 public static function getTrackingUsers($userId = false, $params = array())
114 {
115 if (!$userId)
116 $userId = CCalendar::GetUserId();
117
118 $res = array();
119 $str = CUserOptions::GetOption("calendar", "superpose_tracking_users", false, $userId);
120
121 if ($str !== false && CheckSerializedData($str))
122 {
123 $ids = unserialize($str, ['allowed_classes' => false]);
124 if (is_array($ids) && count($ids) > 0)
125 {
126 foreach($ids as $id)
127 {
128 if (intval($id) > 0)
129 {
130 $res[] = intval($id);
131 }
132 }
133 }
134 }
135
136 if ($params && isset($params['userList']))
137 {
138 $params['userList'] = array_unique($params['userList']);
139 $diff = array_diff($params['userList'], $res);
140 if (count($diff) > 0)
141 {
142 $res = array_merge($res, $diff);
144 }
145 }
146
148 array(
149 'filter' => array('ID' => $res),
150 'select' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME')
151 )
152 );
153
154 $trackedUsers = array();
155 while ($user = $res->fetch())
156 {
157 $user['FORMATTED_NAME'] = CCalendar::GetUserName($user);
158 $trackedUsers[] = $user;
159 }
160
161 return $trackedUsers;
162 }
163 public static function setTrackingUsers($userId = false, $value = array())
164 {
165 if (!$userId)
166 $userId = CCalendar::GetUserId();
167
168 if (!is_array($value))
169 $value = array();
170
171 CUserOptions::SetOption("calendar", "superpose_tracking_users", serialize($value), false, $userId);
172 }
173 public static function getTrackingGroups($userId = false, $params = array())
174 {
175 $res = array();
176 $str = CUserOptions::GetOption("calendar", "superpose_tracking_groups", false, $userId);
177
178 if ($str !== false && CheckSerializedData($str))
179 {
180 $ids = unserialize($str, ['allowed_classes' => false]);
181 if (is_array($ids) && count($ids) > 0)
182 {
183 foreach($ids as $id)
184 {
185 if (intval($id) > 0)
186 {
187 $res[] = intval($id);
188 }
189 }
190 }
191 }
192
193 if ($params && isset($params['groupList']))
194 {
195 $params['groupList'] = array_unique($params['groupList']);
196 $diff = array_diff($params['groupList'], $res);
197 if (count($diff) > 0)
198 {
199 $res = array_merge($res, $diff);
201 }
202 }
203
204 return $res;
205 }
206 public static function setTrackingGroups($userId = false, $value = array())
207 {
208 if (!$userId)
209 $userId = CCalendar::GetUserId();
210
211 if (!is_array($value))
212 $value = array();
213
214 CUserOptions::SetOption("calendar", "superpose_tracking_groups", serialize($value), false, $userId);
215 }
216
217 public static function getHiddenSections($userId = false)
218 {
219 $res = array();
220
221 if (class_exists('CUserOptions') && $userId > 0)
222 {
223 $res = CUserOptions::GetOption("calendar", "hidden_sections", false, $userId);
224 if ($res !== false && is_array($res) && isset($res['hidden_sections']))
225 $res = explode(',', $res['hidden_sections']);
226 }
227 if (!is_array($res))
228 $res = array();
229
230 return $res;
231 }
232}
233?>
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getList(array $parameters=array())
Определения datamanager.php:431
static getHiddenSections($userId=false)
Определения calendar_user_settings.php:217
static getFormSettings($formType, $userId=false)
Определения calendar_user_settings.php:93
static setTrackingGroups($userId=false, $value=array())
Определения calendar_user_settings.php:206
static Set($settings=array(), $userId=false)
Определения calendar_user_settings.php:24
static setTrackingUsers($userId=false, $value=array())
Определения calendar_user_settings.php:163
static getTrackingGroups($userId=false, $params=array())
Определения calendar_user_settings.php:173
static getTrackingUsers($userId=false, $params=array())
Определения calendar_user_settings.php:113
static Get($userId=false)
Определения calendar_user_settings.php:47
$str
Определения commerceml2.php:63
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$defaultValues
Определения iblock_catalog_edit.php:124
Get()
Определения idea_idea_comment.php:22
CheckSerializedData($str, $max_depth=200)
Определения tools.php:4949
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$val
Определения options.php:1793