138 if ($params[
'SET_LOG_PAGE_CACHE'] ===
'Y')
140 $resPages = LogPageTable::getList([
143 'USER_ID' => $result[
'currentUserId'],
144 '=SITE_ID' => SITE_ID,
145 '=GROUP_CODE' => $result[
'COUNTER_TYPE'],
146 'PAGE_SIZE' => $params[
'PAGE_SIZE'],
147 'PAGE_NUM' => $result[
'PAGE_NUMBER']
149 'select' => [
'PAGE_LAST_DATE',
'TRAFFIC_AVG',
'TRAFFIC_CNT',
'TRAFFIC_LAST_DATE' ]
152 if ($pagesFields = $resPages->fetch())
156 'TRAFFIC_LAST_DATE_TS' => ($pagesFields[
'TRAFFIC_LAST_DATE'] ?
$processorInstance->makeTimeStampFromDateTime($pagesFields[
'TRAFFIC_LAST_DATE'],
'FULL') : 0),
157 'TRAFFIC_AVG' => (
int)$pagesFields[
'TRAFFIC_AVG'],
158 'TRAFFIC_CNT' => (int)$pagesFields[
'TRAFFIC_CNT']
163 $result[
'isExtranetSite']
167 $res = UserToGroupTable::getList([
169 'GROUP_DATE_CREATE' =>
'ASC'
172 'USER_ID' => $result[
'currentUserId'],
173 '@ROLE' => UserToGroupTable::getRolesMember(),
174 '!GROUP_DATE_CREATE' =>
false
177 'GROUP_DATE_CREATE' =>
'GROUP.DATE_CREATE'
180 if ($relation = $res->fetch())
187 $result[
'COUNTER_TYPE'] !==
'**'
188 || $result[
'MY_GROUPS_ONLY'] !==
'Y'
190 && $result[
'PAGE_NUMBER'] <= 1
193 $resPages = LogPageTable::getList([
195 'PAGE_LAST_DATE' =>
'DESC'
198 '=SITE_ID' => SITE_ID,
199 '=GROUP_CODE' => $result[
'COUNTER_TYPE'],
200 'PAGE_SIZE' => $params[
'PAGE_SIZE'],
201 'PAGE_NUM' => $result[
'PAGE_NUMBER']
203 'select' => [
'PAGE_LAST_DATE' ]
206 if ($pagesFields = $resPages->fetch())
221 $lastEventFields =
false;
222 if (is_array($result[
'Events']))
224 $tmp = $result[
'Events'];
225 $lastEventFields = array_pop($tmp);
229 $result[
'LAST_ENTRY_DATE_TS'] = 0;
230 $result[
'dateLastPageId'] = ($lastEventFields ? $lastEventFields[
'ID'] : 0);
232 if ($lastEventFields)
234 if ($params[
'USE_FOLLOW'] ===
'N')
238 $result[
'LAST_ENTRY_DATE_TS'] =
$processorInstance->makeTimeStampFromDateTime($lastEventFields[
'LOG_DATE'],
'FULL');
240 elseif ($lastEventFields[
'LOG_UPDATE'])
242 $result[
'LAST_ENTRY_DATE_TS'] =
$processorInstance->makeTimeStampFromDateTime($lastEventFields[
'LOG_UPDATE'],
'FULL');
247 empty($result[
'LAST_ENTRY_DATE_TS'])
248 && $lastEventFields[
'DATE_FOLLOW']
251 $result[
'LAST_ENTRY_DATE_TS'] =
$processorInstance->makeTimeStampFromDateTime($lastEventFields[
'DATE_FOLLOW'],
'FULL');
255 if ($params[
'SET_LOG_PAGE_CACHE'] !==
'N')
257 $result[
'dateLastPageTS'] = $result[
'LAST_ENTRY_DATE_TS'];
260 $dateLastPage =
null;
261 if (!empty($result[
'dateLastPageTS']))
263 $dateLastPage = convertTimeStamp($result[
'dateLastPageTS'],
'FULL');
267 $params[
'SET_LOG_PAGE_CACHE'] ===
'Y'
269 && Util::checkUserAuthorized()
283 'TRAFFIC_LAST_DATE_TS' => 0
287 $bNeedSetTraffic = \CSocNetLogComponent::isSetTrafficNeeded([
288 'PAGE_NUMBER' => $result[
'PAGE_NUMBER'],
289 'GROUP_CODE' => $result[
'COUNTER_TYPE'],
290 'TRAFFIC_LAST_DATE_TS' =>
$lastPageData[
'TRAFFIC_LAST_DATE_TS']
293 \CSocNetLogPages::set(
294 $result[
'currentUserId'],
295 convertTimeStamp(
$processorInstance->makeTimeStampFromDateTime($dateLastPage,
'FULL') - $result[
'TZ_OFFSET'],
'FULL'),
296 $params[
'PAGE_SIZE'],
297 $result[
'PAGE_NUMBER'],
299 $result[
'COUNTER_TYPE'],
302 ? (
$lastPageData[
'TRAFFIC_AVG'] + $this->getDateFirstPageTimestamp() - $result[
'dateLastPageTS']) / (
$lastPageData[
'TRAFFIC_CNT'] + 1)
313 (
int)$result[
'PAGE_NUMBER'] === 1
314 && $params[
'USE_TASKS'] ===
'Y'
315 && $result[
'EXPERT_MODE'] !==
'Y'
318 $result[
'EXPERT_MODE_SET'] = LogViewTable::checkExpertModeAuto($result[
'currentUserId'],
$processorInstance->getTasksCount(), $params[
'PAGE_SIZE']);
319 if ($result[
'EXPERT_MODE_SET'])
321 $params[
'SET_LOG_COUNTER'] =
'N';