1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
contentview.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Controller;
4
5use Bitrix\Main\Loader;
6use Bitrix\Main\Error;
7use Bitrix\Main\Engine\ActionFilter;
8use Bitrix\Socialnetwork\Item\UserContentView;
9
10class ContentView extends Base
11{
12 public function configureActions(): array
13 {
14 $configureActions = parent::configureActions();
15 $configureActions['set'] = [
16 '+prefilters' => [
17 new ActionFilter\CloseSession(),
18 ]
19 ];
20
21 return $configureActions;
22 }
23
24 public function setAction(array $params = []): ?array
25 {
26 global $USER;
27
28 $xmlIdList = (
29 isset($params["viewXMLIdList"])
30 && is_array($params["viewXMLIdList"])
31 ? $params["viewXMLIdList"]
32 : []
33 );
34
35 $context = ($params['context'] ?? '');
36
37 if (!Loader::includeModule('socialnetwork'))
38 {
39 $this->addError(new Error('Cannot include Socialnetwork module', 'SONET_CONTROLLER_CONTENTVIEW_NO_SOCIALNETWORK_MODULE'));
40 return null;
41 }
42
43 $signer = new \Bitrix\Main\Engine\ActionFilter\Service\Token($USER->getId());
44
45 foreach ($xmlIdList as $key => $item)
46 {
47 if (empty($item['xmlId']))
48 {
49 unset($xmlIdList[$key]);
50 continue;
51 }
52
53 if (!empty($item['signedKey']))
54 {
55 try
56 {
57 if ($signer->unsign($item['signedKey'], $item['xmlId']) === $item['xmlId'])
58 {
59 $xmlIdList[$key]['checkAccess'] = false;
60 }
61 else
62 {
63 unset($xmlIdList[$key]);
64 }
65 }
66 catch(\Exception $e)
67 {
68 $xmlIdList[$key]['checkAccess'] = true;
69 }
70 }
71 else
72 {
73 $xmlIdList[$key]['checkAccess'] = true;
74 }
75 }
76
77 UserContentView::set([
78 'xmlIdList' => $xmlIdList,
79 'context' => $context,
80 'userId' => $this->getCurrentUser()->getId(),
81 ]);
82
83 return [
84 'SUCCESS' => 'Y'
85 ];
86 }
87
88 public function getListAction(array $params = []): ?array
89 {
90 $contentId = (
91 isset($params['contentId'])
92 && is_string($params['contentId'])
93 ? trim($params['contentId'])
94 : ''
95 );
96
97 $page = (
98 isset($params['page'])
99 && (int)$params['page'] > 0
100 ? (int)$params['page']
101 : 1
102 );
103
105 isset($params['pathToUserProfile'])
106 && is_string($params['pathToUserProfile'])
107 ? trim($params['pathToUserProfile'])
108 : ''
109 );
110
111 if ($contentId === '')
112 {
113 $this->addError(new Error('Empty Content ID', 'SONET_CONTROLLER_CONTENTVIEW_EMPTY_CONTENT_ID'));
114 return null;
115 }
116
117 if (!Loader::includeModule('socialnetwork'))
118 {
119 $this->addError(new Error('Cannot include Socialnetwork module', 'SONET_CONTROLLER_CONTENTVIEW_NO_SOCIALNETWORK_MODULE'));
120 return null;
121 }
122
123 $userList = UserContentView::getUserList([
124 'contentId' => $contentId,
125 'page' => $page,
126 'pathToUserProfile' => $pathToUserProfile
127 ]);
128
129 $result['items'] = $userList['items'];
130 $result['itemsCount'] = count($result['items']);
131 $result['hiddenCount'] = $userList['hiddenCount'];
132
133 return $result;
134 }
135}
136
addError(Error $error)
Определения base.php:80
Определения error.php:15
getListAction(array $params=[])
Определения contentview.php:88
setAction(array $params=[])
Определения contentview.php:24
$userList
Определения discount_coupon_list.php:276
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
global $USER
Определения csv_new_run.php:40
$context
Определения csv_new_setup.php:223
if(empty($signedUserToken)) $key
Определения quickway.php:257
$page
Определения order_form.php:33
</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
$pathToUserProfile
Определения sonet_set_content_view.php:30
$xmlIdList
Определения sonet_set_content_view.php:17
$contentId
Определения sonet_set_content_view.php:27