Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ratingvotelist.php
1<?php
2
4
6
7final class RatingVoteList extends Provider
8{
9 public const PROVIDER_ID = 'RATING_LIST';
10 public const CONTENT_TYPE_ID = 'RATING_LIST';
11
12 public static function getId(): string
13 {
14 return static::PROVIDER_ID;
15 }
16
17 public function getEventId(): array
18 {
19 return [];
20 }
21
22 public function getType(): string
23 {
25 }
26
27 public function setContentView($params = array())
28 {
29 global $USER;
30
31 if (!is_array($params))
32 {
33 $params = [];
34 }
35
36 $userId = (isset($params['user_id']) && (int)$params["user_id"] > 0 ? (int)$params['user_id'] : $USER->getId());
37 $contentEntityId = $this->getEntityId();
38
39 [ $ratingVoteTypeId, $ratingVoteEntityId ] = explode('|', $contentEntityId);
40 if (
41 empty($ratingVoteTypeId)
42 || empty($ratingVoteEntityId)
43 || !Loader::includeModule('im')
44 )
45 {
46 return false;
47 }
48
49 $CIMNotify = new \CIMNotify();
50 $CIMNotify->markNotifyReadBySubTag([
51 'RATING|' . $ratingVoteTypeId . '|' . $ratingVoteEntityId . '|' . $userId,
52 ]);
53
54 return [
55 'success' => true,
56 'savedInDB' => false
57 ];
58 }
59}