1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
AttachedVoteFrontendFormatService.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Vote\Service
;
4
5
use
Bitrix\Main\Engine\UrlManager
;
6
use
Bitrix\Vote\Attach
;
7
use
Bitrix\Vote\Vote\Option
;
8
9
class
AttachedVoteFrontendFormatService
10
{
11
private
AttachedVoteResultUrlService
$urlService;
12
13
public
function
__construct
()
14
{
15
$this->urlService =
new
AttachedVoteResultUrlService
();
16
}
17
18
public
function
format
(
Attach
$attach,
int
$userId
):
array
19
{
20
$signedAttachId = (
new
AttachedVoteSigner
())->sign($attach->
getAttachId
());
21
22
return
[
23
'ID'
=> (int)$attach[
'ID'
],
24
'VOTE_ID'
=> (
int
)$attach[
'VOTE_ID'
],
25
'COUNTER'
=> (int)$attach[
'COUNTER'
],
26
'QUESTIONS'
=> $attach[
'QUESTIONS'
],
27
'ANONYMITY'
=> (
int
)$attach[
'ANONYMITY'
],
28
'OPTIONS'
=> (int)$attach[
'OPTIONS'
],
29
'userAnswerMap'
=> $attach->
getUserEventsAnswersStatByUserId
(
$userId
),
30
'canEdit'
=> $attach->
canEdit
(
$userId
),
31
'canVote'
=> $attach->
canParticipate
(
$userId
) && $attach->
canVote
(
$userId
)->isSuccess(),
32
'canRevote'
=> $attach->
canParticipate
(
$userId
)
33
&& $attach->
canRevote
(
$userId
)->isSuccess()
34
&& $attach[
'OPTIONS'
] & Option::ALLOW_REVOTE
35
,
36
'isVoted'
=> (bool)$attach->
isVotedFor
(
$userId
),
37
'signedAttachId'
=> $signedAttachId,
38
'resultUrl'
=> $this->urlService->getResultUrl($signedAttachId, $attach[
'UID'
] ??
null
),
39
'downloadUrl'
=> $this->getDownloadUrl($signedAttachId),
40
'entityId'
=> (int)$attach->
getEntityId
(),
41
'isFinished'
=> $attach->
isFinished
(),
42
];
43
}
44
45
private
function
getDownloadUrl(
string
$signedAttachId): string
46
{
47
return
UrlManager::getInstance()
48
->create(
'vote.AttachedVote.download'
, [
'signedAttachId'
=> $signedAttachId])
49
->getUri()
50
;
51
}
52
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Engine\UrlManager
Определения
urlmanager.php:11
Bitrix\Vote\Attach
Определения
attach.php:180
Bitrix\Vote\Attach\getEntityId
getEntityId()
Определения
attach.php:587
Bitrix\Vote\Attach\canEdit
canEdit($userId)
Определения
attach.php:520
Bitrix\Vote\Attach\isVotedFor
isVotedFor($userId)
Определения
attach.php:780
Bitrix\Vote\Attach\getUserEventsAnswersStatByUserId
getUserEventsAnswersStatByUserId(int $userId)
Определения
attach.php:895
Bitrix\Vote\Attach\canRevote
canRevote($userId)
Определения
attach.php:505
Bitrix\Vote\Attach\isFinished
isFinished()
Определения
attach.php:986
Bitrix\Vote\Attach\canVote
canVote($userId)
Определения
attach.php:500
Bitrix\Vote\Attach\canParticipate
canParticipate($userId)
Определения
attach.php:495
Bitrix\Vote\Attach\getAttachId
getAttachId()
Определения
attach.php:555
Bitrix\Vote\Service\AttachedVoteFrontendFormatService
Определения
AttachedVoteFrontendFormatService.php:10
Bitrix\Vote\Service\AttachedVoteFrontendFormatService\format
format(Attach $attach, int $userId)
Определения
AttachedVoteFrontendFormatService.php:18
Bitrix\Vote\Service\AttachedVoteFrontendFormatService\__construct
__construct()
Определения
AttachedVoteFrontendFormatService.php:13
Bitrix\Vote\Service\AttachedVoteResultUrlService
Определения
AttachedVoteResultUrlService.php:15
Bitrix\Vote\Service\AttachedVoteSigner
Определения
AttachedVoteSigner.php:8
Bitrix\Vote\Vote\Option
Определения
option.php:11
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Vote\Service
Определения
AttachedVoteFrontendFormatService.php:3
bitrix
modules
vote
lib
Service
AttachedVoteFrontendFormatService.php
Создано системой
1.14.0