3 declare(strict_types=1);
51 $this->state = $availability;
64 bool $admin_view =
false 70 if (!$this->state->hasQuestion($poll)) {
72 } elseif ($this->state->hasVotingPeriodNotStarted($poll,
false)) {
93 if ($this->state->isUserAnonymous($user_id)) {
103 $either_is_shown =
false;
105 !$this->state->hasUserAlreadyVoted($user_id, $poll) &&
106 !$this->state->hasVotingPeriodEnded($poll,
false)
109 $either_is_shown =
true;
113 $this->state->areResultsVisible($user_id, $poll) &&
114 $this->results->getTotalVotes()
119 $this->results->getTotalVotes()
121 $either_is_shown =
true;
122 } elseif ($this->state->areResultsVisible($user_id, $poll)) {
125 $this->results->getTotalVotes()
129 if (!$either_is_shown) {
132 $this->state->hasUserAlreadyVoted($user_id, $poll),
133 $this->state->willResultsBeShown($poll),
146 $this->answers->getAnswerLimitForInfo(),
149 $this->answers_renderer->render(
152 !$this->state->mayUserVote($user_id)
161 $this->results_renderer->render(
175 $this->
lng->txt(
"poll_population_singular")
181 sprintf($this->
lng->txt(
"poll_population"), $total)
188 bool $results_in_future,
194 $messages[] = $this->
lng->txt(
"poll_block_message_already_voted");
197 $this->
lng->txt(
"poll_voting_period_ended_info"),
202 if ($results_in_future && $has_voted) {
204 $this->
lng->txt(
"poll_block_results_available_on"),
243 $this->
lng->txt(
'poll_max_number_of_answers_info'),
250 $this->
lng->txt(
"poll_voting_period_info"),
256 $tpl->
setVariable(
'VOTE_INFO', implode(
' ', $infos));
265 $info = $this->
lng->txt(
"poll_anonymous_warning");
267 $info = $this->
lng->txt(
"poll_non_anonymous_warning");
278 $this->
lng->txt(
"poll_voting_period_full_info"),
290 $this->
lng->txt(
"poll_block_message_no_answers")
304 $description = trim($description);
315 if ($this->state->isOfflineOrUnavailable($poll)) {
322 $tpl->
setVariable(
"TXT_ANON", $this->
lng->txt(
'no_access_item_public'));
327 $tpl->
setVariable(
"LANG_COMMENTS", $this->
lng->txt(
'poll_comments'));
328 $tpl->
setVariable(
"COMMENT_JSCALL", $this->comments->commentJSCall($ref_id));
331 $comments_count = $this->comments->getNumberOfComments($ref_id);
333 if ($comments_count > 0) {
334 $tpl->
setVariable(
"COMMENTS_COUNT",
"(" . $comments_count .
")");
337 $tpl->
setVariable(
"COMMENTS_REDRAW_URL", $this->comments->getRedrawURL());
342 return $this->ui_renderer->render(
343 $this->ui_factory->messageBox()->info($message)
357 return htmlspecialchars(
359 ENT_QUOTES | ENT_SUBSTITUTE,
renderNotAbleToVoteMessage(ilTemplate $tpl, bool $has_voted, bool $results_in_future, int $voting_end_date)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renderNoQuestionMessage(ilTemplate $tpl)
renderResults(ilTemplate $tpl, ilObjPoll $poll)
__construct(ilLanguage $lng, UIFactory $ui_factory, UIRenderer $ui_renderer, ilPollStateInfo $availability, ilPollCommentsHandler $comments, ilPollAnswersHandler $answers, ilPollAnswersRenderer $answers_renderer, ilPollResultsHandler $results, ilPollResultsRenderer $results_renderer)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
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)
renderDescription(ilTemplate $tpl, string $description)
renderAnchor(ilTemplate $tpl, int $obj_id)
ilPollAnswersHandler $answers
renderAnswers(ilTemplate $tpl, ilObjPoll $poll, int $user_id)
ilPollCommentsHandler $comments
$messages
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setVariable($variable, $value='')
Sets a variable value.
renderMiscVoteInfo(ilTemplate $tpl, ?int $answer_limit, int $deadline)
specialCharsAsEntities(string $string)
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)
static signFile(string $path_to_file)
renderAnswersAndResults(ilTemplate $tpl, ilObjPoll $poll, int $user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
getImageFullPath(bool $a_as_thumb=false)