19 declare(strict_types=1);
52 ilPollImageFactoryInterface $poll_image_factory
58 $this->state = $availability;
72 bool $admin_view =
false 78 if (!$this->state->hasQuestion($poll)) {
80 } elseif ($this->state->hasVotingPeriodNotStarted($poll,
false)) {
90 $this->poll_image_factory->handler()->getProcessedImageURL(
new ObjectId($poll->
getId()))
101 if ($this->state->isUserAnonymous($user_id)) {
111 $either_is_shown =
false;
113 !$this->state->hasUserAlreadyVoted($user_id, $poll) &&
114 !$this->state->hasVotingPeriodEnded($poll,
false)
117 $either_is_shown =
true;
121 $this->state->areResultsVisible($user_id, $poll) &&
122 $this->results->getTotalVotes()
127 $this->results->getTotalVotes()
129 $either_is_shown =
true;
130 } elseif ($this->state->areResultsVisible($user_id, $poll)) {
133 $this->results->getTotalVotes()
137 if (!$either_is_shown) {
140 $this->state->hasUserAlreadyVoted($user_id, $poll),
141 $this->state->willResultsBeShown($poll),
154 $this->answers->getAnswerLimitForInfo(),
157 $this->answers_renderer->render(
160 !$this->state->mayUserVote($user_id)
169 $this->results_renderer->render(
183 $this->
lng->txt(
"poll_population_singular")
189 sprintf($this->
lng->txt(
"poll_population"), $total)
196 bool $results_in_future,
202 $messages[] = $this->
lng->txt(
"poll_block_message_already_voted");
205 $this->
lng->txt(
"poll_voting_period_ended_info"),
210 if ($results_in_future && $has_voted) {
212 $this->
lng->txt(
"poll_block_results_available_on"),
232 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(nl2br(trim($text)))
251 $this->
lng->txt(
'poll_max_number_of_answers_info'),
258 $this->
lng->txt(
"poll_voting_period_info"),
264 $tpl->
setVariable(
'VOTE_INFO', implode(
' ', $infos));
273 $info = $this->
lng->txt(
"poll_anonymous_warning");
275 $info = $this->
lng->txt(
"poll_non_anonymous_warning");
286 $this->
lng->txt(
"poll_voting_period_full_info"),
298 $this->
lng->txt(
"poll_block_message_no_answers")
312 $description = trim($description);
316 nl2br($this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform($description))
323 if ($this->state->isOfflineOrUnavailable($poll)) {
330 $tpl->
setVariable(
"TXT_ANON", $this->
lng->txt(
'no_access_item_public'));
335 $tpl->
setVariable(
"LANG_COMMENTS", $this->
lng->txt(
'poll_comments'));
336 $tpl->
setVariable(
"COMMENT_JSCALL", $this->comments->commentJSCall($ref_id));
339 $comments_count = $this->comments->getNumberOfComments($ref_id);
341 if ($comments_count > 0) {
342 $tpl->
setVariable(
"COMMENTS_COUNT",
"(" . $comments_count .
")");
345 $tpl->
setVariable(
"COMMENTS_REDRAW_URL", $this->comments->getRedrawURL());
350 return $this->ui_renderer->render(
351 $this->ui_factory->messageBox()->info($message)
renderNotAbleToVoteMessage(ilTemplate $tpl, bool $has_voted, bool $results_in_future, int $voting_end_date)
renderNoQuestionMessage(ilTemplate $tpl)
renderResults(ilTemplate $tpl, ilObjPoll $poll)
ilPollResultsHandler $results
renderNotWithinVotingPeriodMessage(ilTemplate $tpl, int $vote_start, int $vote_end)
getMessageBox(string $message)
getFormattedDate(int $date)
renderTotalParticipantsInfo(ilTemplate $tpl, int $total)
ilPollImageFactoryInterface $poll_image_factory
renderDescription(ilTemplate $tpl, string $description)
renderAnchor(ilTemplate $tpl, int $obj_id)
ilPollAnswersHandler $answers
renderAnswers(ilTemplate $tpl, ilObjPoll $poll, int $user_id)
ilPollCommentsHandler $comments
setVariable($variable, $value='')
Sets a variable value.
renderMiscVoteInfo(ilTemplate $tpl, ?int $answer_limit, int $deadline)
renderQuestion(ilTemplate $tpl, string $text, ?string $img_path)
ilPollResultsRenderer $results_renderer
renderComments(ilTemplate $tpl, int $ref_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
getLongDescription()
get object long description (stored in object_description)
renderAvailability(ilTemplate $tpl, ilObjPoll $poll)
renderAnswersAndResults(ilTemplate $tpl, ilObjPoll $poll, int $user_id)
__construct(ilLanguage $lng, UIFactory $ui_factory, UIRenderer $ui_renderer, Refinery $refinery, ilPollStateInfo $availability, ilPollCommentsHandler $comments, ilPollAnswersHandler $answers, ilPollAnswersRenderer $answers_renderer, ilPollResultsHandler $results, ilPollResultsRenderer $results_renderer, ilPollImageFactoryInterface $poll_image_factory)
render(ilTemplate $tpl, int $ref_id, int $user_id, ilObjPoll $poll, bool $admin_view=false)
renderAnonimityInfo(ilTemplate $tpl, bool $anonymous)
renderAlertForAnonymousUser(ilTemplate $tpl)
ilPollAnswersRenderer $answers_renderer