1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
AttachedVoteFrontendFormatService.php
См. документацию.
1<?php
2
4
8
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}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
Определения attach.php:180
getEntityId()
Определения attach.php:587
canEdit($userId)
Определения attach.php:520
isVotedFor($userId)
Определения attach.php:780
getUserEventsAnswersStatByUserId(int $userId)
Определения attach.php:895
canRevote($userId)
Определения attach.php:505
isFinished()
Определения attach.php:986
canVote($userId)
Определения attach.php:500
canParticipate($userId)
Определения attach.php:495
getAttachId()
Определения attach.php:555
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804