20 declare(strict_types=1);
53 ilPollImageFactoryInterface $poll_image_factory
59 $this->state = $availability;
73 bool $admin_view =
false 79 if (!$this->state->hasQuestion($poll)) {
81 } elseif ($this->state->hasVotingPeriodNotStarted($poll,
false)) {
91 $this->poll_image_factory->handler()->getProcessedImageURL(
new ObjectId($poll->
getId()))
102 if ($this->state->isUserAnonymous($user_id)) {
112 $either_is_shown =
false;
114 !$this->state->hasUserAlreadyVoted($user_id, $poll) &&
115 !$this->state->hasVotingPeriodEnded($poll,
false)
118 $either_is_shown =
true;
122 $this->state->areResultsVisible($user_id, $poll) &&
123 $this->results->getTotalVotes()
128 $this->results->getTotalVotes()
130 $either_is_shown =
true;
131 } elseif ($this->state->areResultsVisible($user_id, $poll)) {
134 $this->results->getTotalVotes()
138 if (!$either_is_shown) {
141 $this->state->hasUserAlreadyVoted($user_id, $poll),
142 $this->state->willResultsBeShown($poll),
155 $this->answers->getAnswerLimitForInfo(),
158 $this->answers_renderer->render(
161 !$this->state->mayUserVote($user_id)
170 $this->results_renderer->render(
184 $this->
lng->txt(
"poll_population_singular")
190 sprintf($this->
lng->txt(
"poll_population"), $total)
197 bool $results_in_future,
203 $messages[] = $this->
lng->txt(
"poll_block_message_already_voted");
205 $messages[] = sprintf(
206 $this->
lng->txt(
"poll_voting_period_ended_info"),
211 if ($results_in_future && $has_voted) {
212 $messages[] = sprintf(
213 $this->
lng->txt(
"poll_block_results_available_on"),
221 implode(
' ', $messages)
233 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(nl2br(trim($text)))
252 $this->
lng->txt(
'poll_max_number_of_answers_info'),
259 $this->
lng->txt(
"poll_voting_period_info"),
265 $tpl->
setVariable(
'VOTE_INFO', implode(
' ', $infos));
274 $info = $this->
lng->txt(
"poll_anonymous_warning");
276 $info = $this->
lng->txt(
"poll_non_anonymous_warning");
287 $this->
lng->txt(
"poll_voting_period_full_info"),
299 $this->
lng->txt(
"poll_block_message_no_answers")
313 $description = trim($description);
317 nl2br($this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform($description))
324 if ($this->state->isOfflineOrUnavailable($poll)) {
331 $tpl->
setVariable(
"TXT_ANON", $this->
lng->txt(
'no_access_item_public'));
336 $tpl->
setVariable(
"LANG_COMMENTS", $this->
lng->txt(
'poll_comments'));
337 $tpl->
setVariable(
"COMMENT_JSCALL", $this->comments->commentJSCall($ref_id));
340 $comments_count = $this->comments->getNumberOfComments($ref_id);
342 if ($comments_count > 0) {
343 $tpl->
setVariable(
"COMMENTS_COUNT",
"(" . $comments_count .
")");
346 $tpl->
setVariable(
"COMMENTS_REDRAW_URL", $this->comments->getRedrawURL());
351 return $this->ui_renderer->render(
352 $this->ui_factory->messageBox()->info($message)
renderNotAbleToVoteMessage(ilTemplate $tpl, bool $has_voted, bool $results_in_future, int $voting_end_date)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ilObjUser $user=null,)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPollResultsRenderer $results_renderer
renderComments(ilTemplate $tpl, int $ref_id)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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