Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
posting.php
1<?php
8namespace Bitrix\Sender\Stat;
9
11
13{
14 public static function getData($letterId, array $parameters = array())
15 {
16 $letter = new Entity\Letter($letterId);
17 $postingData = $letter->getLastPostingData();
18 $postingId = $postingData['POSTING_ID'];
19
20 if (isset($parameters['USER_NAME_FORMAT']))
21 {
22 $userNameFormat = $parameters['USER_NAME_FORMAT'];
23 }
24 else
25 {
26 $userNameFormat = \CSite::GetNameFormat(true);
27 }
28 if (isset($parameters['PATH_TO_USER_PROFILE']))
29 {
30 $pathToUser = $parameters['PATH_TO_USER_PROFILE'];
31 }
32 else
33 {
34 $pathToUser = '/bitrix/admin/user_edit.php?ID=#id#&lang=' . LANGUAGE_ID;
35 }
36
37 $pathToUser = str_replace('#id#', intval($postingData['CREATED_BY']), $pathToUser);
38
39 $data = array(
40 'counters' => array(),
41 'clickList' => array()
42 );
43 $data['posting']['linkParams'] = $postingData['LINK_PARAMS'];
44 if ($postingData['DATE_SENT'])
45 {
46 $data['posting']['dateSent'] = FormatDate('x', $postingData['DATE_SENT']->getTimestamp());
47 }
48
49 $data['posting']['createdBy'] = array(
50 'id' => $postingData['CREATED_BY'],
51 'name' => \CUser::FormatName(
52 $userNameFormat,
53 array(
54 "TITLE" => $postingData['CREATED_BY_TITLE'],
55 "NAME" => $postingData['CREATED_BY_NAME'],
56 "SECOND_NAME" => $postingData['CREATED_BY_SECOND_NAME'],
57 "LAST_NAME" => $postingData['CREATED_BY_LAST_NAME'],
58 "LOGIN" => $postingData['CREATED_BY_LOGIN'],
59 ),
60 true, false
61 ),
62 'url' => $pathToUser,
63 );
64
65 if (!$postingId)
66 {
67 return $data;
68 }
69
70 $postingStat = Statistics::create()->filter('postingId', $postingId);
71 $postingStat->setCacheTtl(0);
72 $data['clickList'] = $postingStat->getClickLinks();
73 $data['counters'] = array();
74 $counters = $postingStat->getCounters();
75 foreach ($counters as $counter)
76 {
77 $data['counters'][$counter['CODE']] = $counter;
78 }
79
80 return $data;
81 }
82}
83
static getData($letterId, array $parameters=array())
Definition posting.php:14